bake-toolkit 2.64.4 → 2.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile.rb +7 -3
- data/lib/bake/config/loader.rb +9 -8
- data/lib/bake/mergeConfig.rb +242 -241
- data/lib/bake/model/loader.rb +4 -2
- data/lib/bake/model/metamodel.rb +5 -9
- data/lib/bake/subst.rb +16 -2
- data/lib/bake/toolchain/clang.rb +3 -0
- data/lib/bake/toolchain/clang_bitcode.rb +34 -0
- data/lib/bake/toolchain/provider.rb +2 -0
- data/lib/bake/util.rb +1 -0
- data/lib/bakery/model/metamodel.rb +5 -0
- data/lib/bakery/toBake.rb +7 -0
- data/lib/blocks/block.rb +4 -0
- data/lib/blocks/compile.rb +7 -3
- data/lib/blocks/library.rb +4 -1
- data/lib/blocks/makefile.rb +4 -2
- data/lib/common/version.rb +17 -21
- data/lib/tocxx.rb +8 -4
- metadata +25 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b7e8c87879aebca8bbd9587f2a2763fcb2f62b32c83ef544f0071ef5ef9cd1c
|
4
|
+
data.tar.gz: 0236c294b3d7a72134a77ffb0c1ef671e48be28248055fff777644ef9ae71eec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703bfcfeef0d0ddc237c096f29cac01fc545a17ee2b3d8213516964a2ad62d019bf2cb704e2898b294787322e04cf45482ca60d48733f8d4b16c4ab6417b1a9f
|
7
|
+
data.tar.gz: d4478018cc512ba6b3541bf2ec5a2149689d2e9212b92c2cce33324dfb3ac64d936c1bffc178c4820da167419e171222e85a8f333bc42ab288ec6e13e8452b35
|
data/Rakefile.rb
CHANGED
data/lib/bake/config/loader.rb
CHANGED
@@ -26,8 +26,7 @@ module Bake
|
|
26
26
|
return configname
|
27
27
|
end
|
28
28
|
|
29
|
-
def getFullProjectInternal(configs, configname, isMain) # note: configs is never empty
|
30
|
-
|
29
|
+
def getFullProjectInternal(configs, configname, isMain, extendStack) # note: configs is never empty
|
31
30
|
configname = resolveConfigName(configs, configname)
|
32
31
|
|
33
32
|
if isMain
|
@@ -60,7 +59,11 @@ module Bake
|
|
60
59
|
if config.extends != ""
|
61
60
|
config.extends.split(",").map {|ex| ex.strip}.reverse.each do |ex|
|
62
61
|
if (ex != "")
|
63
|
-
|
62
|
+
if extendStack.include?(ex)
|
63
|
+
Bake.formatter.printError("Config extends to circular loop: #{(extendStack << ex).join("->")}", configs[0].file_name)
|
64
|
+
ExitHelper.exit(1)
|
65
|
+
end
|
66
|
+
parent,parentConfigName = getFullProjectInternal(configs, ex, isMain, extendStack << ex)
|
64
67
|
MergeConfig.new(config, parent).merge(:merge)
|
65
68
|
end
|
66
69
|
end
|
@@ -70,15 +73,13 @@ module Bake
|
|
70
73
|
end
|
71
74
|
|
72
75
|
def getFullProject(projName, configs, configname, isMain)
|
73
|
-
|
74
|
-
|
75
76
|
configname = resolveConfigName(configs, configname)
|
76
77
|
|
77
78
|
if @fullProjects.has_key?(projName + "," + configname)
|
78
79
|
return @fullProjects[projName + "," + configname]
|
79
80
|
end
|
80
81
|
|
81
|
-
config, configname = getFullProjectInternal(configs, configname, isMain)
|
82
|
+
config, configname = getFullProjectInternal(configs, configname, isMain, [configname])
|
82
83
|
|
83
84
|
if isMain
|
84
85
|
@defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
|
@@ -116,7 +117,7 @@ module Bake
|
|
116
117
|
configHash[s.name] += s.value.split(";")
|
117
118
|
end
|
118
119
|
|
119
|
-
if !isMain
|
120
|
+
if !isMain && @configHashMain
|
120
121
|
@configHashMain.each do |k,v|
|
121
122
|
if configHash.has_key?(k)
|
122
123
|
configHash[k] += v
|
@@ -237,7 +238,7 @@ module Bake
|
|
237
238
|
if adaptRoots.length > 0
|
238
239
|
adaptRoots.each do |adapt|
|
239
240
|
Bake::Config::checkVer(adapt.requiredBakeVersion)
|
240
|
-
adapt.mainProject =
|
241
|
+
adapt.mainProject = proj.name if adapt.mainProject == "__THIS__"
|
241
242
|
adaptConfigs = adapt.getConfig
|
242
243
|
AdaptConfig.checkSyntax(adaptConfigs, filename, true)
|
243
244
|
adaptConfigs.each do |ac|
|
data/lib/bake/mergeConfig.rb
CHANGED
@@ -1,242 +1,243 @@
|
|
1
|
-
require_relative '../common/ext/rtext'
|
2
|
-
|
3
|
-
module Bake
|
4
|
-
|
5
|
-
class MergeConfig
|
6
|
-
|
7
|
-
def initialize(child, parent)
|
8
|
-
@child = child
|
9
|
-
@parent = parent
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.clone(obj)
|
13
|
-
if obj.is_a?(Metamodel::ModelElement)
|
14
|
-
cloneModelElement(obj)
|
15
|
-
elsif Array === obj
|
16
|
-
obj.map { |o| clone(o) }
|
17
|
-
else
|
18
|
-
obj # no clone, should not happen
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.cloneModelElement(obj)
|
23
|
-
cpy = obj.class.new
|
24
|
-
cpy.file_name = obj.file_name
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
next unless f
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
parentData
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
return true if (
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
if
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
if
|
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
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
1
|
+
require_relative '../common/ext/rtext'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
|
5
|
+
class MergeConfig
|
6
|
+
|
7
|
+
def initialize(child, parent)
|
8
|
+
@child = child
|
9
|
+
@parent = parent
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.clone(obj)
|
13
|
+
if obj.is_a?(Metamodel::ModelElement)
|
14
|
+
cloneModelElement(obj)
|
15
|
+
elsif Array === obj
|
16
|
+
obj.map { |o| clone(o) }
|
17
|
+
else
|
18
|
+
obj # no clone, should not happen
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.cloneModelElement(obj)
|
23
|
+
cpy = obj.class.new
|
24
|
+
cpy.file_name = obj.file_name
|
25
|
+
cpy.org_file_name = obj.file_name
|
26
|
+
obj.class.ecore.eAllStructuralFeatures.each do |f|
|
27
|
+
value = obj.getGeneric(f.name)
|
28
|
+
if f.is_a?(RGen::ECore::EReference) && f.containment
|
29
|
+
if value.is_a?(Array)
|
30
|
+
cpy.setGeneric(f.name, value.collect{|v| clone(v)})
|
31
|
+
elsif !value.nil?
|
32
|
+
cpy.setGeneric(f.name, clone(value))
|
33
|
+
end
|
34
|
+
elsif f.is_a?(RGen::ECore::EAttribute)
|
35
|
+
cpy.setGeneric(f.name, value) if obj.eIsSet(f.name)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
cpy
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def replace()
|
43
|
+
if Metamodel::BaseConfig_INTERNAL === @child &&
|
44
|
+
Metamodel::BaseConfig_INTERNAL === @parent
|
45
|
+
if @child.mergeInc != "" && @parent.mergeInc != "no"
|
46
|
+
@parent.mergeInc = @child.mergeInc
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
@child.class.ecore.eAllReferences.each do |f|
|
51
|
+
next unless @parent.class.ecore.eAllReferences.include?f
|
52
|
+
next unless f.containment
|
53
|
+
childData = @child.getGeneric(f.name)
|
54
|
+
if Metamodel::ModelElement === childData
|
55
|
+
@parent.setGeneric(f.name,childData) if !childData.nil?
|
56
|
+
elsif Array === childData
|
57
|
+
if !childData.empty?
|
58
|
+
parentData = @parent.getGeneric(f.name)
|
59
|
+
cclasses = childData.map { |c| c.class }.uniq
|
60
|
+
parentData.delete_if { |p| cclasses.include?p.class }
|
61
|
+
parentData += childData
|
62
|
+
@parent.setGeneric(f.name,parentData)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def hasSubNodes(elem)
|
69
|
+
elem.class.ecore.eAllReferences.each do |f|
|
70
|
+
next unless f.containment
|
71
|
+
elemData = elem.getGeneric(f.name)
|
72
|
+
return true if (Array === elemData && !elemData.empty?)
|
73
|
+
return true if (Metamodel::ModelElement === elemData)
|
74
|
+
end
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
def sameAttr(childData, parentData)
|
79
|
+
childData.class.ecore.eAllAttributes.all? { |a|
|
80
|
+
a.eAnnotations.each do |x| x.details.each do |y|
|
81
|
+
return true if (y.key == :internal and y.value == true)
|
82
|
+
end; end
|
83
|
+
a.name == "line_number" || (not childData.eIsSet(a.name)) || (childData.getGeneric(a.name) == parentData.getGeneric(a.name))
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
def removeChilds(childElem, parentElem)
|
88
|
+
return if childElem.nil? or parentElem.nil?
|
89
|
+
|
90
|
+
if Metamodel::BaseConfig_INTERNAL === childElem &&
|
91
|
+
Metamodel::BaseConfig_INTERNAL === parentElem
|
92
|
+
if childElem.mergeInc == parentElem.mergeInc
|
93
|
+
parentElem.mergeInc = ""
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
childElem.class.ecore.eAllReferences.each do |f|
|
98
|
+
next unless f.containment
|
99
|
+
begin
|
100
|
+
childData = childElem.getGeneric(f.name)
|
101
|
+
parentData = parentElem.getGeneric(f.name)
|
102
|
+
rescue Exception => ex
|
103
|
+
next # how to check fast if f.name is valid?
|
104
|
+
end
|
105
|
+
next if childData.nil? or parentData.nil?
|
106
|
+
if (Array === childData)
|
107
|
+
if !parentData.empty? && !childData.empty?
|
108
|
+
childData.each do |c|
|
109
|
+
cN = hasSubNodes(c)
|
110
|
+
toRemove = []
|
111
|
+
parentData.each do |p|
|
112
|
+
next if p.class != c.class
|
113
|
+
if (not cN)
|
114
|
+
if sameAttr(c, p)
|
115
|
+
toRemove << p
|
116
|
+
end
|
117
|
+
else
|
118
|
+
removeChilds(c, p);
|
119
|
+
end
|
120
|
+
end
|
121
|
+
toRemove.each do |r|
|
122
|
+
parentElem.removeGeneric(f.name, r)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
elsif Metamodel::ModelElement === childData
|
127
|
+
if parentData.class == childData.class && sameAttr(childData, parentData)
|
128
|
+
cN = hasSubNodes(childData)
|
129
|
+
if (not cN)
|
130
|
+
parentElem.setGeneric(f.name, nil)
|
131
|
+
else
|
132
|
+
removeChilds(childData, parentData)
|
133
|
+
end
|
134
|
+
end # otherwise not equal, will not be deleted
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def extendAttributes(childData, parentData)
|
140
|
+
parentData.class.ecore.eAllAttributes.each do |a|
|
141
|
+
childData.setGeneric(a.name, parentData.getGeneric(a.name)) if !childData.eIsSet(a.name) && parentData.eIsSet(a.name)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def extend(child, parent, push_front)
|
146
|
+
if Metamodel::BaseConfig_INTERNAL === child &&
|
147
|
+
Metamodel::BaseConfig_INTERNAL === parent
|
148
|
+
if child.mergeInc != "" && parent.mergeInc != "no"
|
149
|
+
parent.mergeInc = child.mergeInc
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
(parent.class.ecore.eAllReferences & child.class.ecore.eAllReferences).each do |f|
|
154
|
+
next unless f.containment
|
155
|
+
parentData = parent.getGeneric(f.name)
|
156
|
+
next if parentData.nil? or (Array === parentData && parentData.empty?)
|
157
|
+
childData = child.getGeneric(f.name)
|
158
|
+
|
159
|
+
if Array === parentData
|
160
|
+
if f.name == "compiler"
|
161
|
+
extendedParentData = []
|
162
|
+
parentData.each do |p|
|
163
|
+
c = childData.find { |c| p.ctype == c.ctype }
|
164
|
+
if c
|
165
|
+
extendAttributes(c, p)
|
166
|
+
extend(c, p, push_front)
|
167
|
+
extendedParentData << c
|
168
|
+
else
|
169
|
+
extendedParentData << p
|
170
|
+
end
|
171
|
+
end
|
172
|
+
restOfChildData = childData.find_all { |c| parentData.find {|p| p.ctype != c.ctype } }
|
173
|
+
child.setGeneric(f.name, extendedParentData + restOfChildData)
|
174
|
+
else
|
175
|
+
if push_front
|
176
|
+
child.setGeneric(f.name, childData + parentData)
|
177
|
+
else
|
178
|
+
child.setGeneric(f.name, parentData + childData)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
elsif Metamodel::ModelElement === parentData
|
182
|
+
if childData.nil? || childData.class != parentData.class
|
183
|
+
child.setGeneric(f.name, parentData)
|
184
|
+
else
|
185
|
+
extendAttributes(childData, parentData)
|
186
|
+
extend(childData, parentData, push_front)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def copyChildToParent(c, p)
|
193
|
+
(p.class.ecore.eAllReferences & c.class.ecore.eAllReferences).each do |f|
|
194
|
+
next unless f.containment
|
195
|
+
childData = c.getGeneric(f.name)
|
196
|
+
next if childData.nil? || (Array === childData && childData.empty?)
|
197
|
+
p.setGeneric(f.name, childData)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def merge(type)
|
202
|
+
if (@child.strict == true) && !(@child.class == @parent.class)
|
203
|
+
return
|
204
|
+
end
|
205
|
+
|
206
|
+
s = StringIO.new
|
207
|
+
ser = RText::Serializer.new(Language)
|
208
|
+
|
209
|
+
if Bake.options.debug
|
210
|
+
s.puts "\n>>>> child <<<<"
|
211
|
+
ser.serialize(@child, s)
|
212
|
+
s.puts "\n>>>> parent <<<<"
|
213
|
+
ser.serialize(@parent, s)
|
214
|
+
end
|
215
|
+
|
216
|
+
if (type == :remove)
|
217
|
+
removeChilds(@child, @parent)
|
218
|
+
elsif (type == :replace)
|
219
|
+
replace
|
220
|
+
elsif (type == :extend)
|
221
|
+
c = MergeConfig.clone(@child)
|
222
|
+
extend(c, @parent, false)
|
223
|
+
copyChildToParent(c, @parent)
|
224
|
+
elsif (type == :push_front)
|
225
|
+
c = MergeConfig.clone(@child)
|
226
|
+
extend(c, @parent, true)
|
227
|
+
copyChildToParent(c, @parent)
|
228
|
+
elsif (type == :merge)
|
229
|
+
extend(@child, MergeConfig.clone(@parent), false)
|
230
|
+
end
|
231
|
+
|
232
|
+
if Bake.options.debug
|
233
|
+
s.puts "\n>>>> result of #{type.to_s} <<<<"
|
234
|
+
ser.serialize(type == :merge ? @child : @parent, s)
|
235
|
+
puts "#{s.string}"
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
242
243
|
end
|
data/lib/bake/model/loader.rb
CHANGED
@@ -113,7 +113,8 @@ module Bake
|
|
113
113
|
applyFilterOnElement(elem)
|
114
114
|
end
|
115
115
|
end
|
116
|
-
toRemove.each { |r| r.parent = nil }
|
116
|
+
toRemove.each { |r| r.parent = nil if r.respond_to?(:parent=) }
|
117
|
+
return toRemove
|
117
118
|
end
|
118
119
|
|
119
120
|
def applyFilterOnElement(elem)
|
@@ -167,7 +168,8 @@ module Bake
|
|
167
168
|
ExitHelper.exit(1)
|
168
169
|
end
|
169
170
|
|
170
|
-
applyFilterOnArray(frag.root_elements)
|
171
|
+
tor = applyFilterOnArray(frag.root_elements)
|
172
|
+
frag.root_elements.delete_if {|re| tor.include?(re)}
|
171
173
|
|
172
174
|
return frag
|
173
175
|
|
data/lib/bake/model/metamodel.rb
CHANGED
@@ -14,16 +14,10 @@ module Bake
|
|
14
14
|
annotation :details => {'internal' => 'true'}
|
15
15
|
end
|
16
16
|
module ClassModule
|
17
|
+
attr_accessor :file_name, :org_file_name
|
17
18
|
def fragment_ref=(fref)
|
18
|
-
@
|
19
|
-
|
20
|
-
|
21
|
-
def file_name
|
22
|
-
@fname
|
23
|
-
end
|
24
|
-
|
25
|
-
def file_name=(name)
|
26
|
-
@fname = name
|
19
|
+
@file_name = fref.fragment.location
|
20
|
+
@org_file_name = fref.fragment.location
|
27
21
|
end
|
28
22
|
end
|
29
23
|
end
|
@@ -103,6 +97,7 @@ module Bake
|
|
103
97
|
class DefaultToolchain < ModelElement
|
104
98
|
has_attr 'basedOn', String, :defaultValueLiteral => ""
|
105
99
|
has_attr 'outputDir', String, :defaultValueLiteral => ""
|
100
|
+
has_attr 'outputDirPostfix', String, :defaultValueLiteral => ""
|
106
101
|
has_attr 'eclipseOrder', Boolean, :defaultValueLiteral => "false"
|
107
102
|
has_attr 'keepObjFileEndings', Boolean, :defaultValueLiteral => "false"
|
108
103
|
contains_many 'compiler', Compiler, 'parent'
|
@@ -115,6 +110,7 @@ module Bake
|
|
115
110
|
|
116
111
|
class Toolchain < ModelElement
|
117
112
|
has_attr 'outputDir', String, :defaultValueLiteral => ""
|
113
|
+
has_attr 'outputDirPostfix', String, :defaultValueLiteral => ""
|
118
114
|
contains_many 'compiler', Compiler, 'parent'
|
119
115
|
contains_one 'archiver', Archiver, 'parent'
|
120
116
|
contains_one 'linker', Linker, 'parent'
|
data/lib/bake/subst.rb
CHANGED
@@ -227,6 +227,13 @@ module Bake
|
|
227
227
|
args = Bake.options.include_filter_args[splittedVar[1]]
|
228
228
|
substStr << args if args
|
229
229
|
end
|
230
|
+
elsif var == "OriginalDir"
|
231
|
+
org = File.dirname(elem.org_file_name)
|
232
|
+
if (org == @@projDir)
|
233
|
+
substStr << @@projDir
|
234
|
+
else
|
235
|
+
substStr << File.rel_from_to_project(@@projDir,File.dirname(elem.org_file_name),false)
|
236
|
+
end
|
230
237
|
elsif var == "ProjectDir" or (splittedVar.length == 2 and splittedVar[0] == "ProjectDir")
|
231
238
|
if (var == "ProjectDir")
|
232
239
|
substStr << @@projDir
|
@@ -258,12 +265,18 @@ module Bake
|
|
258
265
|
configs = @@referencedConfigs[out_proj_name]
|
259
266
|
config = configs.select {|c| c.name == out_conf_name }.first
|
260
267
|
if config
|
261
|
-
|
262
|
-
if
|
268
|
+
|
269
|
+
if config.toolchain && config.toolchain.outputDir && config.toolchain.outputDir != ""
|
263
270
|
out_dir = config.toolchain.outputDir
|
264
271
|
else
|
265
272
|
out_dir = @@configTcMap[config][:OUTPUT_DIR]
|
266
273
|
end
|
274
|
+
if config.toolchain && config.toolchain.outputDirPostfix && config.toolchain.outputDirPostfix != ""
|
275
|
+
out_dir_postfix = config.toolchain.outputDirPostfix
|
276
|
+
else
|
277
|
+
out_dir_postfix = @@configTcMap[config][:OUTPUT_DIR_POSTFIX]
|
278
|
+
end
|
279
|
+
|
267
280
|
if not out_dir
|
268
281
|
qacPart = Bake.options.qac ? (".qac" + Bake.options.buildDirDelimiter) : ""
|
269
282
|
if out_proj_name == Bake.options.main_project_name and out_conf_name == Bake.options.build_config
|
@@ -272,6 +285,7 @@ module Bake
|
|
272
285
|
out_dir = "build" + Bake.options.buildDirDelimiter + qacPart + out_conf_name + "_" + Bake.options.main_project_name + "_" + Bake.options.build_config
|
273
286
|
end
|
274
287
|
end
|
288
|
+
out_dir += out_dir_postfix if out_dir_postfix
|
275
289
|
|
276
290
|
if (out_dir.include?"$(")
|
277
291
|
if !elem
|
data/lib/bake/toolchain/clang.rb
CHANGED
@@ -32,6 +32,9 @@ module Bake
|
|
32
32
|
if Bake::Utils::OS::name == "Mac"
|
33
33
|
CLANG_CHAIN[:ARCHIVER][:COMMAND] = "libtool"
|
34
34
|
CLANG_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "-static -o"
|
35
|
+
elsif Bake::Utils::OS::name == "Windows"
|
36
|
+
CLANG_CHAIN[:ARCHIVER][:COMMAND] = "clang"
|
37
|
+
CLANG_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "-fuse-ld=llvm-lib -o"
|
35
38
|
else
|
36
39
|
CLANG_CHAIN[:ARCHIVER][:COMMAND] = "ar"
|
37
40
|
CLANG_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "r"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative'../../common/utils'
|
2
|
+
require_relative '../toolchain/provider'
|
3
|
+
require_relative '../toolchain/errorparser/error_parser'
|
4
|
+
require_relative '../toolchain/errorparser/gcc_compiler_error_parser'
|
5
|
+
require_relative '../toolchain/errorparser/gcc_linker_error_parser'
|
6
|
+
|
7
|
+
module Bake
|
8
|
+
module Toolchain
|
9
|
+
CLANG_BITCODE_CHAIN = Provider.add("CLANG_BITCODE")
|
10
|
+
|
11
|
+
CLANG_BITCODE_CHAIN[:COMPILER][:CPP].update({
|
12
|
+
:COMMAND => "clang++",
|
13
|
+
:DEFINE_FLAG => "-D",
|
14
|
+
:OBJECT_FILE_FLAG => "-o",
|
15
|
+
:OBJ_FLAG_SPACE => true,
|
16
|
+
:OBJECT_FILE_ENDING => ".bc",
|
17
|
+
:COMPILE_FLAGS => "-emit-llvm -c ",
|
18
|
+
:ERROR_PARSER => nil,
|
19
|
+
:DEP_FLAGS => "-MD -MF",
|
20
|
+
:DEP_FLAGS_SPACE => true,
|
21
|
+
})
|
22
|
+
|
23
|
+
CLANG_BITCODE_CHAIN[:COMPILER][:C] = Utils.deep_copy(CLANG_BITCODE_CHAIN[:COMPILER][:CPP])
|
24
|
+
CLANG_BITCODE_CHAIN[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
|
25
|
+
CLANG_BITCODE_CHAIN[:COMPILER][:C][:COMMAND] = "clang"
|
26
|
+
|
27
|
+
CLANG_BITCODE_CHAIN[:ARCHIVER][:COMMAND] = "llvm-link"
|
28
|
+
CLANG_BITCODE_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "-o"
|
29
|
+
CLANG_BITCODE_CHAIN[:ARCHIVER][:ARCHIVE_FILE_ENDING] = ".bc"
|
30
|
+
|
31
|
+
CLANG_BITCODE_CHAIN[:LINKER][:COMMAND] = "llvm-link"
|
32
|
+
CLANG_BITCODE_CHAIN[:LINKER][:EXE_FLAG] = "-o"
|
33
|
+
end
|
34
|
+
end
|
@@ -88,6 +88,7 @@ module Bake
|
|
88
88
|
:PREFIX => "$(ArchiverPrefix)",
|
89
89
|
:ARCHIVE_FLAGS => "",
|
90
90
|
:ARCHIVE_FLAGS_SPACE => true,
|
91
|
+
:ARCHIVE_FILE_ENDING => ".a",
|
91
92
|
:FLAGS => "",
|
92
93
|
:ERROR_PARSER => nil,
|
93
94
|
:FILE_COMMAND => ""
|
@@ -163,6 +164,7 @@ require_relative '../toolchain/diab'
|
|
163
164
|
require_relative '../toolchain/gcc'
|
164
165
|
require_relative '../toolchain/clang'
|
165
166
|
require_relative '../toolchain/clang_analyze'
|
167
|
+
require_relative '../toolchain/clang_bitcode'
|
166
168
|
require_relative '../toolchain/ti'
|
167
169
|
require_relative '../toolchain/greenhills'
|
168
170
|
require_relative '../toolchain/keil'
|
data/lib/bake/util.rb
CHANGED
@@ -44,6 +44,7 @@ def integrateToolchain(tcs, toolchain)
|
|
44
44
|
|
45
45
|
tcs[:KEEP_FILE_ENDINGS] = @mainConfig.defaultToolchain.keepObjFileEndings
|
46
46
|
tcs[:OUTPUT_DIR] = toolchain.outputDir if toolchain.outputDir != ""
|
47
|
+
tcs[:OUTPUT_DIR_POSTFIX] = toolchain.outputDirPostfix if toolchain.outputDirPostfix != ""
|
47
48
|
integrateLinker(tcs, toolchain.linker) if toolchain.respond_to?"linker"
|
48
49
|
integrateArchiver(tcs, toolchain.archiver)
|
49
50
|
toolchain.compiler.each do |c|
|
@@ -25,6 +25,10 @@ module Bake
|
|
25
25
|
has_attr 'name', String, :defaultValueLiteral => ""
|
26
26
|
has_attr 'config', String, :defaultValueLiteral => ""
|
27
27
|
end
|
28
|
+
|
29
|
+
class ExcludeDir < ModelElement
|
30
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
31
|
+
end
|
28
32
|
class SubCollection < ModelElement
|
29
33
|
has_attr 'name', String, :defaultValueLiteral => ""
|
30
34
|
end
|
@@ -32,6 +36,7 @@ module Bake
|
|
32
36
|
has_attr 'name', String, :defaultValueLiteral => ""
|
33
37
|
contains_many 'project', Project, 'collection'
|
34
38
|
contains_many 'exclude', Exclude, 'collection'
|
39
|
+
contains_many 'exclude_dir', ExcludeDir, 'collection'
|
35
40
|
contains_many 'collections', SubCollection, 'collection'
|
36
41
|
end
|
37
42
|
|
data/lib/bakery/toBake.rb
CHANGED
@@ -67,11 +67,18 @@ module Bake
|
|
67
67
|
p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
|
68
68
|
end
|
69
69
|
|
70
|
+
col.exclude_dir.each do |e|
|
71
|
+
e.name = File.expand_path(e.name, @options.collection_dir)
|
72
|
+
end
|
73
|
+
|
70
74
|
toBuild.delete_if do |bp|
|
71
75
|
exclude = false
|
72
76
|
col.exclude.each do |p|
|
73
77
|
exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil)
|
74
78
|
end
|
79
|
+
col.exclude_dir.each do |e|
|
80
|
+
exclude = true if bp.proj.start_with?(e.name)
|
81
|
+
end
|
75
82
|
exclude
|
76
83
|
end
|
77
84
|
|
data/lib/blocks/block.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative '../bake/libElement'
|
|
2
2
|
require_relative '../bake/model/metamodel'
|
3
3
|
require_relative '../common/abortException'
|
4
4
|
require_relative "../multithread/job"
|
5
|
+
gem "thwait", "0.1.0"
|
5
6
|
require "thwait"
|
6
7
|
|
7
8
|
module Bake
|
@@ -597,6 +598,9 @@ module Bake
|
|
597
598
|
@output_dir = "build" + Bake.options.buildDirDelimiter + qacPart + @config.name + "_" + Bake.options.main_project_name + "_" + Bake.options.build_config
|
598
599
|
end
|
599
600
|
end
|
601
|
+
if @tcs[:OUTPUT_DIR_POSTFIX] != nil
|
602
|
+
@output_dir = @output_dir + @tcs[:OUTPUT_DIR_POSTFIX]
|
603
|
+
end
|
600
604
|
end
|
601
605
|
|
602
606
|
end
|
data/lib/blocks/compile.rb
CHANGED
@@ -37,7 +37,7 @@ begin
|
|
37
37
|
x = longname(shortname(file))
|
38
38
|
end
|
39
39
|
|
40
|
-
rescue
|
40
|
+
rescue Exception
|
41
41
|
|
42
42
|
def realname file
|
43
43
|
file
|
@@ -133,14 +133,18 @@ module Bake
|
|
133
133
|
return false
|
134
134
|
end
|
135
135
|
|
136
|
+
def calcObjectBasename(object)
|
137
|
+
object.chomp(File.extname(object))
|
138
|
+
end
|
139
|
+
|
136
140
|
def calcCmdlineFile(object)
|
137
|
-
File.expand_path(object
|
141
|
+
File.expand_path(calcObjectBasename(object) + ".cmdline", @projectDir)
|
138
142
|
end
|
139
143
|
|
140
144
|
def calcDepFile(object, type)
|
141
145
|
dep_filename = nil
|
142
146
|
if type != :ASM
|
143
|
-
dep_filename = object
|
147
|
+
dep_filename = calcObjectBasename(object) + ".d"
|
144
148
|
end
|
145
149
|
dep_filename
|
146
150
|
end
|
data/lib/blocks/library.rb
CHANGED
@@ -18,10 +18,13 @@ module Bake
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def calcArtifactName
|
21
|
+
archiver = @block.tcs[:ARCHIVER]
|
22
|
+
fileEnding = archiver[:ARCHIVE_FILE_ENDING]
|
23
|
+
|
21
24
|
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
22
25
|
baseFilename = @config.artifactName.name
|
23
26
|
else
|
24
|
-
baseFilename = "lib#{@projectName}
|
27
|
+
baseFilename = "lib#{@projectName}#{fileEnding}"
|
25
28
|
end
|
26
29
|
if !@config.artifactExtension.nil? && @config.artifactExtension.name != "default"
|
27
30
|
extension = ".#{@config.artifactExtension.name}"
|
data/lib/blocks/makefile.rb
CHANGED
@@ -17,14 +17,16 @@ module Bake
|
|
17
17
|
@projectDir = config.get_project_dir
|
18
18
|
@path_to = ""
|
19
19
|
@flags = adjustFlags("",config.flags) if config.flags
|
20
|
-
@makefile = config.name
|
20
|
+
@makefile = block.convPath(config.name)
|
21
21
|
@target = config.target != "" ? config.target : "all"
|
22
22
|
calcPathTo(referencedConfigs)
|
23
23
|
calcCommandLine
|
24
24
|
calcCleanLine
|
25
25
|
calcEnv
|
26
26
|
|
27
|
-
|
27
|
+
if config.lib != ""
|
28
|
+
block.lib_elements << LibElement.new(LibElement::LIB_WITH_PATH, block.convPath(config.lib))
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def calcEnv
|
data/lib/common/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Bake
|
2
2
|
class Version
|
3
3
|
def self.number
|
4
|
-
"2.
|
4
|
+
"2.67.0"
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.printBakeVersion(ry = "")
|
@@ -29,26 +29,22 @@ module Bake
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
begin
|
49
|
-
gem "concurrent-ruby", "=#{expectedConcurrent}"
|
50
|
-
rescue Exception => e
|
51
|
-
puts "Warning: Failed to load concurrent-ruby #{expectedConcurrent}, using latest version"
|
32
|
+
deps = [
|
33
|
+
["rgen", "0.8.2"],
|
34
|
+
["rtext", "0.9.0"],
|
35
|
+
["concurrent-ruby", "1.0.5"],
|
36
|
+
["highline", "1.7.8"],
|
37
|
+
["colored", "1.2"],
|
38
|
+
["thwait", "0.1.0"],
|
39
|
+
["e2mmap", "0.1.0"]]
|
40
|
+
|
41
|
+
deps.each do |d|
|
42
|
+
begin
|
43
|
+
gem d[0], "=#{d[1]}"
|
44
|
+
rescue Exception => e
|
45
|
+
puts "Error: Failed to load gem #{d[0]} #{d[1]}, please reinstall bake-toolkit."
|
46
|
+
exit -1
|
47
|
+
end
|
52
48
|
end
|
53
49
|
|
54
50
|
end
|
data/lib/tocxx.rb
CHANGED
@@ -859,6 +859,7 @@ module Bake
|
|
859
859
|
!Bake.options.linkOnly &&
|
860
860
|
!Bake.options.prepro &&
|
861
861
|
!Bake.options.compileOnly &&
|
862
|
+
!Bake.options.dry &&
|
862
863
|
!Bake.options.clean
|
863
864
|
|
864
865
|
ccChecks = []
|
@@ -893,10 +894,13 @@ module Bake
|
|
893
894
|
o = b.object_files[s]
|
894
895
|
dep_filename = b.calcDepFile(o, type)
|
895
896
|
dep_filename_conv = b.calcDepFileConv(dep_filename)
|
896
|
-
File.
|
897
|
-
|
898
|
-
|
899
|
-
|
897
|
+
fname = File.expand_path(dep_filename_conv, b.projectDir)
|
898
|
+
if File.exist?(fname)
|
899
|
+
File.readlines(fname).map{|line| line.strip}.each do |dep|
|
900
|
+
header = File.expand_path(dep, b.projectDir)
|
901
|
+
if File.exist?(header)
|
902
|
+
inCompilation << header
|
903
|
+
end
|
900
904
|
end
|
901
905
|
end
|
902
906
|
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.
|
4
|
+
version: 2.67.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:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|
@@ -84,86 +84,72 @@ dependencies:
|
|
84
84
|
name: thwait
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.1.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: e2mmap
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.1.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 12.3.3
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
108
|
+
- - '='
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
110
|
+
version: 0.1.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: rspec
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - '='
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
117
|
+
version: 3.10.0
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- -
|
122
|
+
- - '='
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
124
|
+
version: 3.10.0
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: simplecov
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- -
|
129
|
+
- - '='
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
131
|
+
version: 0.16.1
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- -
|
136
|
+
- - '='
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
138
|
+
version: 0.16.1
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: coveralls
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- -
|
143
|
+
- - '='
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
145
|
+
version: 0.8.23
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- -
|
150
|
+
- - '='
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
152
|
+
version: 0.8.23
|
167
153
|
description: See documentation for more details
|
168
154
|
email: alexander.schaal@esrlabs.com
|
169
155
|
executables:
|
@@ -204,6 +190,7 @@ files:
|
|
204
190
|
- lib/bake/subst.rb
|
205
191
|
- lib/bake/toolchain/clang.rb
|
206
192
|
- lib/bake/toolchain/clang_analyze.rb
|
193
|
+
- lib/bake/toolchain/clang_bitcode.rb
|
207
194
|
- lib/bake/toolchain/colorizing_formatter.rb
|
208
195
|
- lib/bake/toolchain/diab.rb
|
209
196
|
- lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb
|
@@ -278,7 +265,7 @@ files:
|
|
278
265
|
- lib/rtext-service/options/options.rb
|
279
266
|
- lib/tocxx.rb
|
280
267
|
- license.txt
|
281
|
-
homepage:
|
268
|
+
homepage: https://github.com/esrlabs/bake
|
282
269
|
licenses:
|
283
270
|
- MIT
|
284
271
|
metadata: {}
|
@@ -299,8 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
286
|
- !ruby/object:Gem::Version
|
300
287
|
version: '0'
|
301
288
|
requirements: []
|
302
|
-
|
303
|
-
rubygems_version: 2.7.7
|
289
|
+
rubygems_version: 3.1.4
|
304
290
|
signing_key:
|
305
291
|
specification_version: 4
|
306
292
|
summary: Build tool to compile C/C++ projects fast and easy.
|