bake-toolkit 2.42.3 → 2.43.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/lib/bake/config/checks.rb +10 -0
- data/lib/bake/model/language.rb +47 -45
- data/lib/bake/model/metamodel.rb +6 -0
- data/lib/bake/toolchain/provider.rb +2 -1
- data/lib/bake/util.rb +123 -119
- data/lib/blocks/block.rb +1 -3
- data/lib/blocks/compile.rb +2 -1
- data/lib/blocks/library.rb +15 -2
- data/lib/common/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979457d55561c9d98081d4a922d1af5cbcc4e1d9
|
4
|
+
data.tar.gz: 63ce64c5b31fe8ba2ebba2ee8ae4d28858ed8e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76371243a25ea2d8d703c775996d76fbb635f0a4b7326ac23087db2e3db4fc1f2b3e4d672b6b905d37485a8efbbdf54faf13663bb1386cd81abc25712fa0275e
|
7
|
+
data.tar.gz: 04e358efa264dc5f433f919b9a9231040d61ad85ce7e3794a4c2bc82ef93e35f375a1231d9689ce44060c3004b69815a892735e5d7bf32a1b0fa3839acd42a2a
|
data/lib/bake/config/checks.rb
CHANGED
@@ -34,6 +34,10 @@ module Bake
|
|
34
34
|
Bake.formatter.printError("InternalDefines only allowed in DefaultToolchain", c.internalDefines)
|
35
35
|
ExitHelper.exit(1)
|
36
36
|
end
|
37
|
+
if c.fileEndings && c.fileEndings.endings.empty?
|
38
|
+
Bake.formatter.printError("FileEnding must not be empty.", c.fileEndings)
|
39
|
+
ExitHelper.exit(1)
|
40
|
+
end
|
37
41
|
end
|
38
42
|
config.toolchain.lintPolicy.each do |l|
|
39
43
|
Bake.formatter.printWarning("Lint support was removed. Please delete LintPolicy from Project.meta.", l)
|
@@ -43,6 +47,12 @@ module Bake
|
|
43
47
|
config.defaultToolchain.lintPolicy.each do |l|
|
44
48
|
Bake.formatter.printWarning("Lint support was removed. Please delete LintPolicy from Project.meta.", l)
|
45
49
|
end
|
50
|
+
config.defaultToolchain.compiler.each do |c|
|
51
|
+
if c.fileEndings && c.fileEndings.endings.empty?
|
52
|
+
Bake.formatter.printError("FileEnding must not be empty.", c.fileEndings)
|
53
|
+
ExitHelper.exit(1)
|
54
|
+
end
|
55
|
+
end
|
46
56
|
end
|
47
57
|
|
48
58
|
config.includeDir.each do |inc|
|
data/lib/bake/model/language.rb
CHANGED
@@ -1,45 +1,47 @@
|
|
1
|
-
require 'bake/model/metamodel'
|
2
|
-
|
3
|
-
require 'rtext/language'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
module Bake
|
8
|
-
|
9
|
-
class Idp
|
10
|
-
def call(e,notUsed1,notUsed2,notUsed3)
|
11
|
-
e.respond_to?(:ident) ? e.ident() : nil
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
Language =
|
17
|
-
RText::Language.new(Metamodel.ecore,
|
18
|
-
:feature_provider => proc {|c|
|
19
|
-
RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
|
20
|
-
f.eAnnotations.any? {|a|
|
21
|
-
a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
},
|
25
|
-
:unlabled_arguments => proc {|c|
|
26
|
-
if c.name == "Compiler" or c.name == "CompilerAdaptions"
|
27
|
-
["ctype"]
|
28
|
-
elsif c.name == "Define"
|
29
|
-
["str"]
|
30
|
-
elsif c.name == "Flags" or c.name == "LibPostfixFlags" or c.name == "LibPrefixFlags"
|
31
|
-
["overwrite"]
|
32
|
-
elsif c.name == "DefaultToolchain"
|
33
|
-
["basedOn"]
|
34
|
-
elsif c.name == "Description"
|
35
|
-
["text"]
|
36
|
-
|
37
|
-
["
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
:
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
require 'bake/model/metamodel'
|
2
|
+
|
3
|
+
require 'rtext/language'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
module Bake
|
8
|
+
|
9
|
+
class Idp
|
10
|
+
def call(e,notUsed1,notUsed2,notUsed3)
|
11
|
+
e.respond_to?(:ident) ? e.ident() : nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
Language =
|
17
|
+
RText::Language.new(Metamodel.ecore,
|
18
|
+
:feature_provider => proc {|c|
|
19
|
+
RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
|
20
|
+
f.eAnnotations.any? {|a|
|
21
|
+
a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
},
|
25
|
+
:unlabled_arguments => proc {|c|
|
26
|
+
if c.name == "Compiler" or c.name == "CompilerAdaptions"
|
27
|
+
["ctype"]
|
28
|
+
elsif c.name == "Define"
|
29
|
+
["str"]
|
30
|
+
elsif c.name == "Flags" or c.name == "LibPostfixFlags" or c.name == "LibPrefixFlags"
|
31
|
+
["overwrite"]
|
32
|
+
elsif c.name == "DefaultToolchain"
|
33
|
+
["basedOn"]
|
34
|
+
elsif c.name == "Description"
|
35
|
+
["text"]
|
36
|
+
elsif c.name == "SrcFileEndings"
|
37
|
+
["endings"]
|
38
|
+
else
|
39
|
+
["name"]
|
40
|
+
end
|
41
|
+
},
|
42
|
+
:identifier_provider => Idp.new,
|
43
|
+
:line_number_attribute => "line_number",
|
44
|
+
:fragment_ref_attribute => "fragment_ref"
|
45
|
+
)
|
46
|
+
|
47
|
+
end
|
data/lib/bake/model/metamodel.rb
CHANGED
@@ -49,6 +49,10 @@ module Bake
|
|
49
49
|
has_attr 'str', String, :defaultValueLiteral => ""
|
50
50
|
end
|
51
51
|
|
52
|
+
class SrcFileEndings < ModelElement
|
53
|
+
has_attr 'endings', String, :defaultValueLiteral => ""
|
54
|
+
end
|
55
|
+
|
52
56
|
class InternalIncludes < ModelElement
|
53
57
|
has_attr 'name', String, :defaultValueLiteral => ""
|
54
58
|
end
|
@@ -79,6 +83,7 @@ module Bake
|
|
79
83
|
contains_many 'define', Define, 'parent'
|
80
84
|
contains_many 'flags', Flags, 'parent'
|
81
85
|
contains_one 'internalDefines', InternalDefines, 'parent'
|
86
|
+
contains_one 'fileEndings', SrcFileEndings, 'parent'
|
82
87
|
end
|
83
88
|
|
84
89
|
class LintPolicy < ModelElement
|
@@ -93,6 +98,7 @@ module Bake
|
|
93
98
|
has_attr 'basedOn', String, :defaultValueLiteral => ""
|
94
99
|
has_attr 'outputDir', String, :defaultValueLiteral => ""
|
95
100
|
has_attr 'eclipseOrder', Boolean, :defaultValueLiteral => "false"
|
101
|
+
has_attr 'keepObjFileEndings', Boolean, :defaultValueLiteral => "false"
|
96
102
|
contains_many 'compiler', Compiler, 'parent'
|
97
103
|
contains_one 'archiver', Archiver, 'parent'
|
98
104
|
contains_one 'linker', Linker, 'parent'
|
data/lib/bake/util.rb
CHANGED
@@ -1,119 +1,123 @@
|
|
1
|
-
require 'bake/model/metamodel_ext'
|
2
|
-
require 'bake/model/metamodel'
|
3
|
-
require 'set'
|
4
|
-
require 'bake/toolchain/colorizing_formatter'
|
5
|
-
require 'common/exit_helper'
|
6
|
-
require 'common/utils'
|
7
|
-
|
8
|
-
|
9
|
-
def remove_empty_strings_and_join(a, j=' ')
|
10
|
-
return a.reject{|e|e.to_s.empty?}.join(j)
|
11
|
-
end
|
12
|
-
|
13
|
-
def adjustFlags(orgStr, flags)
|
14
|
-
orgSplitted = Bake::Utils::flagSplit(orgStr, false)
|
15
|
-
|
16
|
-
flags.each do |f|
|
17
|
-
if f.overwrite != ""
|
18
|
-
orgSplitted = Bake::Utils::flagSplit(f.overwrite, false)
|
19
|
-
end
|
20
|
-
|
21
|
-
if f.remove != ""
|
22
|
-
rmSplitted = Bake::Utils::flagSplit(f.remove, false)
|
23
|
-
orgSplitted.delete_if {|o| rmSplitted.any? { |r|
|
24
|
-
begin
|
25
|
-
o.match("\\A"+r+"\\Z")
|
26
|
-
rescue Exception => e
|
27
|
-
Bake.formatter.printError(e.message, f)
|
28
|
-
Bake::ExitHelper.exit(1)
|
29
|
-
end
|
30
|
-
}}
|
31
|
-
end
|
32
|
-
|
33
|
-
if f.add != ""
|
34
|
-
Bake::Utils::flagSplit(f.add, false).each do |a|
|
35
|
-
orgSplitted << a unless orgSplitted.any? { |o| o==a }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
orgSplitted.join(" ")
|
42
|
-
end
|
43
|
-
|
44
|
-
def integrateToolchain(tcs, toolchain)
|
45
|
-
return tcs unless toolchain
|
46
|
-
|
47
|
-
tcs[:
|
48
|
-
|
49
|
-
|
50
|
-
toolchain.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
tcs
|
63
|
-
tcs[:LINKER][:
|
64
|
-
tcs[:LINKER][:
|
65
|
-
tcs[:LINKER][:
|
66
|
-
tcs[:LINKER][:
|
67
|
-
tcs[:LINKER][:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
tcs
|
73
|
-
tcs[:ARCHIVER][:
|
74
|
-
tcs[:ARCHIVER][:
|
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
|
-
|
106
|
-
#
|
107
|
-
#
|
108
|
-
|
109
|
-
|
110
|
-
#
|
111
|
-
#
|
112
|
-
name.gsub!
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
1
|
+
require 'bake/model/metamodel_ext'
|
2
|
+
require 'bake/model/metamodel'
|
3
|
+
require 'set'
|
4
|
+
require 'bake/toolchain/colorizing_formatter'
|
5
|
+
require 'common/exit_helper'
|
6
|
+
require 'common/utils'
|
7
|
+
|
8
|
+
|
9
|
+
def remove_empty_strings_and_join(a, j=' ')
|
10
|
+
return a.reject{|e|e.to_s.empty?}.join(j)
|
11
|
+
end
|
12
|
+
|
13
|
+
def adjustFlags(orgStr, flags)
|
14
|
+
orgSplitted = Bake::Utils::flagSplit(orgStr, false)
|
15
|
+
|
16
|
+
flags.each do |f|
|
17
|
+
if f.overwrite != ""
|
18
|
+
orgSplitted = Bake::Utils::flagSplit(f.overwrite, false)
|
19
|
+
end
|
20
|
+
|
21
|
+
if f.remove != ""
|
22
|
+
rmSplitted = Bake::Utils::flagSplit(f.remove, false)
|
23
|
+
orgSplitted.delete_if {|o| rmSplitted.any? { |r|
|
24
|
+
begin
|
25
|
+
o.match("\\A"+r+"\\Z")
|
26
|
+
rescue Exception => e
|
27
|
+
Bake.formatter.printError(e.message, f)
|
28
|
+
Bake::ExitHelper.exit(1)
|
29
|
+
end
|
30
|
+
}}
|
31
|
+
end
|
32
|
+
|
33
|
+
if f.add != ""
|
34
|
+
Bake::Utils::flagSplit(f.add, false).each do |a|
|
35
|
+
orgSplitted << a unless orgSplitted.any? { |o| o==a }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
orgSplitted.join(" ")
|
42
|
+
end
|
43
|
+
|
44
|
+
def integrateToolchain(tcs, toolchain)
|
45
|
+
return tcs unless toolchain
|
46
|
+
|
47
|
+
tcs[:KEEP_FILE_ENDINGS] = @mainConfig.defaultToolchain.keepObjFileEndings
|
48
|
+
tcs[:OUTPUT_DIR] = toolchain.outputDir if toolchain.outputDir != ""
|
49
|
+
integrateLinker(tcs, toolchain.linker) if toolchain.respond_to?"linker"
|
50
|
+
integrateArchiver(tcs, toolchain.archiver)
|
51
|
+
toolchain.compiler.each do |c|
|
52
|
+
integrateCompiler(tcs, c, c.ctype)
|
53
|
+
end
|
54
|
+
integrateDocu(tcs, toolchain.docu) if toolchain.docu
|
55
|
+
end
|
56
|
+
|
57
|
+
def integrateDocu(tcs, docu)
|
58
|
+
tcs[:DOCU] = docu.name if docu.name != ""
|
59
|
+
end
|
60
|
+
|
61
|
+
def integrateLinker(tcs, linker)
|
62
|
+
return tcs unless linker
|
63
|
+
tcs[:LINKER][:COMMAND] = linker.command if linker.command != ""
|
64
|
+
tcs[:LINKER][:LINK_ONLY_DIRECT_DEPS] = linker.onlyDirectDeps
|
65
|
+
tcs[:LINKER][:PREFIX] = linker.prefix if linker.prefix != ""
|
66
|
+
tcs[:LINKER][:FLAGS] = adjustFlags(tcs[:LINKER][:FLAGS], linker.flags)
|
67
|
+
tcs[:LINKER][:LIB_PREFIX_FLAGS] = adjustFlags(tcs[:LINKER][:LIB_PREFIX_FLAGS], linker.libprefixflags)
|
68
|
+
tcs[:LINKER][:LIB_POSTFIX_FLAGS] = adjustFlags(tcs[:LINKER][:LIB_POSTFIX_FLAGS], linker.libpostfixflags)
|
69
|
+
end
|
70
|
+
|
71
|
+
def integrateArchiver(tcs, archiver)
|
72
|
+
return tcs unless archiver
|
73
|
+
tcs[:ARCHIVER][:COMMAND] = archiver.command if archiver.command != ""
|
74
|
+
tcs[:ARCHIVER][:PREFIX] = archiver.prefix if archiver.prefix != ""
|
75
|
+
tcs[:ARCHIVER][:FLAGS] = adjustFlags(tcs[:ARCHIVER][:FLAGS], archiver.flags)
|
76
|
+
end
|
77
|
+
|
78
|
+
def integrateCompiler(tcs, compiler, type)
|
79
|
+
return tcs unless compiler
|
80
|
+
if compiler.respond_to?"command"
|
81
|
+
tcs[:COMPILER][type][:COMMAND] = compiler.command if compiler.command != ""
|
82
|
+
end
|
83
|
+
if compiler.respond_to?"prefix"
|
84
|
+
tcs[:COMPILER][type][:PREFIX] = compiler.prefix if compiler.prefix != ""
|
85
|
+
end
|
86
|
+
if compiler.fileEndings
|
87
|
+
tcs[:COMPILER][type][:SOURCE_FILE_ENDINGS] = compiler.fileEndings.endings.split(",").map{|e| e.strip}
|
88
|
+
end
|
89
|
+
|
90
|
+
tcs[:COMPILER][type][:FLAGS] = adjustFlags(tcs[:COMPILER][type][:FLAGS], compiler.flags)
|
91
|
+
compiler.define.each do |d|
|
92
|
+
tcs[:COMPILER][type][:DEFINES] << d.str unless tcs[:COMPILER][type][:DEFINES].include? d.str
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def integrateCompilerFile(tcs, compiler)
|
97
|
+
[:CPP, :C, :ASM].each do |t|
|
98
|
+
integrateCompiler(tcs, compiler, t)
|
99
|
+
end
|
100
|
+
return tcs
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def sanitize_filename(filename)
|
105
|
+
filename.strip do |name|
|
106
|
+
# NOTE: File.basename doesn't work right with Windows paths on Unix
|
107
|
+
# get only the filename, not the whole path
|
108
|
+
name.gsub! /^.*(\\|\/)/, ''
|
109
|
+
|
110
|
+
# Finally, replace all non alphanumeric, underscore
|
111
|
+
# or periods with underscore
|
112
|
+
# name.gsub! /[^\w\.\-]/, '_'
|
113
|
+
# Basically strip out the non-ascii alphabets too
|
114
|
+
# and replace with x.
|
115
|
+
# You don't want all _ :)
|
116
|
+
name.gsub!(/[^0-9A-Za-z.\-]/, 'x')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def add_line_if_no_comment(array, str)
|
121
|
+
s = str.split("#")[0].strip
|
122
|
+
array << s unless s.empty?
|
123
|
+
end
|
data/lib/blocks/block.rb
CHANGED
@@ -359,7 +359,6 @@ module Bake
|
|
359
359
|
# todo: sync output if commandline and makefile!!!!!!!!!!!!!!!!!!!
|
360
360
|
@outputStep = nil
|
361
361
|
allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
|
362
|
-
|
363
362
|
while !allSteps.empty?
|
364
363
|
parallel = []
|
365
364
|
while allSteps.first && independent?(method, allSteps.first)
|
@@ -410,7 +409,7 @@ module Bake
|
|
410
409
|
@inDeps = true
|
411
410
|
depResult = callDeps(:execute)
|
412
411
|
@inDeps = false
|
413
|
-
return @result if blockAbort?(depResult)
|
412
|
+
return @result && depResult if blockAbort?(depResult)
|
414
413
|
|
415
414
|
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
416
415
|
|
@@ -448,7 +447,6 @@ module Bake
|
|
448
447
|
end
|
449
448
|
end
|
450
449
|
|
451
|
-
|
452
450
|
return (depResult && @result)# && @@delayed_result)
|
453
451
|
end
|
454
452
|
|
data/lib/blocks/compile.rb
CHANGED
@@ -34,7 +34,8 @@ module Bake
|
|
34
34
|
def get_object_file(source)
|
35
35
|
# until now all OBJECT_FILE_ENDING are equal in all three types
|
36
36
|
|
37
|
-
|
37
|
+
sourceEndingAdapted = @block.tcs[:KEEP_FILE_ENDINGS] ? source : source.chomp(File.extname(source))
|
38
|
+
srcWithoutDotDot = sourceEndingAdapted.gsub(/\.\./, "__")
|
38
39
|
if srcWithoutDotDot[0] == '/'
|
39
40
|
srcWithoutDotDot = "_" + srcWithoutDotDot
|
40
41
|
elsif srcWithoutDotDot[1] == ':'
|
data/lib/blocks/library.rb
CHANGED
@@ -65,7 +65,13 @@ module Bake
|
|
65
65
|
return true
|
66
66
|
end
|
67
67
|
else
|
68
|
-
|
68
|
+
|
69
|
+
@objects = []
|
70
|
+
[:CPP, :C, :ASM].map do |t|
|
71
|
+
@block.tcs[:COMPILER][t][:OBJECT_FILE_ENDING]
|
72
|
+
end.uniq.each do |e|
|
73
|
+
@objects << Dir.glob_dir("#{@block.output_dir}/**/*#{e}", @projectDir)
|
74
|
+
end
|
69
75
|
if @objects.empty?
|
70
76
|
if !File.exists?(File.expand_path(@archive_name, @projectDir))
|
71
77
|
SyncOut.mutex.synchronize do
|
@@ -130,7 +136,14 @@ module Bake
|
|
130
136
|
def clean
|
131
137
|
if @block.prebuild
|
132
138
|
Dir.chdir(@projectDir) do
|
133
|
-
|
139
|
+
|
140
|
+
@objects = []
|
141
|
+
[:CPP, :C, :ASM].map do |t|
|
142
|
+
@block.tcs[:COMPILER][t][:OBJECT_FILE_ENDING]
|
143
|
+
end.uniq.each do |e|
|
144
|
+
@objects << Dir.glob_dir("#{@block.output_dir}/**/*#{e}", @projectDir)
|
145
|
+
end
|
146
|
+
|
134
147
|
if !@objects.empty? && File.exist?(@archive_name)
|
135
148
|
puts "Deleting file #{@archive_name}" if Bake.options.verbose >= 2
|
136
149
|
if !Bake.options.dry
|
data/lib/common/version.rb
CHANGED
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.43.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: 2018-
|
11
|
+
date: 2018-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|