bake-toolkit 2.67.0 → 2.68.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b7e8c87879aebca8bbd9587f2a2763fcb2f62b32c83ef544f0071ef5ef9cd1c
4
- data.tar.gz: 0236c294b3d7a72134a77ffb0c1ef671e48be28248055fff777644ef9ae71eec
3
+ metadata.gz: d2d635c3cc903018e92f111403d9a1450fa76c82cabd5d1159afbfe1269c3b1e
4
+ data.tar.gz: a4ecb9b50ead0faaf4e3a2ac37d3d295886bb8d3e6a221f41da69e74ad805474
5
5
  SHA512:
6
- metadata.gz: 703bfcfeef0d0ddc237c096f29cac01fc545a17ee2b3d8213516964a2ad62d019bf2cb704e2898b294787322e04cf45482ca60d48733f8d4b16c4ab6417b1a9f
7
- data.tar.gz: d4478018cc512ba6b3541bf2ec5a2149689d2e9212b92c2cce33324dfb3ac64d936c1bffc178c4820da167419e171222e85a8f333bc42ab288ec6e13e8452b35
6
+ metadata.gz: b5d974d79c37da1ced9fa7ae03273a5aacd27531d2e080259225df1884b646ffc7cd2b0b2658011e80446eba81617eef4072474515ee66d500e7fbbdcb87f81f
7
+ data.tar.gz: 998f741470db5a771b26356519f58bc904a0ac26e838aca5f100e4c2f73ef646fe09aa0ca8f96f5b08c075edc3e6dd699c136462a9cab9f8708d286cf882d5e8
data/bin/bakery CHANGED
@@ -136,6 +136,7 @@ module Bake
136
136
  runOk = (ExitHelper.exit_code == 0)
137
137
  rescue Exception => e
138
138
  puts e.message
139
+ puts e.backtrace
139
140
  end
140
141
 
141
142
  if Bake.options.dev_features.detect { |x| x.start_with?("dep-overview=") }
