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
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
|
@@ -374,8 +388,14 @@ module Bake
|
|
374
388
|
return if Metamodel::DefaultToolchain === elem
|
375
389
|
return if Metamodel::Toolchain === elem.class
|
376
390
|
next if a.eType.name != "EString"
|
377
|
-
|
378
|
-
|
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
|
379
399
|
end
|
380
400
|
|
381
401
|
childsRefs = elem.class.ecore.eAllReferences.select{|r| r.containment}
|
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|
|
data/lib/bakery/buildPattern.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Bake
|
2
2
|
|
3
3
|
class BuildPattern
|
4
|
-
attr_reader :proj, :conf, :args, :coll_p
|
5
|
-
def initialize(proj, conf, args, coll_p)
|
4
|
+
attr_reader :proj, :conf, :args, :args_end, :coll_p
|
5
|
+
def initialize(proj, conf, args, args_end, coll_p)
|
6
6
|
@proj = proj
|
7
7
|
@conf = conf
|
8
8
|
@args = args
|
9
|
+
@args_end = args_end
|
9
10
|
@coll_p = coll_p
|
10
11
|
end
|
11
12
|
def getId
|
@@ -20,11 +20,16 @@ module Bake
|
|
20
20
|
has_attr 'name', String, :defaultValueLiteral => ""
|
21
21
|
has_attr 'config', String, :defaultValueLiteral => ""
|
22
22
|
has_attr 'args', String, :defaultValueLiteral => ""
|
23
|
+
has_attr 'args_end', String, :defaultValueLiteral => ""
|
23
24
|
end
|
24
25
|
class Exclude < ModelElement
|
25
26
|
has_attr 'name', String, :defaultValueLiteral => ""
|
26
27
|
has_attr 'config', String, :defaultValueLiteral => ""
|
27
28
|
end
|
29
|
+
|
30
|
+
class ExcludeDir < ModelElement
|
31
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
32
|
+
end
|
28
33
|
class SubCollection < ModelElement
|
29
34
|
has_attr 'name', String, :defaultValueLiteral => ""
|
30
35
|
end
|
@@ -32,6 +37,7 @@ module Bake
|
|
32
37
|
has_attr 'name', String, :defaultValueLiteral => ""
|
33
38
|
contains_many 'project', Project, 'collection'
|
34
39
|
contains_many 'exclude', Exclude, 'collection'
|
40
|
+
contains_many 'exclude_dir', ExcludeDir, 'collection'
|
35
41
|
contains_many 'collections', SubCollection, 'collection'
|
36
42
|
end
|
37
43
|
|
data/lib/bakery/toBake.rb
CHANGED
@@ -30,7 +30,7 @@ module Bake
|
|
30
30
|
toBuildPattern = []
|
31
31
|
@options.roots.each do |root|
|
32
32
|
col.project.each do |p|
|
33
|
-
projs = Root.search_to_depth(root.dir,p.name + "/Project.meta", root.depth)
|
33
|
+
projs = Root.search_to_depth(root.dir,p.name + "/Project.meta", root.depth).map { |p| Pathname.new(p).cleanpath.to_s }
|
34
34
|
if File.basename(root.dir) == p.name && File.exist?(root.dir + "/Project.meta")
|
35
35
|
projs << root.dir + "/Project.meta"
|
36
36
|
end
|
@@ -38,7 +38,7 @@ module Bake
|
|
38
38
|
Bake.formatter.printWarning("pattern does not match any project: #{p.name}", p)
|
39
39
|
end
|
40
40
|
projs.each do |f|
|
41
|
-
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p.args, p)
|
41
|
+
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p.args, p.args_end, p)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -51,7 +51,7 @@ module Bake
|
|
51
51
|
res = c.gsub(/#.*/,"").match("\\s*(Library|Executable|Custom){1}Config\\s*\"?([\\w:-]*)\"?")
|
52
52
|
if res
|
53
53
|
if res[2].match(bp.conf) != nil
|
54
|
-
toBuild << BuildPattern.new(bp.proj, res[2], bp.args, nil)
|
54
|
+
toBuild << BuildPattern.new(bp.proj, res[2], bp.args, bp.args_end, nil)
|
55
55
|
bp.coll_p.found
|
56
56
|
end
|
57
57
|
end
|
@@ -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
@@ -598,6 +598,12 @@ module Bake
|
|
598
598
|
@output_dir = "build" + Bake.options.buildDirDelimiter + qacPart + @config.name + "_" + Bake.options.main_project_name + "_" + Bake.options.build_config
|
599
599
|
end
|
600
600
|
end
|
601
|
+
if @tcs[:OUTPUT_DIR_POSTFIX] != nil
|
602
|
+
@output_dir = @output_dir + @tcs[:OUTPUT_DIR_POSTFIX]
|
603
|
+
end
|
604
|
+
if Bake.options.consoleOutput_fullnames
|
605
|
+
@output_dir = File.expand_path(@output_dir, @projectDir)
|
606
|
+
end
|
601
607
|
end
|
602
608
|
|
603
609
|
end
|
data/lib/blocks/commandLine.rb
CHANGED
@@ -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
|
data/lib/blocks/compile.rb
CHANGED
@@ -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!("\"" , "\\\"")
|
@@ -375,7 +375,7 @@ module Bake
|
|
375
375
|
deps_string = File.read(dep_filename)
|
376
376
|
deps_string = deps_string.gsub(/\\\n/,'')
|
377
377
|
dep_splitted = deps_string.split(/([^\\]) /).each_slice(2).map(&:join)[2..-1]
|
378
|
-
deps = dep_splitted.map { |d| d.gsub(/[\\] /,' ').gsub(/[\\]/,'/').strip }.delete_if {|d| d == "" }
|
378
|
+
deps = dep_splitted.map { |d| d.gsub(/[\\] /,' ').gsub(/\\:\\/,':\\').gsub(/[\\]/,'/').strip }.delete_if {|d| d == "" }
|
379
379
|
elsif lineType == :plain
|
380
380
|
firstLine = true
|
381
381
|
File.readlines(dep_filename).each do |line|
|
@@ -524,10 +524,16 @@ module Bake
|
|
524
524
|
|
525
525
|
def calcObjects
|
526
526
|
@object_files_ignored_in_lib = []
|
527
|
-
@source_files.
|
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
|
-
|
640
|
-
|
641
|
-
|
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
|
|
data/lib/blocks/executable.rb
CHANGED
@@ -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()
|
data/lib/blocks/fileutil.rb
CHANGED
@@ -11,6 +11,13 @@ module Bake
|
|
11
11
|
@type = type
|
12
12
|
@projectDir = projectDir
|
13
13
|
@echo = (config.echo != "off")
|
14
|
+
if !@arg1 || @arg1.empty?
|
15
|
+
Bake.formatter.printError("Error: source of file-step must not be empty")
|
16
|
+
ExitHelper.exit(1)
|
17
|
+
elsif [:copy, :move].include?(@type) && (!@arg2 || @arg2.empty?)
|
18
|
+
Bake.formatter.printError("Error: target of file-step must not be empty")
|
19
|
+
ExitHelper.exit(1)
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
def run
|
@@ -20,13 +27,13 @@ module Bake
|
|
20
27
|
FileUtils.touch(@arg1)
|
21
28
|
elsif @type == :move
|
22
29
|
puts "Moving #{@arg1} to #{@arg2}" if @echo
|
23
|
-
FileUtils.mv(
|
30
|
+
Dir.glob(@arg1).each {|f| FileUtils.mv(f, @arg2)}
|
24
31
|
elsif @type == :copy
|
25
32
|
puts "Copying #{@arg1} to #{@arg2}" if @echo
|
26
|
-
FileUtils.cp_r(
|
33
|
+
Dir.glob(@arg1).each {|f| FileUtils.cp_r(f, @arg2)}
|
27
34
|
elsif @type == :remove
|
28
35
|
puts "Removing #{@arg1}" if @echo
|
29
|
-
|
36
|
+
Dir.glob(@arg1).each {|f| FileUtils.rm_rf(f)}
|
30
37
|
elsif @type == :makedir
|
31
38
|
puts "Making #{@arg1}" if @echo
|
32
39
|
FileUtils.mkdir_p(@arg1)
|
data/lib/blocks/library.rb
CHANGED
@@ -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()
|
data/lib/common/root.rb
CHANGED
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.70.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
|