bake-toolkit 2.66.0 → 2.70.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile.rb +7 -3
- data/bin/bakery +2 -1
- data/lib/adapt/config/loader.rb +164 -156
- data/lib/bake/cache.rb +2 -1
- data/lib/bake/config/loader.rb +68 -54
- data/lib/bake/libElement.rb +6 -0
- data/lib/bake/mergeConfig.rb +242 -241
- data/lib/bake/model/loader.rb +178 -178
- data/lib/bake/model/metamodel.rb +18 -18
- data/lib/bake/subst.rb +24 -4
- data/lib/bake/util.rb +1 -0
- data/lib/bakery/buildPattern.rb +3 -2
- data/lib/bakery/model/metamodel.rb +6 -0
- data/lib/bakery/toBake.rb +10 -3
- data/lib/blocks/block.rb +6 -0
- data/lib/blocks/commandLine.rb +44 -44
- data/lib/blocks/compile.rb +17 -16
- data/lib/blocks/executable.rb +4 -0
- data/lib/blocks/fileutil.rb +10 -3
- data/lib/blocks/library.rb +4 -0
- data/lib/common/root.rb +1 -0
- data/lib/common/version.rb +17 -21
- data/lib/tocxx.rb +2 -2
- metadata +20 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512387067bf3154e79bfe2993a33c20ab4b8527360b89e85105ed74cf9e724df
|
4
|
+
data.tar.gz: 017f9892593659a0c6567b51aec681751528f2b5de47ace6ef37d54944399a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676bfebf96efab215d3744dc341ffdd6026df836b9797a4cf5a1d26acd264f2ad55718b99a27e57366b900bf721e8a195e4455d97f5884f94058cd1f5e3e65bc
|
7
|
+
data.tar.gz: af6d6ba478071e3c4ad5ffaf009e581bb42f160af73f8c8646a1f24e3ae97bbb661e00a12006fe1d305bab24046ff04b41bb5ce49596dd412829a1575b6acd4a
|
data/Rakefile.rb
CHANGED
data/bin/bakery
CHANGED
@@ -112,7 +112,7 @@ module Bake
|
|
112
112
|
p = File.dirname(bp.proj)
|
113
113
|
pRel = File.rel_from_to_project(Dir.pwd, p, false)
|
114
114
|
pRel = "." if pRel.empty?
|
115
|
-
cmd = (["-m", pRel, "-b", bp.conf] + bp.args.split + passedParams)
|
115
|
+
cmd = (["-m", pRel, "-b", bp.conf] + bp.args.split + passedParams + bp.args_end.split)
|
116
116
|
cmdWithNum = "bakery #{currentRun} of #{maxRuns}: bake " + cmd.join(" ")
|
117
117
|
puts "\n#{$stars}"
|
118
118
|
Bake.formatter.printInfo(cmdWithNum)
|
@@ -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=") }
|
data/lib/adapt/config/loader.rb
CHANGED
@@ -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 |
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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 |
|
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
|
data/lib/bake/config/loader.rb
CHANGED
@@ -89,64 +89,78 @@ module Bake
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# check if config has to be manipulated
|
92
|
-
@adaptConfigs.each do |
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
+
if name == "toolchain" && configHash[name] == [""]
|
147
|
+
Bake.formatter.printWarning("Trying to adapt '#{config.name}' with 'toolchain == #{c.parent.toolchain}', but toolchain is not defined yet", c)
|
148
|
+
end
|
149
|
+
adaptHash[name].any? { |ah| configHash[name].any?{|ch| ah.match(ch)}}
|
150
|
+
}
|
151
|
+
|
152
|
+
adaptCondition = adaptHash.all? {|name,value| checkCondition.call(name, value)}
|
153
|
+
|
154
|
+
invertLogic = (Bake::Metamodel::Unless === c.parent)
|
155
|
+
next if (adaptCondition && invertLogic) || (!adaptCondition && !invertLogic)
|
156
|
+
|
157
|
+
MergeConfig.new(c, config).merge(c.type.to_sym)
|
158
|
+
|
159
|
+
if isMain # can be changed after adapt
|
160
|
+
@defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
|
135
161
|
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
162
|
|
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
163
|
end
|
149
|
-
|
150
164
|
end
|
151
165
|
end
|
152
166
|
end
|
@@ -243,8 +257,8 @@ module Bake
|
|
243
257
|
AdaptConfig.checkSyntax(adaptConfigs, filename, true)
|
244
258
|
adaptConfigs.each do |ac|
|
245
259
|
ac.project = proj.name if ac.project == "__THIS__" || ac.project == ""
|
260
|
+
@adaptConfigs << {:config => ac, :projs => []}
|
246
261
|
end
|
247
|
-
@adaptConfigs.concat(adaptConfigs)
|
248
262
|
end
|
249
263
|
end
|
250
264
|
|