@@ -1,156 +1,164 @@
1
- require_relative '../../bake/model/loader'
2
- require_relative '../../bake/config/loader'
3
- require_relative '../../bake/config/checks'
4
-
5
- module Bake
6
-
7
- class AdaptConfig
8
- attr_reader :referencedConfigs
9
-
10
- @@filenames = []
11
-
12
- def self.filenames
13
- @@filenames
14
- end
15
-
16
- def loadProjMeta(filename, filenum)
17
-
18
- Bake::Configs::Checks.symlinkCheck(filename)
19
- Bake::Configs::Checks.sanityFolderName(filename)
20
-
21
- f = @loader.load(filename)
22
-
23
- if f.root_elements.any? { |re| ! Metamodel::Adapt === re }
24
- Bake.formatter.printError("Config file must have only 'Adapt' elements as roots", filename)
25
- ExitHelper.exit(1)
26
- end
27
-
28
- f.root_elements.each do |a|
29
- Bake::Config::checkVer(a.requiredBakeVersion)
30
- end
31
-
32
- configs = []
33
- f.root_elements.each { |re| configs.concat(re.getConfig) }
34
- AdaptConfig::checkSyntax(configs, filename)
35
- configs
36
- end
37
-
38
- def self.checkSyntax(configs, filename, isLocalAdapt = false)
39
- Bake::Configs::Checks::commonMetamodelCheck(configs, filename, true)
40
- configs.each do |c|
41
- if not c.extends.empty?
42
- Bake.formatter.printError("Attribute 'extends' must not be used in adapt config.",c)
43
- ExitHelper.exit(1)
44
- end
45
- if c.name.empty?
46
- Bake.formatter.printError("Configs must be named.",c)
47
- ExitHelper.exit(1)
48
- end
49
- if c.project.empty?
50
- Bake.formatter.printError("The corresponding project must be specified.",c)
51
- ExitHelper.exit(1)
52
- end if !isLocalAdapt
53
- if not ["replace", "remove", "extend", "push_front"].include?c.type
54
- Bake.formatter.printError("Allowed types are 'replace', 'remove', 'extend' and 'push_front'.",c)
55
- ExitHelper.exit(1)
56
- end
57
- if not ["", "yes", "no", "all"].include?c.mergeInc
58
- Bake.formatter.printError("Allowed modes are 'all', 'yes', 'no' and unset.",c)
59
- ExitHelper.exit(1)
60
- end
61
- end
62
- end
63
-
64
- def getPotentialAdaptionProjects()
65
- potentialAdapts = []
66
- Bake.options.roots.each do |root|
67
- r = root.dir
68
- if (r.length == 3 && r.include?(":/"))
69
- r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
70
- end
71
- Bake.options.adapt.each do |a|
72
- adaptBaseName = File.expand_path(a + "/Adapt.meta")
73
- potentialAdapts << adaptBaseName if File.exists?adaptBaseName
74
- end
75
- potentialAdapts.concat(Root.search_to_depth(r, "Adapt.meta", root.depth))
76
- end
77
-
78
- potentialAdapts.uniq
79
- end
80
-
81
- def chooseProjectFilenames(potentialAdapts)
82
- @@filenames = []
83
- Bake.options.adapt.each do |a|
84
- a.gsub!(/\\/,"/")
85
- found = false
86
-
87
- # from working dir
88
- if File.exist?(a) && File.file?(a)
89
- @@filenames << File.expand_path(a)
90
- found = true
91
- end
92
- next if found
93
-
94
- # from main dir
95
- Dir.chdir Bake.options.main_dir do
96
- if File.exist?(a) && File.file?(a)
97
- @@filenames << (Bake.options.main_dir + "/" + a)
98
- found = true
99
- end
100
- end
101
- next if found
102
-
103
- # from roots
104
- Bake.options.roots.each do |root|
105
- r = root.dir
106
- Dir.chdir r do
107
- if File.exist?(a) && File.file?(a)
108
- @@filenames << (r + "/" + a)
109
- found = true
110
- end
111
- end
112
- break if found
113
- end
114
- next if found
115
-
116
- # old style
117
- adapts = potentialAdapts.find_all { |p| p.include?("/"+a+"/Adapt.meta") or p == a+"/Adapt.meta" }
118
- if adapts.empty?
119
- Bake.formatter.printError("Adaption project #{a} not found")
120
- ExitHelper.exit(1)
121
- else
122
- @@filenames << adapts[0]
123
- if (adapts.length > 1)
124
- Bake.formatter.printWarning("Adaption project #{a} exists more than once")
125
- chosen = " (chosen)"
126
- adapts.each do |f|
127
- Bake.formatter.printWarning(" #{File.dirname(f)}#{chosen}")
128
- chosen = ""
129
- end
130
- end
131
- end
132
- end
133
-
134
- end
135
-
136
- def load()
137
- @@filenames = []
138
- return [] if Bake.options.adapt.empty?
139
-
140
- @loader = Loader.new
141
-
142
- potentialProjects = getPotentialAdaptionProjects()
143
- chooseProjectFilenames(potentialProjects)
144
-
145
- configs = []
146
- @@filenames.each_with_index do |f,i|
147
- configs.concat(loadProjMeta(f, i+1))
148
- end
149
-
150
- return configs
151
- end
152
-
153
-
154
- end
155
-
156
- end
1
+ require_relative '../../bake/model/loader'
2
+ require_relative '../../bake/config/loader'
3
+ require_relative '../../bake/config/checks'
4
+
5
+ module Bake
6
+
7
+ class AdaptConfig
8
+ attr_reader :referencedConfigs
9
+
10
+ @@filenames = []
11
+
12
+ def self.filenames
13
+ @@filenames
14
+ end
15
+
16
+ def loadProjMeta(filename, filenum)
17
+
18
+ Bake::Configs::Checks.symlinkCheck(filename)
19
+ Bake::Configs::Checks.sanityFolderName(filename)
20
+
21
+ f = @loader.load(filename)
22
+
23
+ if f.root_elements.any? { |re| ! Metamodel::Adapt === re }
24
+ Bake.formatter.printError("Config file must have only 'Adapt' elements as roots", filename)
25
+ ExitHelper.exit(1)
26
+ end
27
+
28
+ f.root_elements.each do |a|
29
+ Bake::Config::checkVer(a.requiredBakeVersion)
30
+ end
31
+
32
+ configs = []
33
+ f.root_elements.each { |re| configs.concat(re.getConfig) }
34
+ AdaptConfig::checkSyntax(configs, filename)
35
+ configs
36
+ end
37
+
38
+ def self.checkSyntax(configs, filename, isLocalAdapt = false)
39
+ Bake::Configs::Checks::commonMetamodelCheck(configs, filename, true)
40
+ configs.each do |c|
41
+ if not c.extends.empty?
42
+ Bake.formatter.printError("Attribute 'extends' must not be used in adapt config.",c)
43
+ ExitHelper.exit(1)
44
+ end
45
+ if c.name.empty?
46
+ Bake.formatter.printError("Configs must be named.",c)
47
+ ExitHelper.exit(1)
48
+ end
49
+ if c.project.empty?
50
+ Bake.formatter.printError("The corresponding project must be specified.",c)
51
+ ExitHelper.exit(1)
52
+ end if !isLocalAdapt
53
+ if not ["replace", "remove", "extend", "push_front"].include?c.type
54
+ Bake.formatter.printError("Allowed types are 'replace', 'remove', 'extend' and 'push_front'.",c)
55
+ ExitHelper.exit(1)
56
+ end
57
+ if not ["", "yes", "no", "all"].include?c.mergeInc
58
+ Bake.formatter.printError("Allowed modes are 'all', 'yes', 'no' and unset.",c)
59
+ ExitHelper.exit(1)
60
+ end
61
+ end
62
+ end
63
+
64
+ def getPotentialAdaptionProjects()
65
+ potentialAdapts = []
66
+ Bake.options.roots.each do |root|
67
+ r = root.dir
68
+ if (r.length == 3 && r.include?(":/"))
69
+ r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
70
+ end
71
+ Bake.options.adapt.each do |a|
72
+ adaptBaseName = File.expand_path(a.gsub(/\(.*\)/,"") + "/Adapt.meta")
73
+ potentialAdapts << adaptBaseName if File.exists?adaptBaseName
74
+ end
75
+ potentialAdapts.concat(Root.search_to_depth(r, "Adapt.meta", root.depth))
76
+ end
77
+
78
+ potentialAdapts.uniq
79
+ end
80
+
81
+ def chooseProjectFilenames(potentialAdapts)
82
+ @@filenames = []
83
+ Bake.options.adapt.each do |aComplete|
84
+ aComplete.gsub!(/\\/,"/")
85
+ a = aComplete.gsub(/\[.*\]/,"")
86
+ projFilter = aComplete.scan(/\[(.*)\]/)
87
+ if projFilter && projFilter.length > 0
88
+ projFilter = projFilter[0][0].split(";").map {|a| a.strip}
89
+ end
90
+
91
+ found = false
92
+
93
+ # from working dir
94
+ if File.exist?(a) && File.file?(a)
95
+ @@filenames << {:file => File.expand_path(a), :projs => projFilter}
96
+ found = true
97
+ end
98
+ next if found
99
+
100
+ # from main dir
101
+ Dir.chdir Bake.options.main_dir do
102
+ if File.exist?(a) && File.file?(a)
103
+ @@filenames << {:file => (Bake.options.main_dir + "/" + a), :projs => projFilter}
104
+ found = true
105
+ end
106
+ end
107
+ next if found
108
+
109
+ # from roots
110
+ Bake.options.roots.each do |root|
111
+ r = root.dir
112
+ Dir.chdir r do
113
+ if File.exist?(a) && File.file?(a)
114
+ @@filenames << {:file => (r + "/" + a), :projs => projFilter}
115
+ found = true
116
+ end
117
+ end
118
+ break if found
119
+ end
120
+ next if found
121
+
122
+ # old style
123
+ adapts = potentialAdapts.find_all { |p| p.include?("/"+a+"/Adapt.meta") or p == a+"/Adapt.meta" }
124
+ if adapts.empty?
125
+ Bake.formatter.printError("Adaption project #{a} not found")
126
+ ExitHelper.exit(1)
127
+ else
128
+ @@filenames << {:file => adapts[0], :projs => projFilter}
129
+ if (adapts.length > 1)
130
+ Bake.formatter.printWarning("Adaption project #{a} exists more than once")
131
+ chosen = " (chosen)"
132
+ adapts.each do |f|
133
+ Bake.formatter.printWarning(" #{File.dirname(f)}#{chosen}")
134
+ chosen = ""
135
+ end
136
+ end
137
+ end
138
+ end
139
+
140
+ end
141
+
142
+ def load()
143
+ @@filenames = []
144
+ return [] if Bake.options.adapt.empty?
145
+
146
+ @loader = Loader.new
147
+
148
+ potentialProjects = getPotentialAdaptionProjects()
149
+ chooseProjectFilenames(potentialProjects)
150
+
151
+ configs = []
152
+ @@filenames.each_with_index do |f,i|
153
+ loadProjMeta(f[:file], i+1).each do |c|
154
+ configs << {:config => c, :projs => f[:projs]}
155
+ end
156
+ end
157
+
158
+ return configs
159
+ end
160
+
161
+
162
+ end
163
+
164
+ end
data/lib/bake/cache.rb CHANGED
@@ -95,7 +95,8 @@ module Bake
95
95
  end
96
96
 
97
97
  if (cache != nil)
98
- cache.adapt_filenames.each do |f|
98
+ cache.adapt_filenames.each do |fHash|
99
+ f = fHash[:file]
99
100
  fileExists = File.exists?(f)
100
101
  puts "Cache: Checking if #{f} exists: #{fileExists}" if Bake.options.debug
101
102
  if !fileExists
@@ -89,64 +89,75 @@ module Bake
89
89
  end
90
90
 
91
91
  # check if config has to be manipulated
92
- @adaptConfigs.each do |c|
93
-
94
- projSplitted = c.project.split(";")
95
- confSplitted = c.name.split(";")
96
- projPatterns = projSplitted.map { |p| /\A#{p.gsub("*", "(\\w*)")}\z/ }
97
- confPatterns = confSplitted.map { |p| /\A#{p.gsub("*", "(\\w*)")}\z/ }
98
-
99
- if projPatterns.any? {|p| p.match(config.parent.name) } \
100
- || (projName == Bake.options.main_project_name and projSplitted.any? {|p| p == "__MAIN__"}) \
101
- || projSplitted.any? {|p| p == "__ALL__"}
102
-
103
- if confPatterns.any? {|p| p.match(config.name)} \
104
- || (isMain and confSplitted.any? {|p| p == "__MAIN__"}) \
105
- || confSplitted.any? {|p| p == "__ALL__"}
106
-
107
- adaptHash = c.parent.getHash
108
-
109
- configHash = {
110
- "toolchain" => [@defaultToolchainName],
111
- "os" => [Utils::OS.name],
112
- "mainProject" => [@mainProjectName],
113
- "mainConfig" => [@mainConfigName]
114
- }
115
- config.scopes.each do |s|
116
- configHash[s.name] = [] unless configHash.has_key?(s.name)
117
- configHash[s.name] += s.value.split(";")
118
- end
119
-
120
- if !isMain && @configHashMain
121
- @configHashMain.each do |k,v|
122
- if configHash.has_key?(k)
123
- configHash[k] += v
124
- configHash[k].uniq!
125
- else
126
- configHash[k] = v
92
+ @adaptConfigs.each do |cHash|
93
+
94
+ c = cHash[:config]
95
+
96
+ projSplitted = c.project.split(";")
97
+ confSplitted = c.name.split(";")
98
+ projSplittedCmd = cHash[:projs]
99
+
100
+ projPatterns = projSplitted.map { |p| /\A#{p.gsub("*", "(\\w*)")}\z/ }
101
+ confPatterns = confSplitted.map { |p| /\A#{p.gsub("*", "(\\w*)")}\z/ }
102
+ projPatternsCmd = projSplittedCmd.map { |p| /\A#{p.gsub("*", "(\\w*)")}\z/ } if projSplittedCmd
103
+
104
+ if projSplittedCmd.empty? \
105
+ || projPatternsCmd.any? {|p| p.match(config.parent.name) } \
106
+ || (projName == Bake.options.main_project_name and projSplittedCmd.any? {|p| p == "__MAIN__"}) \
107
+ || projSplittedCmd.any? {|p| p == "__ALL__"}
108
+
109
+ if projPatterns.any? {|p| p.match(config.parent.name) } \
110
+ || (projName == Bake.options.main_project_name and projSplitted.any? {|p| p == "__MAIN__"}) \
111
+ || projSplitted.any? {|p| p == "__ALL__"}
112
+
113
+ if confPatterns.any? {|p| p.match(config.name)} \
114
+ || (isMain and confSplitted.any? {|p| p == "__MAIN__"}) \
115
+ || confSplitted.any? {|p| p == "__ALL__"}
116
+
117
+ adaptHash = c.parent.getHash
118
+
119
+ configHash = {
120
+ "toolchain" => [@defaultToolchainName],
121
+ "os" => [Utils::OS.name],
122
+ "mainProject" => [@mainProjectName],
123
+ "mainConfig" => [@mainConfigName]
124
+ }
125
+ config.scopes.each do |s|
126
+ configHash[s.name] = [] unless configHash.has_key?(s.name)
127
+ configHash[s.name] += s.value.split(";")
128
+ end
129
+
130
+ if !isMain && @configHashMain
131
+ @configHashMain.each do |k,v|
132
+ if configHash.has_key?(k)
133
+ configHash[k] += v
134
+ configHash[k].uniq!
135
+ else
136
+ configHash[k] = v
137
+ end
127
138
  end
128
139
  end
129
- end
130
-
131
- checkCondition = lambda {|name,value|
132
- return true if adaptHash[name].empty?
133
- if !configHash.has_key?(name)
134
- return adaptHash[name].any?{|ah| ah.match("")}
140
+
141
+ checkCondition = lambda {|name,value|
142
+ return true if adaptHash[name].empty?
143
+ if !configHash.has_key?(name)
144
+ return adaptHash[name].any?{|ah| ah.match("")}
145
+ end
146
+ adaptHash[name].any? { |ah| configHash[name].any?{|ch| ah.match(ch)}}
147
+ }
148
+
149
+ adaptCondition = adaptHash.all? {|name,value| checkCondition.call(name, value)}
150
+
151
+ invertLogic = (Bake::Metamodel::Unless === c.parent)
152
+ next if (adaptCondition && invertLogic) || (!adaptCondition && !invertLogic)
153
+
154
+ MergeConfig.new(c, config).merge(c.type.to_sym)
155
+
156
+ if isMain # can be changed after adapt
157
+ @defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
135
158
  end
136
- adaptHash[name].any? { |ah| configHash[name].any?{|ch| ah.match(ch)}}
137
- }
138
-
139
- adaptCondition = adaptHash.all? {|name,value| checkCondition.call(name, value)}
140
-
141
- invertLogic = (Bake::Metamodel::Unless === c.parent)
142
- next if (adaptCondition && invertLogic) || (!adaptCondition && !invertLogic)
143
159
 
144
- MergeConfig.new(c, config).merge(c.type.to_sym)
145
-
146
- if isMain # can be changed after adapt
147
- @defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
148
160
  end
149
-
150
161
  end
151
162
  end
152
163
  end
@@ -243,8 +254,8 @@ module Bake
243
254
  AdaptConfig.checkSyntax(adaptConfigs, filename, true)
244
255
  adaptConfigs.each do |ac|
245
256
  ac.project = proj.name if ac.project == "__THIS__" || ac.project == ""
257
+ @adaptConfigs << {:config => ac, :projs => []}
246
258
  end
247
- @adaptConfigs.concat(adaptConfigs)
248
259
  end
249
260
  end
250
261
 
@@ -56,6 +56,9 @@ module Bake
56
56
  cb = block.library.compileBlock
57
57
  if (block.prebuild and File.exist?adaptedPath) or
58
58
  (!cb.nil? and !(cb.calcSources(true, true) - cb.source_files_ignored_in_lib).empty?)
59
+ if Bake.options.consoleOutput_fullnames
60
+ adaptedPath = File.expand_path(adaptedPath, @projectDir)
61
+ end
59
62
  @@linker_libs_array << adaptedPath
60
63
  @@source_libraries << adaptedPath
61
64
  end
@@ -67,6 +70,9 @@ module Bake
67
70
  cb.object_files_ignored_in_lib.each do |ldirect|
68
71
  adaptedPath, prefix = adaptPath(ldirect, block, prefix)
69
72
  if (!block.prebuild or File.exist?adaptedPath)
73
+ if Bake.options.consoleOutput_fullnames
74
+ adaptedPath = File.expand_path(adaptedPath, @projectDir)
75
+ end
70
76
  @@linker_libs_array << adaptedPath
71
77
  @@source_libraries << adaptedPath
72
78
  end
@@ -1,179 +1,179 @@
1
- require_relative 'metamodel'
2
- require_relative 'language'
3
- require_relative '../../common/version'
4
-
5
- require 'rgen/environment'
6
- require 'rgen/fragment/dump_file_cache'
7
- require 'rgen/fragment/fragmented_model'
8
- require 'rgen/util/file_cache_map'
9
-
10
- require 'rtext/default_loader'
11
-
12
- require_relative '../../common/ext/rgen'
13
- require_relative '../../common/exit_helper'
14
- require_relative '../toolchain/colorizing_formatter'
15
- require_relative '../options/options'
16
-
17
- module Bake
18
-
19
- class Loader
20
-
21
- attr_reader :model
22
-
23
- def initialize
24
- @env = RGen::Environment.new
25
-
26
- fcm = RGen::Util::FileCacheMap.new(".bake", ".cache")
27
- fcm.version_info = Version.number
28
-
29
- if !Bake.options.dry
30
- @DumpFileCache = RGen::Fragment::DumpFileCache.new(fcm)
31
- else
32
- @DumpFileCache = nil
33
- end
34
-
35
- @model = RGen::Fragment::FragmentedModel.new(:env => @env)
36
-
37
- @globalFilterStrMap = {
38
- Bake::Metamodel::StartupSteps => "STARTUP",
39
- Bake::Metamodel::PreSteps => "PRE",
40
- Bake::Metamodel::PostSteps => "POST",
41
- Bake::Metamodel::ExitSteps => "EXIT",
42
- Bake::Metamodel::CleanSteps => "CLEAN"
43
- }
44
- end
45
-
46
- def load_internal(filename, silent = false)
47
- silent = false if Bake.options.debug
48
- loader = RText::DefaultLoader.new(
49
- Bake::Language,
50
- @model,
51
- :file_provider => proc { [filename] },
52
- :cache => @DumpFileCache)
53
- loader.load(:before_load => proc {|fragment, kind|
54
- case kind
55
- when :load_update_cache
56
- if Bake.options.verbose >= 3
57
- puts "Loading and caching #{fragment.location}" unless silent
58
- else
59
- puts "Loading #{fragment.location}" unless silent
60
- end
61
- when :load_cached
62
- if Bake.options.verbose >= 3
63
- puts "Loading cached #{fragment.location}" unless silent
64
- else
65
- puts "Loading #{fragment.location}" unless silent
66
- end
67
- when :load
68
- puts "Loading #{fragment.location}" unless silent
69
- else
70
- Bake.formatter.printError("Error: Could not load #{fragment.location}")
71
- ExitHelper.exit(1)
72
- end
73
- })
74
-
75
- if !Bake.options.dry
76
- Utils.gitIgnore(File.dirname(filename)+"/.bake")
77
- end
78
-
79
- frag = @model.fragments[0]
80
- @model.remove_fragment(frag)
81
- frag
82
- end
83
-
84
- def filterElement?(elem)
85
- return false if Bake::Metamodel::Project === elem
86
-
87
- # 1st prio: explicit single filter
88
- if elem.filter != ""
89
- return true if Bake.options.exclude_filter.include?elem.filter
90
- return false if Bake.options.include_filter.include?elem.filter
91
- end
92
-
93
- # 2nd prio: explicit global filter
94
- if defined?(elem.parent)
95
- globalFilterStr = @globalFilterStrMap[elem.parent.class]
96
- if (globalFilterStr)
97
- return true if Bake.options.exclude_filter.include?globalFilterStr
98
- return false if Bake.options.include_filter.include?globalFilterStr
99
- end
100
- end
101
-
102
- # 3nd prio: default
103
- return true if elem.default == "off"
104
- false
105
- end
106
-
107
- def applyFilterOnArray(a)
108
- toRemove = []
109
- a.each do |elem|
110
- if filterElement?(elem)
111
- toRemove << elem
112
- else
113
- applyFilterOnElement(elem)
114
- end
115
- end
116
- toRemove.each { |r| r.parent = nil if r.respond_to?(:parent=) }
117
- return toRemove
118
- end
119
-
120
- def applyFilterOnElement(elem)
121
- return if elem.nil?
122
- elem.class.ecore.eAllReferences.each do |f|
123
- next unless f.containment
124
- begin
125
- childData = elem.getGeneric(f.name)
126
- rescue Exception => ex
127
- next
128
- end
129
- next if childData.nil?
130
- if (Array === childData)
131
- applyFilterOnArray(childData)
132
- elsif Metamodel::ModelElement === childData
133
- if filterElement?(childData)
134
- childData.parent = nil
135
- else
136
- applyFilterOnElement(childData)
137
- end
138
- end
139
- end
140
- end
141
-
142
- def load(filename)
143
- sumErrors = 0
144
-
145
- if not File.exists?filename
146
- Bake.formatter.printError("Error: #{filename} does not exist")
147
- ExitHelper.exit(1)
148
- end
149
-
150
- frag = nil
151
- if not Bake.options.nocache
152
- frag = load_internal(filename) # regular load
153
- frag = nil if frag.root_elements.length > 0 and filename != frag.root_elements[0].file_name
154
- end
155
-
156
- if frag.nil?
157
- def @DumpFileCache.load(fragment)
158
- :invalid
159
- end
160
- frag = load_internal(filename, !Bake.options.nocache)
161
- end
162
-
163
- frag.data[:problems].each do |p|
164
- Bake.formatter.printError(p.message, p.file, p.line)
165
- end
166
-
167
- if frag.data[:problems].length > 0
168
- ExitHelper.exit(1)
169
- end
170
-
171
- tor = applyFilterOnArray(frag.root_elements)
172
- frag.root_elements.delete_if {|re| tor.include?(re)}
173
-
174
- return frag
175
-
176
- end
177
-
178
- end
1
+ require_relative 'metamodel'
2
+ require_relative 'language'
3
+ require_relative '../../common/version'
4
+
5
+ require 'rgen/environment'
6
+ require 'rgen/fragment/dump_file_cache'
7
+ require 'rgen/fragment/fragmented_model'
8
+ require 'rgen/util/file_cache_map'
9
+
10
+ require 'rtext/default_loader'
11
+
12
+ require_relative '../../common/ext/rgen'
13
+ require_relative '../../common/exit_helper'
14
+ require_relative '../toolchain/colorizing_formatter'
15
+ require_relative '../options/options'
16
+
17
+ module Bake
18
+
19
+ class Loader
20
+
21
+ attr_reader :model
22
+
23
+ def initialize
24
+ @env = RGen::Environment.new
25
+
26
+ fcm = RGen::Util::FileCacheMap.new(".bake", ".cache")
27
+ fcm.version_info = Version.number
28
+
29
+ if !Bake.options.dry
30
+ @DumpFileCache = RGen::Fragment::DumpFileCache.new(fcm)
31
+ else
32
+ @DumpFileCache = nil
33
+ end
34
+
35
+ @model = RGen::Fragment::FragmentedModel.new(:env => @env)
36
+
37
+ @globalFilterStrMap = {
38
+ Bake::Metamodel::StartupSteps => "STARTUP",
39
+ Bake::Metamodel::PreSteps => "PRE",
40
+ Bake::Metamodel::PostSteps => "POST",
41
+ Bake::Metamodel::ExitSteps => "EXIT",
42
+ Bake::Metamodel::CleanSteps => "CLEAN"
43
+ }
44
+ end
45
+
46
+ def load_internal(filename, silent = false)
47
+ silent = false if Bake.options.debug
48
+ loader = RText::DefaultLoader.new(
49
+ Bake::Language,
50
+ @model,
51
+ :file_provider => proc { [filename] },
52
+ :cache => @DumpFileCache)
53
+ loader.load(:before_load => proc {|fragment, kind|
54
+ case kind
55
+ when :load_update_cache
56
+ if Bake.options.verbose >= 3
57
+ puts "Loading and caching #{fragment.location}" unless silent
58
+ else
59
+ puts "Loading #{fragment.location}" unless silent
60
+ end
61
+ when :load_cached
62
+ if Bake.options.verbose >= 3
63
+ puts "Loading cached #{fragment.location}" unless silent
64
+ else
65
+ puts "Loading #{fragment.location}" unless silent
66
+ end
67
+ when :load
68
+ puts "Loading #{fragment.location}" unless silent
69
+ else
70
+ Bake.formatter.printError("Error: Could not load #{fragment.location}")
71
+ ExitHelper.exit(1)
72
+ end
73
+ })
74
+
75
+ if !Bake.options.dry
76
+ Utils.gitIgnore(File.dirname(filename)+"/.bake")
77
+ end
78
+
79
+ frag = @model.fragments[0]
80
+ @model.remove_fragment(frag)
81
+ frag
82
+ end
83
+
84
+ def filterElement?(elem)
85
+ return false if Bake::Metamodel::Project === elem
86
+
87
+ # 1st prio: explicit single filter
88
+ if elem.filter != ""
89
+ return true if Bake.options.exclude_filter.include?elem.filter
90
+ return false if Bake.options.include_filter.include?elem.filter
91
+ end
92
+
93
+ # 2nd prio: explicit global filter
94
+ if defined?(elem.parent)
95
+ globalFilterStr = @globalFilterStrMap[elem.parent.class]
96
+ if (globalFilterStr)
97
+ return true if Bake.options.exclude_filter.include?globalFilterStr
98
+ return false if Bake.options.include_filter.include?globalFilterStr
99
+ end
100
+ end
101
+
102
+ # 3nd prio: default
103
+ return true if elem.default == "off"
104
+ false
105
+ end
106
+
107
+ def applyFilterOnArray(a)
108
+ toRemove = []
109
+ a.each do |elem|
110
+ if filterElement?(elem)
111
+ toRemove << elem
112
+ else
113
+ applyFilterOnElement(elem)
114
+ end
115
+ end
116
+ toRemove.each { |r| r.parent = nil if r.respond_to?(:parent=) }
117
+ return toRemove
118
+ end
119
+
120
+ def applyFilterOnElement(elem)
121
+ return if elem.nil?
122
+ elem.class.ecore.eAllReferences.each do |f|
123
+ next unless f.containment
124
+ begin
125
+ childData = elem.getGeneric(f.name)
126
+ rescue Exception => ex
127
+ next
128
+ end
129
+ next if childData.nil?
130
+ if (Array === childData)
131
+ applyFilterOnArray(childData)
132
+ elsif Metamodel::ModelElement === childData
133
+ if filterElement?(childData)
134
+ childData.parent = nil
135
+ else
136
+ applyFilterOnElement(childData)
137
+ end
138
+ end
139
+ end
140
+ end
141
+
142
+ def load(filename)
143
+ sumErrors = 0
144
+
145
+ if not File.exists?filename
146
+ Bake.formatter.printError("Error: #{filename} does not exist")
147
+ ExitHelper.exit(1)
148
+ end
149
+
150
+ frag = nil
151
+ if not Bake.options.nocache
152
+ frag = load_internal(filename) # regular load
153
+ frag = nil if frag.root_elements.length > 0 and filename != frag.root_elements[0].file_name
154
+ end
155
+
156
+ if frag.nil?
157
+ def @DumpFileCache.load(fragment)
158
+ :invalid
159
+ end
160
+ frag = load_internal(filename, !Bake.options.nocache)
161
+ end
162
+
163
+ frag.data[:problems].each do |p|
164
+ Bake.formatter.printError(p.message, p.file, p.line)
165
+ end
166
+
167
+ if frag.data[:problems].length > 0
168
+ ExitHelper.exit(1)
169
+ end
170
+
171
+ tor = applyFilterOnArray(frag.root_elements)
172
+ frag.root_elements.delete_if {|re| tor.include?(re)}
173
+
174
+ return frag
175
+
176
+ end
177
+
178
+ end
179
179
  end
@@ -197,13 +197,16 @@ module Bake
197
197
  contains_many 'except', Except, 'parent'
198
198
  end
199
199
 
200
- class Step < ModelElement
201
- has_attr 'name', String, :defaultValueLiteral => ""
200
+ class StepBase < ModelElement
202
201
  has_attr 'echo', String, :defaultValueLiteral => "on"
203
202
  has_attr 'independent', Boolean, :defaultValueLiteral => "false"
204
203
  has_many_attr 'validExitCodes', Integer
205
204
  end
206
205
 
206
+ class Step < StepBase
207
+ has_attr 'name', String, :defaultValueLiteral => ""
208
+ end
209
+
207
210
  class Makefile < Step
208
211
  has_attr 'lib', String, :defaultValueLiteral => ""
209
212
  has_attr 'target', String, :defaultValueLiteral => ""
@@ -234,27 +237,28 @@ module Bake
234
237
  has_attr 'name', String, :defaultValueLiteral => "0.0"
235
238
  end
236
239
 
237
- class CommandLine < Step
240
+ class CommandLine < StepBase
241
+ has_many_attr 'name', String, :defaultValueLiteral => ""
238
242
  end
239
243
 
240
244
  class PreSteps < ModelElement
241
- contains_many 'step', Step, 'parent'
245
+ contains_many 'step', StepBase, 'parent'
242
246
  end
243
247
 
244
248
  class PostSteps < ModelElement
245
- contains_many 'step', Step, 'parent'
249
+ contains_many 'step', StepBase, 'parent'
246
250
  end
247
251
 
248
252
  class ExitSteps < ModelElement
249
- contains_many 'step', Step, 'parent'
253
+ contains_many 'step', StepBase, 'parent'
250
254
  end
251
255
 
252
256
  class CleanSteps < ModelElement
253
- contains_many 'step', Step, 'parent'
257
+ contains_many 'step', StepBase, 'parent'
254
258
  end
255
259
 
256
260
  class StartupSteps < ModelElement
257
- contains_many 'step', Step, 'parent'
261
+ contains_many 'step', StepBase, 'parent'
258
262
  end
259
263
 
260
264
  class LinkerScript < ModelElement
@@ -344,7 +348,7 @@ module Bake
344
348
  end
345
349
 
346
350
  class CustomConfig < BaseConfig_INTERNAL
347
- contains_one 'step', Step, 'parent'
351
+ contains_one 'step', StepBase, 'parent'
348
352
  module ClassModule
349
353
  def color
350
354
  "red"
data/lib/bake/subst.rb CHANGED
@@ -388,8 +388,14 @@ module Bake
388
388
  return if Metamodel::DefaultToolchain === elem
389
389
  return if Metamodel::Toolchain === elem.class
390
390
  next if a.eType.name != "EString"
391
- substStr = substString(elem.getGeneric(a.name), elem, a.name)
392
- elem.setGeneric(a.name, substStr)
391
+ value = elem.getGeneric(a.name)
392
+ if value.kind_of?(Array)
393
+ substArr = value.map { |s| substString(s, elem, a.name) }
394
+ elem.setGeneric(a.name, substArr)
395
+ else
396
+ substStr = substString(value, elem, a.name)
397
+ elem.setGeneric(a.name, substStr)
398
+ end
393
399
  end
394
400
 
395
401
  childsRefs = elem.class.ecore.eAllReferences.select{|r| r.containment}
data/lib/blocks/block.rb CHANGED
@@ -601,6 +601,9 @@ module Bake
601
601
  if @tcs[:OUTPUT_DIR_POSTFIX] != nil
602
602
  @output_dir = @output_dir + @tcs[:OUTPUT_DIR_POSTFIX]
603
603
  end
604
+ if Bake.options.consoleOutput_fullnames
605
+ @output_dir = File.expand_path(@output_dir, @projectDir)
606
+ end
604
607
  end
605
608
 
606
609
  end
@@ -1,44 +1,44 @@
1
- require_relative 'has_execute_command'
2
-
3
- module Bake
4
- module Blocks
5
-
6
- class CommandLine
7
- include HasExecuteCommand
8
-
9
- def initialize(config)
10
- @config = config # Bake::Metamodel::CommandLine
11
- @commandLine = config.name
12
- @projectDir = config.get_project_dir
13
- end
14
-
15
- def run
16
- return true if Bake.options.linkOnly
17
- return executeCommand(@commandLine, nil, @config.validExitCodes, @config.echo)
18
- end
19
-
20
- def execute
21
- return run()
22
- end
23
-
24
- def startupStep
25
- return run()
26
- end
27
-
28
- def exitStep
29
- return run()
30
- end
31
-
32
- def cleanStep
33
- return run()
34
- end
35
-
36
- def clean
37
- # nothing to do here
38
- return true
39
- end
40
-
41
- end
42
-
43
- end
44
- end
1
+ require_relative 'has_execute_command'
2
+
3
+ module Bake
4
+ module Blocks
5
+
6
+ class CommandLine
7
+ include HasExecuteCommand
8
+
9
+ def initialize(config)
10
+ @config = config # Bake::Metamodel::CommandLine
11
+ @commandLine = config.name.kind_of?(Array) ? config.name.join(' ') : config.name
12
+ @projectDir = config.get_project_dir
13
+ end
14
+
15
+ def run
16
+ return true if Bake.options.linkOnly
17
+ return executeCommand(@commandLine, nil, @config.validExitCodes, @config.echo)
18
+ end
19
+
20
+ def execute
21
+ return run()
22
+ end
23
+
24
+ def startupStep
25
+ return run()
26
+ end
27
+
28
+ def exitStep
29
+ return run()
30
+ end
31
+
32
+ def cleanStep
33
+ return run()
34
+ end
35
+
36
+ def clean
37
+ # nothing to do here
38
+ return true
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
@@ -255,7 +255,7 @@ module Bake
255
255
  cmdJson = cmd.is_a?(Array) ? cmd.join(' ') : cmd
256
256
  srcFilePath = source
257
257
  if Bake.options.consoleOutput_fullnames
258
- srcFilePath = File.join(@projectDir, srcFilePath)
258
+ srcFilePath = File.join(@projectDir, srcFilePath) if !File.is_absolute?(srcFilePath)
259
259
  cmdJson[source] = srcFilePath
260
260
  end
261
261
  cmdJson.gsub!("\"" , "\\\"")
@@ -524,10 +524,16 @@ module Bake
524
524
 
525
525
  def calcObjects
526
526
  @object_files_ignored_in_lib = []
527
- @source_files.each do |source|
527
+ @source_files.map! do |source|
528
528
  type = get_source_type(source)
529
529
  if not type.nil?
530
530
  object = get_object_file(source)
531
+
532
+ if Bake.options.consoleOutput_fullnames
533
+ object = File.expand_path(object, @projectDir)
534
+ source = File.expand_path(source, @projectDir)
535
+ end
536
+
531
537
  if @objects.include?object
532
538
  @object_files.each do |k,v|
533
539
  if (v == object) # will be found exactly once
@@ -545,6 +551,7 @@ module Bake
545
551
  @objects << object
546
552
  end
547
553
  end
554
+ source
548
555
  end
549
556
  end
550
557
 
@@ -629,16 +636,18 @@ module Bake
629
636
  end
630
637
 
631
638
  def calcIncludesInternal(block)
632
- # puts "#{block.projectName},#{block.configName} " + block.to_s
633
639
  noDeps = @blocksRead.include?(block)
634
640
  @blocksRead << block
635
641
  block.bes.each do |be|
636
642
  if Metamodel::IncludeDir === be
637
- # puts "-- #{be.name}"
638
643
  if be.inherit == true || block == @block
639
- mappedInc = File.rel_from_to_project(@projectDir,be.name,false)
640
- mappedInc = "." if mappedInc.empty?
641
- if !@include_set.include?(mappedInc) # todo set!!
644
+ if Bake.options.consoleOutput_fullnames
645
+ mappedInc = be.name
646
+ else
647
+ mappedInc = File.rel_from_to_project(@projectDir,be.name,false)
648
+ mappedInc = "." if mappedInc.empty?
649
+ end
650
+ if !@include_set.include?(mappedInc)
642
651
  @include_list << mappedInc
643
652
  @include_set << mappedInc
644
653
  if !@include_merge.has_key?(mappedInc)
@@ -674,15 +683,7 @@ module Bake
674
683
  @include_list = []
675
684
  @include_merge = {}
676
685
  @system_includes = Set.new
677
-
678
- #puts @block.bes.length
679
- #@block.bes.each {|b| puts "#{b.class}: #{b.name}, #{b.respond_to?(:config) ? b.config : ""}"}
680
- #exit(1)
681
-
682
-
683
-
684
686
  calcIncludesInternal(@block) # includeDir and child dependencies with inherit: true
685
- # exit(1)
686
687
  @include_list = @include_list.flatten.uniq
687
688
  end
688
689
 
@@ -43,6 +43,10 @@ module Bake
43
43
  baseFilename += ".#{@config.artifactExtension.name}"
44
44
  end
45
45
  @exe_name ||= File.join([@block.output_dir, baseFilename])
46
+ if Bake.options.consoleOutput_fullnames
47
+ @exe_name = File.expand_path(@exe_name, @projectDir)
48
+ end
49
+ return @exe_name
46
50
  end
47
51
 
48
52
  def calcCmdlineFile()
@@ -34,6 +34,10 @@ module Bake
34
34
  baseFilename += ".#{@config.artifactExtension.name}"
35
35
  end
36
36
  @archive_name ||= File.join([@block.output_dir, baseFilename])
37
+ if Bake.options.consoleOutput_fullnames
38
+ @archive_name = File.expand_path(@archive_name, @projectDir)
39
+ end
40
+ return @archive_name
37
41
  end
38
42
 
39
43
  def calcCmdlineFile()
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.67.0"
4
+ "2.68.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
data/lib/tocxx.rb CHANGED
@@ -652,8 +652,8 @@ module Bake
652
652
  al = AdaptConfig.new
653
653
  adaptConfigs = al.load()
654
654
 
655
- @loadedConfig = Config.new
656
- @referencedConfigs = @loadedConfig.load(adaptConfigs)
655
+ loadedConfig = Config.new
656
+ @referencedConfigs = loadedConfig.load(adaptConfigs)
657
657
 
658
658
  cache.write_cache(@referencedConfigs, adaptConfigs)
659
659
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.67.0
4
+ version: 2.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext