bake-toolkit 2.60.2 → 2.63.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bakery +25 -0
- data/lib/adapt/config/loader.rb +1 -0
- data/lib/bake/cache.rb +10 -4
- data/lib/bake/config/checks.rb +31 -0
- data/lib/bake/config/loader.rb +22 -18
- data/lib/bake/libElement.rb +13 -0
- data/lib/bake/model/loader.rb +1 -0
- data/lib/bake/model/metamodel.rb +6 -0
- data/lib/bake/options/options.rb +32 -17
- data/lib/bake/subst.rb +2 -0
- data/lib/bakery/model/loader.rb +1 -0
- data/lib/bakery/options/options.rb +8 -4
- data/lib/bakery/toBake.rb +5 -1
- data/lib/blocks/block.rb +45 -14
- data/lib/blocks/blockBase.rb +0 -1
- data/lib/blocks/compile.rb +25 -12
- data/lib/blocks/executable.rb +4 -0
- data/lib/common/cleanup.rb +3 -1
- data/lib/common/ext/file.rb +1 -1
- data/lib/common/ext/rgen.rb +23 -0
- data/lib/common/options/parser.rb +2 -2
- data/lib/common/root.rb +1 -1
- data/lib/common/utils.rb +14 -4
- data/lib/common/version.rb +1 -1
- data/lib/tocxx.rb +47 -3
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 007d1495eeb33f601eb10747f21cae6b0c478041092799bcfd284ab8cdce7253
|
4
|
+
data.tar.gz: cabe15ec22fe017a9946b4287cc8321b5df6fd14b64dac6c0fa0b6f11c88f58a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec0beb0df1b8a9f191faba73671da192424f04714af16b80f047dac259808a778ac822a9f790ffcd679d86579a9100e1fc3325bc83b19a8d40b2b3c30ec6b769
|
7
|
+
data.tar.gz: 2c75dc962078394be1033cd484834b90e4fd326c83a103b8fdb780d827f8f6a78f1689d2e383bc09d6e3aee0e1c0cf2d91a5fafad868eca6e7ad8f660eb09259
|
data/bin/bakery
CHANGED
@@ -24,6 +24,8 @@ require_relative "../lib/bakery/buildPattern"
|
|
24
24
|
require_relative '../lib/common/ext/stdout'
|
25
25
|
require_relative '../lib/common/cleanup'
|
26
26
|
|
27
|
+
require 'json'
|
28
|
+
|
27
29
|
module Bake
|
28
30
|
|
29
31
|
@options = BakeryOptions.new(ARGV)
|
@@ -104,6 +106,7 @@ module Bake
|
|
104
106
|
|
105
107
|
exitValue = 0
|
106
108
|
abort = false
|
109
|
+
@ideps = {}
|
107
110
|
@toBuild.each do |bp|
|
108
111
|
currentRun += 1
|
109
112
|
p = File.dirname(bp.proj)
|
@@ -135,6 +138,12 @@ module Bake
|
|
135
138
|
puts e.message
|
136
139
|
end
|
137
140
|
|
141
|
+
if Bake.options.dev_features.detect { |x| x.start_with?("dep-overview=") }
|
142
|
+
Bake::ToCxx.include_deps.each do |pdir, deps|
|
143
|
+
@ideps[pdir] = Set.new if !@ideps.has_key?(pdir)
|
144
|
+
@ideps[pdir].merge(deps)
|
145
|
+
end
|
146
|
+
end
|
138
147
|
Bake::cleanup
|
139
148
|
ExitHelper.reset_exit_code
|
140
149
|
|
@@ -148,6 +157,22 @@ module Bake
|
|
148
157
|
end
|
149
158
|
end
|
150
159
|
end
|
160
|
+
|
161
|
+
dep_json = Bake.options.dev_features.detect { |x| x.start_with?("dep-overview=") }
|
162
|
+
if dep_json
|
163
|
+
# remove duplicates
|
164
|
+
@ideps.each do |m,d|
|
165
|
+
d.delete_if {|d_tbc| d_tbc.start_with?(m) }
|
166
|
+
d.delete_if {|d_tbc| d.any? {|any_d| d_tbc != any_d && d_tbc.start_with?(any_d + "/") } }
|
167
|
+
end
|
168
|
+
# generate format for output
|
169
|
+
ideps = []
|
170
|
+
@ideps.each do |m,d|
|
171
|
+
ideps << {"module" => m, "dependencies" => d.sort.to_a}
|
172
|
+
end
|
173
|
+
# output
|
174
|
+
File.write(dep_json[13..-1], JSON.pretty_generate(ideps))
|
175
|
+
end
|
151
176
|
|
152
177
|
print "\n"
|
153
178
|
|
data/lib/adapt/config/loader.rb
CHANGED
data/lib/bake/cache.rb
CHANGED
@@ -31,7 +31,7 @@ module Bake
|
|
31
31
|
@cacheFilename = Bake.options.main_dir+"/.bake/Project.meta." + sanitize_filename(Bake.options.build_config) + qacStr + ".cache"
|
32
32
|
end
|
33
33
|
if !Bake.options.dry
|
34
|
-
Utils.gitIgnore(File.dirname(@cacheFilename))
|
34
|
+
Utils.gitIgnore(File.dirname(@cacheFilename), :silent)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -187,10 +187,16 @@ module Bake
|
|
187
187
|
cache.adapt_filenames = AdaptConfig.filenames
|
188
188
|
bbdump = Marshal.dump(cache)
|
189
189
|
begin
|
190
|
-
File.
|
191
|
-
rescue
|
190
|
+
File.open(@cacheFilename, 'wb') {|file| file.write(bbdump) }
|
191
|
+
rescue Exception=>e
|
192
|
+
if Bake.options.verbose >= 3
|
193
|
+
Bake.formatter.printWarning("Warning: Could not write cache file #{@cacheFilename}")
|
194
|
+
if Bake.options.debug
|
195
|
+
puts e.message
|
196
|
+
puts e.backtrace
|
197
|
+
end
|
198
|
+
end
|
192
199
|
end
|
193
|
-
File.open(@cacheFilename, 'wb') {|file| file.write(bbdump) }
|
194
200
|
Bake.options.nocache = false
|
195
201
|
end
|
196
202
|
|
data/lib/bake/config/checks.rb
CHANGED
@@ -3,6 +3,12 @@ module Bake
|
|
3
3
|
|
4
4
|
class Checks
|
5
5
|
|
6
|
+
@@warnedCase = []
|
7
|
+
|
8
|
+
def self.cleanupWarnings
|
9
|
+
@@warnedCase.clear
|
10
|
+
end
|
11
|
+
|
6
12
|
def self.symlinkCheck(filename)
|
7
13
|
dirOfProjMeta = File.dirname(filename)
|
8
14
|
Dir.chdir(dirOfProjMeta) do
|
@@ -19,6 +25,27 @@ module Bake
|
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
28
|
+
|
29
|
+
def self.sanityFolderName(dorg)
|
30
|
+
return if !Bake.options.caseSensitivityCheck
|
31
|
+
return if Bake.options.verbose < 1
|
32
|
+
d = dorg
|
33
|
+
while (d != File.dirname(d))
|
34
|
+
b = File.basename(d)
|
35
|
+
dnew = File.dirname(d)
|
36
|
+
Dir.chdir(dnew) do
|
37
|
+
files = Dir.glob("*")
|
38
|
+
if !files.include?(b)
|
39
|
+
possible = files.select{ |f| f.casecmp(b)==0 }
|
40
|
+
if possible.length > 0 && !@@warnedCase.include?(d)
|
41
|
+
@@warnedCase << d
|
42
|
+
Bake.formatter.printWarning("Warning: '#{b}' not found in '#{dnew}'. Alternatives: #{possible.map{|p| "'#{p}'"}.join(", ")}. Maybe a typo happened while entering a folder in the shell?")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
d = dnew
|
47
|
+
end
|
48
|
+
end
|
22
49
|
|
23
50
|
def self.commonMetamodelCheck(configs, filename, isAdapt = false)
|
24
51
|
|
@@ -76,6 +103,10 @@ module Bake
|
|
76
103
|
Bake.formatter.printError("IncludeDir must have inject OR infix (deprecated)", inc)
|
77
104
|
ExitHelper.exit(1)
|
78
105
|
end
|
106
|
+
if (inc.name.empty? || inc.name[0] == " ")
|
107
|
+
Bake.formatter.printError("IncludeDir must not be empty or start with a space", inc)
|
108
|
+
ExitHelper.exit(1)
|
109
|
+
end
|
79
110
|
end if config.respond_to?("includeDir")
|
80
111
|
|
81
112
|
if not ["", "yes", "no", "all"].include?config.mergeInc
|
data/lib/bake/config/loader.rb
CHANGED
@@ -70,6 +70,7 @@ module Bake
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def getFullProject(projName, configs, configname, isMain)
|
73
|
+
|
73
74
|
|
74
75
|
configname = resolveConfigName(configs, configname)
|
75
76
|
|
@@ -83,6 +84,7 @@ module Bake
|
|
83
84
|
@defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
|
84
85
|
@mainProjectName = config.parent.name
|
85
86
|
@mainConfigName = config.name
|
87
|
+
@configHashMain = {}
|
86
88
|
end
|
87
89
|
|
88
90
|
# check if config has to be manipulated
|
@@ -113,7 +115,18 @@ module Bake
|
|
113
115
|
configHash[s.name] = [] unless configHash.has_key?(s.name)
|
114
116
|
configHash[s.name] += s.value.split(";")
|
115
117
|
end
|
116
|
-
|
118
|
+
|
119
|
+
if !isMain
|
120
|
+
@configHashMain.each do |k,v|
|
121
|
+
if configHash.has_key?(k)
|
122
|
+
configHash[k] += v
|
123
|
+
configHash[k].uniq!
|
124
|
+
else
|
125
|
+
configHash[k] = v
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
117
130
|
checkCondition = lambda {|name,value|
|
118
131
|
return true if adaptHash[name].empty?
|
119
132
|
if !configHash.has_key?(name)
|
@@ -137,25 +150,15 @@ module Bake
|
|
137
150
|
end
|
138
151
|
end
|
139
152
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
def symlinkCheck(filename)
|
145
|
-
dirOfProjMeta = File.dirname(filename)
|
146
|
-
Dir.chdir(dirOfProjMeta) do
|
147
|
-
if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
|
148
|
-
isSym = false
|
149
|
-
begin
|
150
|
-
isSym = File.symlink?(dirOfProjMeta)
|
151
|
-
rescue
|
152
|
-
end
|
153
|
-
if isSym
|
154
|
-
Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
|
155
|
-
ExitHelper.exit(1)
|
156
|
-
end
|
153
|
+
if isMain
|
154
|
+
config.scopes.each do |s|
|
155
|
+
@configHashMain[s.name] = [] unless @configHashMain.has_key?(s.name)
|
156
|
+
@configHashMain[s.name] += s.value.split(";")
|
157
157
|
end
|
158
158
|
end
|
159
|
+
|
160
|
+
@fullProjects[projName + "," + configname] = [config, configname]
|
161
|
+
[config, configname]
|
159
162
|
end
|
160
163
|
|
161
164
|
def checkVerFormat(ver)
|
@@ -200,6 +203,7 @@ module Bake
|
|
200
203
|
def loadProjMeta(filename)
|
201
204
|
|
202
205
|
Bake::Configs::Checks.symlinkCheck(filename)
|
206
|
+
Bake::Configs::Checks.sanityFolderName(filename)
|
203
207
|
|
204
208
|
f = @loader.load(filename)
|
205
209
|
|
data/lib/bake/libElement.rb
CHANGED
@@ -60,6 +60,19 @@ module Bake
|
|
60
60
|
@@source_libraries << adaptedPath
|
61
61
|
end
|
62
62
|
end
|
63
|
+
le = block.library ? block.library : (block.executable ? block.executable : nil)
|
64
|
+
if le
|
65
|
+
cb = le.compileBlock
|
66
|
+
if !cb.nil? && !cb.object_files_ignored_in_lib.nil?
|
67
|
+
cb.object_files_ignored_in_lib.each do |ldirect|
|
68
|
+
adaptedPath, prefix = adaptPath(ldirect, block, prefix)
|
69
|
+
if (!block.prebuild or File.exist?adaptedPath)
|
70
|
+
@@linker_libs_array << adaptedPath
|
71
|
+
@@source_libraries << adaptedPath
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
63
76
|
end
|
64
77
|
|
65
78
|
def self.collect_recursive(block, levels = -1)
|
data/lib/bake/model/loader.rb
CHANGED
data/lib/bake/model/metamodel.rb
CHANGED
@@ -131,6 +131,10 @@ module Bake
|
|
131
131
|
has_attr 'text', String, :defaultValueLiteral => ""
|
132
132
|
end
|
133
133
|
|
134
|
+
class CompilationDB < ModelElement
|
135
|
+
has_attr 'name', String, :defaultValueLiteral => "$(WorkingDir)/compile_commands.json"
|
136
|
+
end
|
137
|
+
|
134
138
|
class RequiredBakeVersion < ModelElement
|
135
139
|
has_attr 'minimum', String, :defaultValueLiteral => ""
|
136
140
|
has_attr 'maximum', String, :defaultValueLiteral => ""
|
@@ -143,6 +147,7 @@ module Bake
|
|
143
147
|
class Files < ModelElement
|
144
148
|
has_attr 'name', String, :defaultValueLiteral => ""
|
145
149
|
has_attr 'compileOnly', Boolean, :defaultValueLiteral => "false"
|
150
|
+
has_attr 'linkDirectly', Boolean, :defaultValueLiteral => "false"
|
146
151
|
contains_many 'define', Define, 'parent'
|
147
152
|
contains_many 'flags', Flags, 'parent'
|
148
153
|
end
|
@@ -299,6 +304,7 @@ module Bake
|
|
299
304
|
contains_one 'toolchain', Toolchain, 'parent'
|
300
305
|
contains_many 'set', Set, 'parent'
|
301
306
|
contains_many 'prebuild', Prebuild, 'parent'
|
307
|
+
contains_one 'cdb', CompilationDB, 'parent'
|
302
308
|
|
303
309
|
module ClassModule
|
304
310
|
def ident
|
data/lib/bake/options/options.rb
CHANGED
@@ -11,16 +11,9 @@ require_relative '../../common/crc32'
|
|
11
11
|
|
12
12
|
module Bake
|
13
13
|
|
14
|
-
def self.options
|
15
|
-
@@options
|
16
|
-
end
|
17
|
-
def self.options=(options)
|
18
|
-
@@options = options
|
19
|
-
end
|
20
|
-
|
21
14
|
class Options < Parser
|
22
|
-
attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :showConfigs
|
23
|
-
attr_reader :main_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :dotFilename
|
15
|
+
attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :showConfigs, :cc2j_filename
|
16
|
+
attr_reader :main_dir, :working_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :dotFilename # String
|
24
17
|
attr_reader :include_filter, :exclude_filter, :adapt # String List
|
25
18
|
attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :projectPaths, :qac, :dry, :syncedOutput, :debug_threads, :skipBuildingLine # Boolean
|
26
19
|
attr_reader :linkOnly, :compileOnly, :no_autodir, :clobber, :docu, :debug, :prepro, :prebuild, :printTime, :json, :wparse, :caseSensitivityCheck, :fileCmd, :profiling # Boolean
|
@@ -193,6 +186,7 @@ module Bake
|
|
193
186
|
Bake.formatter.printError("Error: Project.meta not found in #{searchDir} or upwards")
|
194
187
|
ExitHelper.exit(1)
|
195
188
|
end
|
189
|
+
set_working_dir()
|
196
190
|
|
197
191
|
def_roots = Root.calc_roots_bake(@main_dir)
|
198
192
|
@roots += def_roots
|
@@ -323,11 +317,19 @@ module Bake
|
|
323
317
|
@main_project_name = File::basename(@main_dir)
|
324
318
|
end
|
325
319
|
|
320
|
+
def set_working_dir()
|
321
|
+
@working_dir = File.expand_path(Dir.pwd.gsub(/[\\]/,'/'))
|
322
|
+
end
|
323
|
+
|
326
324
|
def set_root(dir)
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
325
|
+
if File.file?(dir)
|
326
|
+
@roots += Root.calc_roots_bake(dir)
|
327
|
+
else
|
328
|
+
root = Root.extract_depth(dir)
|
329
|
+
check_valid_dir(root.dir)
|
330
|
+
root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
|
331
|
+
@roots << root
|
332
|
+
end
|
331
333
|
end
|
332
334
|
|
333
335
|
def set_adapt(name)
|
@@ -336,16 +338,21 @@ module Bake
|
|
336
338
|
end
|
337
339
|
end
|
338
340
|
|
339
|
-
def checkNum(num)
|
341
|
+
def checkNum(num, quite = false)
|
340
342
|
if String === num && !/\A\d+\z/.match(num)
|
341
|
-
|
342
|
-
|
343
|
+
if !quite
|
344
|
+
Bake.formatter.printError("Error: #{num} is not a positive number")
|
345
|
+
ExitHelper.exit(1)
|
346
|
+
else
|
347
|
+
return false
|
348
|
+
end
|
343
349
|
end
|
350
|
+
return true
|
344
351
|
end
|
345
352
|
|
346
353
|
def set_threads(num)
|
347
354
|
return if num == nil # -j without number shall behave the same as not set
|
348
|
-
checkNum(num)
|
355
|
+
return :ignore if !checkNum(num, true)
|
349
356
|
@threads = String === num ? num.to_i : num
|
350
357
|
if @threads <= 0
|
351
358
|
Bake.formatter.printError("Error: number of threads must be > 0")
|
@@ -379,6 +386,14 @@ module Bake
|
|
379
386
|
|
380
387
|
end
|
381
388
|
|
389
|
+
def self.options
|
390
|
+
@@options ||= Options.new([])
|
391
|
+
end
|
392
|
+
|
393
|
+
def self.options=(options)
|
394
|
+
@@options = options
|
395
|
+
end
|
396
|
+
|
382
397
|
end
|
383
398
|
|
384
399
|
|
data/lib/bake/subst.rb
CHANGED
@@ -202,6 +202,8 @@ module Bake
|
|
202
202
|
substStr << Bake.options.main_project_name
|
203
203
|
elsif var == "MainProjectDir"
|
204
204
|
substStr << Bake.options.main_dir
|
205
|
+
elsif var == "WorkingDir"
|
206
|
+
substStr << Bake.options.working_dir
|
205
207
|
elsif var == "ConfigName"
|
206
208
|
substStr << @@configName
|
207
209
|
elsif var == "ToolchainName" and defined?@@toolchainName
|
data/lib/bakery/model/loader.rb
CHANGED
@@ -91,10 +91,14 @@ module Bake
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def set_root(dir)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
if File.file?(dir)
|
95
|
+
@roots += Root.calc_roots_bake(dir)
|
96
|
+
else
|
97
|
+
root = Root.extract_depth(dir)
|
98
|
+
check_valid_dir(root.dir)
|
99
|
+
root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
|
100
|
+
@roots << root
|
101
|
+
end
|
98
102
|
end
|
99
103
|
|
100
104
|
end
|
data/lib/bakery/toBake.rb
CHANGED
@@ -35,7 +35,7 @@ module Bake
|
|
35
35
|
projs << root.dir + "/Project.meta"
|
36
36
|
end
|
37
37
|
if projs.length == 0
|
38
|
-
|
38
|
+
Bake.formatter.printWarning("pattern does not match any project: #{p.name}", p)
|
39
39
|
end
|
40
40
|
projs.each do |f|
|
41
41
|
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p.args, p)
|
@@ -58,6 +58,10 @@ module Bake
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
toBuildPattern.select {|bp| !bp.coll_p.isFound}.map {|bp| bp.coll_p}.uniq.each do |p|
|
62
|
+
Bake.formatter.printWarning("pattern does not match any config: #{p.config}", p)
|
63
|
+
end
|
64
|
+
|
61
65
|
col.exclude.each do |p|
|
62
66
|
p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
|
63
67
|
p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
|
data/lib/blocks/block.rb
CHANGED
@@ -22,7 +22,7 @@ module Bake
|
|
22
22
|
@@delayed_result = true
|
23
23
|
@@threads = []
|
24
24
|
|
25
|
-
attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :configName, :prebuild, :output_dir, :tcs
|
25
|
+
attr_reader :lib_elements, :projectDir, :library, :executable, :config, :projectName, :configName, :prebuild, :output_dir, :tcs
|
26
26
|
attr_accessor :visited, :inDeps, :result, :bes, :besDirect
|
27
27
|
|
28
28
|
def startupSteps
|
@@ -64,7 +64,11 @@ module Bake
|
|
64
64
|
def set_library(library)
|
65
65
|
@library = library
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
|
+
def set_executable(executable)
|
69
|
+
@executable = executable
|
70
|
+
end
|
71
|
+
|
68
72
|
def qname()
|
69
73
|
@projectName + "," + @configName
|
70
74
|
end
|
@@ -74,6 +78,7 @@ module Bake
|
|
74
78
|
@prebuild = prebuild
|
75
79
|
@visited = false
|
76
80
|
@library = nil
|
81
|
+
@executable = nil
|
77
82
|
@config = config
|
78
83
|
@referencedConfigs = referencedConfigs
|
79
84
|
@projectName = config.parent.name
|
@@ -119,6 +124,13 @@ module Bake
|
|
119
124
|
resPathMagic = inc[1..-1].join("/") # within self
|
120
125
|
resPathMagic = "." if resPathMagic == ""
|
121
126
|
res << resPathMagic
|
127
|
+
if warnIfLocal
|
128
|
+
if resPathMagic == "."
|
129
|
+
Bake.formatter.printInfo("\"#{d}\" uses path magic in IncludeDir, please use \".\" instead", elem)
|
130
|
+
else
|
131
|
+
Bake.formatter.printInfo("\"#{d}\" uses path magic in IncludeDir, please omit \"#{inc[0]}/\" or use \"./#{resPathMagic}\"", elem) if warnIfLocal
|
132
|
+
end
|
133
|
+
end
|
122
134
|
elsif @referencedConfigs.include?(inc[0])
|
123
135
|
dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
|
124
136
|
resPathMagic = File.rel_from_to_project(@projectDir, dirOther, false)
|
@@ -126,17 +138,19 @@ module Bake
|
|
126
138
|
resPathMagic = resPathMagic + "/" + postfix if postfix != ""
|
127
139
|
resPathMagic = "." if resPathMagic == ""
|
128
140
|
res << resPathMagic
|
141
|
+
Bake.formatter.printInfo("\"#{d}\" uses path magic in IncludeDir, please use a Dependency to \"#{inc[0]}\" instead", elem) if warnIfLocal
|
129
142
|
end
|
130
143
|
|
131
144
|
if File.exists?(@projectDir + "/" + d) # prio 2: local, e.g. "include"
|
132
145
|
res << d
|
133
146
|
end
|
134
147
|
|
135
|
-
#
|
148
|
+
# prio 3: check if dir exists without Project.meta entry
|
136
149
|
Bake.options.roots.each do |r|
|
137
150
|
absIncDir = r.dir+"/"+d
|
138
151
|
if File.exists?(absIncDir)
|
139
152
|
res << File.rel_from_to_project(@projectDir,absIncDir,false)
|
153
|
+
Bake.formatter.printInfo("\"#{d}\" uses path magic in IncludeDir, please create a Project.meta in \"#{absIncDir}\" or upwards and use a Dependency instead", elem) if warnIfLocal && res.length == 1
|
140
154
|
end
|
141
155
|
end
|
142
156
|
|
@@ -355,14 +369,14 @@ module Bake
|
|
355
369
|
def callSteps(method)
|
356
370
|
@config.writeEnvVars()
|
357
371
|
Thread.current[:lastCommand] = nil
|
358
|
-
allSteps = (preSteps + mainSteps + postSteps)
|
372
|
+
@allSteps = (preSteps + mainSteps + postSteps)
|
359
373
|
# check if we have to delay the output (if the last step of this block is not in a thread)
|
360
374
|
@outputStep = nil
|
361
|
-
allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
|
362
|
-
while
|
375
|
+
@allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
|
376
|
+
while !@allSteps.empty?
|
363
377
|
parallel = []
|
364
|
-
while allSteps.first && independent?(method, allSteps.first)
|
365
|
-
parallel << allSteps.shift
|
378
|
+
while @allSteps.first && independent?(method, @allSteps.first)
|
379
|
+
parallel << @allSteps.shift
|
366
380
|
end
|
367
381
|
if parallel.length > 0
|
368
382
|
execute_in_thread(parallel) {
|
@@ -383,7 +397,7 @@ module Bake
|
|
383
397
|
end
|
384
398
|
}
|
385
399
|
else
|
386
|
-
step = allSteps.shift
|
400
|
+
step = @allSteps.shift
|
387
401
|
Blocks::Block::waitForAllThreads()
|
388
402
|
@result = executeStep(step, method) if @result
|
389
403
|
@outputStep = nil if !@result && blockAbort?(@result)
|
@@ -404,13 +418,29 @@ module Bake
|
|
404
418
|
return true
|
405
419
|
end
|
406
420
|
|
407
|
-
|
408
|
-
|
421
|
+
SyncOut.mutex.synchronize do
|
422
|
+
if @visited
|
423
|
+
while !defined?(@allSteps) || !@allSteps.empty?
|
424
|
+
sleep(0.1)
|
425
|
+
end
|
426
|
+
return true # maybe to improve later (return false if step has a failed non-independent step)
|
427
|
+
end
|
428
|
+
@visited = true
|
429
|
+
end
|
409
430
|
|
410
431
|
@inDeps = true
|
411
|
-
|
432
|
+
begin
|
433
|
+
depResult = callDeps(:execute)
|
434
|
+
rescue Exception => e
|
435
|
+
@allSteps = []
|
436
|
+
raise
|
437
|
+
end
|
438
|
+
|
412
439
|
@inDeps = false
|
413
|
-
|
440
|
+
if blockAbort?(depResult)
|
441
|
+
@allSteps = []
|
442
|
+
return @result && depResult
|
443
|
+
end
|
414
444
|
|
415
445
|
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
416
446
|
begin
|
@@ -445,8 +475,9 @@ module Bake
|
|
445
475
|
SyncOut.discardStreams()
|
446
476
|
end
|
447
477
|
end
|
478
|
+
@allSteps = []
|
448
479
|
end
|
449
|
-
|
480
|
+
|
450
481
|
return (depResult && @result)
|
451
482
|
end
|
452
483
|
|
data/lib/blocks/blockBase.rb
CHANGED
@@ -131,7 +131,6 @@ module Bake
|
|
131
131
|
if metadata_json = Bake.options.dev_features.include?("no-error-parser")
|
132
132
|
error_descs = []
|
133
133
|
console_output_full = x[0]
|
134
|
-
incList = []
|
135
134
|
else
|
136
135
|
error_descs, console_output_full, incList = error_parser.scan_lines(x, @projectDir)
|
137
136
|
end
|
data/lib/blocks/compile.rb
CHANGED
@@ -47,7 +47,7 @@ module Bake
|
|
47
47
|
|
48
48
|
class Compile < BlockBase
|
49
49
|
|
50
|
-
attr_reader :objects, :include_list, :source_files_ignored_in_lib
|
50
|
+
attr_reader :objects, :include_list, :source_files_ignored_in_lib, :object_files_ignored_in_lib
|
51
51
|
|
52
52
|
def mutex
|
53
53
|
@mutex ||= Mutex.new
|
@@ -264,16 +264,17 @@ module Bake
|
|
264
264
|
success = true
|
265
265
|
consoleOutput = ""
|
266
266
|
incList = nil
|
267
|
+
|
267
268
|
if !Bake.options.diabCaseCheck
|
268
269
|
success, consoleOutput = ProcessHelper.run(realCmd, false, false, nil, [0], @projectDir) if !Bake.options.dry
|
269
270
|
incList = process_result(realCmd, consoleOutput, compiler[:ERROR_PARSER], nil, reason, success)
|
270
271
|
end
|
271
272
|
|
272
|
-
if type != :ASM
|
273
|
+
if type != :ASM && !Bake.options.analyze && !Bake.options.prepro
|
273
274
|
Dir.mutex.synchronize do
|
274
275
|
if !Bake.options.diabCaseCheck
|
275
276
|
Dir.chdir(@projectDir) do
|
276
|
-
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
|
277
|
+
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE], compiler[:COMMAND]) if incList.nil?
|
277
278
|
Compile.write_depfile(source, incList, dep_filename_conv, @projectDir)
|
278
279
|
end
|
279
280
|
end
|
@@ -291,7 +292,7 @@ module Bake
|
|
291
292
|
raise SystemCommandFailed.new
|
292
293
|
end
|
293
294
|
Dir.chdir(@projectDir) do
|
294
|
-
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE])
|
295
|
+
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE], compiler[:COMMAND])
|
295
296
|
Compile.write_depfile(source, incList, dep_filename_conv, @projectDir)
|
296
297
|
end
|
297
298
|
ergs = consoleOutput.scan(/# \d+ "([^"]+)" \d+/)
|
@@ -341,14 +342,12 @@ module Bake
|
|
341
342
|
SyncOut.flushOutput()
|
342
343
|
end
|
343
344
|
end
|
344
|
-
|
345
|
-
|
346
|
-
|
347
345
|
end
|
348
346
|
|
349
|
-
def self.read_depfile(dep_filename, projDir, lineType)
|
347
|
+
def self.read_depfile(dep_filename, projDir, lineType, command = "")
|
350
348
|
deps = []
|
351
349
|
begin
|
350
|
+
lineType = :single if command.include?("cafeCC")
|
352
351
|
if lineType == :single
|
353
352
|
File.readlines(dep_filename).each do |line|
|
354
353
|
splitted = line.split(": ")
|
@@ -514,6 +513,7 @@ module Bake
|
|
514
513
|
end
|
515
514
|
|
516
515
|
def calcObjects
|
516
|
+
@object_files_ignored_in_lib = []
|
517
517
|
@source_files.each do |source|
|
518
518
|
type = get_source_type(source)
|
519
519
|
if not type.nil?
|
@@ -527,7 +527,13 @@ module Bake
|
|
527
527
|
end
|
528
528
|
end
|
529
529
|
@object_files[source] = object
|
530
|
-
|
530
|
+
if @source_files_ignored_in_lib.include?(source)
|
531
|
+
if @source_files_link_directly.include?(source)
|
532
|
+
@object_files_ignored_in_lib << object
|
533
|
+
end
|
534
|
+
else
|
535
|
+
@objects << object
|
536
|
+
end
|
531
537
|
end
|
532
538
|
end
|
533
539
|
end
|
@@ -536,6 +542,7 @@ module Bake
|
|
536
542
|
return @source_files if @source_files and not @source_files.empty?
|
537
543
|
@source_files = []
|
538
544
|
@source_files_ignored_in_lib = []
|
545
|
+
@source_files_link_directly = []
|
539
546
|
@fileTcs = {}
|
540
547
|
|
541
548
|
exclude_files = Set.new
|
@@ -565,11 +572,17 @@ module Bake
|
|
565
572
|
if ((!@fileTcs.has_key?(f)) || singleFile)
|
566
573
|
@fileTcs[f] = icf
|
567
574
|
end
|
568
|
-
|
569
|
-
|
575
|
+
if source_files.include?(f) || exclude_files.include?(f)
|
576
|
+
if (singleFile)
|
577
|
+
@source_files_ignored_in_lib << f if sources.compileOnly || sources.linkDirectly
|
578
|
+
@source_files_link_directly << f if sources.linkDirectly
|
579
|
+
end
|
580
|
+
next
|
581
|
+
end
|
570
582
|
source_files << f
|
571
583
|
@source_files << f
|
572
|
-
@source_files_ignored_in_lib << f if sources.compileOnly
|
584
|
+
@source_files_ignored_in_lib << f if sources.compileOnly || sources.linkDirectly
|
585
|
+
@source_files_link_directly << f if sources.linkDirectly
|
573
586
|
end
|
574
587
|
end
|
575
588
|
|
data/lib/blocks/executable.rb
CHANGED
@@ -6,10 +6,14 @@ module Bake
|
|
6
6
|
|
7
7
|
class Executable < BlockBase
|
8
8
|
|
9
|
+
attr_reader :compileBlock
|
10
|
+
|
9
11
|
def initialize(block, config, referencedConfigs, compileBlock)
|
10
12
|
super(block, config, referencedConfigs)
|
11
13
|
@compileBlock = compileBlock
|
12
14
|
|
15
|
+
block.set_executable(self)
|
16
|
+
|
13
17
|
calcArtifactName
|
14
18
|
calcMapFile
|
15
19
|
calcLinkerScript
|
data/lib/common/cleanup.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative "../blocks/block"
|
2
2
|
require_relative "ext/file"
|
3
|
+
require_relative "../bake/config/checks"
|
3
4
|
|
4
5
|
module Bake
|
5
6
|
|
@@ -10,7 +11,8 @@ module Bake
|
|
10
11
|
Bake::IDEInterface.instance.set_abort(false)
|
11
12
|
Blocks::Block.reset_block_counter
|
12
13
|
Blocks::Block.reset_delayed_result
|
13
|
-
|
14
|
+
Configs::Checks.cleanupWarnings
|
15
|
+
ToCxx::reset_include_deps
|
14
16
|
end
|
15
17
|
|
16
18
|
end
|
data/lib/common/ext/file.rb
CHANGED
@@ -52,7 +52,7 @@ class File
|
|
52
52
|
|
53
53
|
while i < max
|
54
54
|
if toSplitted[i] != fromSplitted[i]
|
55
|
-
if Bake.options.verbose >= 1
|
55
|
+
if Bake.options.verbose >= 1 && Bake.options.caseSensitivityCheck
|
56
56
|
if toSplitted[i].casecmp(fromSplitted[i]) == 0
|
57
57
|
if !@@warnedCase.include?(fromSplitted[0..i].join("/"))
|
58
58
|
fromsj = fromSplitted[0..i].join("/")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RGen
|
2
|
+
module Util
|
3
|
+
|
4
|
+
class FileCacheMap
|
5
|
+
alias_method :orig_store_data, :store_data
|
6
|
+
def store_data(key_path, value_data)
|
7
|
+
begin
|
8
|
+
orig_store_data(key_path, value_data)
|
9
|
+
rescue Exception=>e
|
10
|
+
if Bake.options.verbose >= 3
|
11
|
+
cf = cache_file(key_path)
|
12
|
+
Bake.formatter.printWarning("Warning: Could not write cache file #{cf}")
|
13
|
+
if Bake.options.debug
|
14
|
+
puts e.message
|
15
|
+
puts e.backtrace
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -81,8 +81,8 @@ module Bake
|
|
81
81
|
if inPlaceArg
|
82
82
|
option.call(inPlaceArg, nil, nil)
|
83
83
|
else
|
84
|
-
option.call(@argv[pos+1], nil, nil) # do not use inplace value
|
85
|
-
pos = pos + 1
|
84
|
+
ignore = option.call(@argv[pos+1], nil, nil) # do not use inplace value
|
85
|
+
pos = pos + 1 if ignore != :ignore
|
86
86
|
end
|
87
87
|
else
|
88
88
|
option.call(nil, nil, nil)
|
data/lib/common/root.rb
CHANGED
@@ -58,7 +58,7 @@ module Bake
|
|
58
58
|
|
59
59
|
def self.calc_roots_bake(dir)
|
60
60
|
def_roots = []
|
61
|
-
rootsFile = searchRootsFile(dir)
|
61
|
+
rootsFile = (File.file?(dir) ? dir : searchRootsFile(dir))
|
62
62
|
if (rootsFile)
|
63
63
|
File.open(rootsFile).each do |line|
|
64
64
|
line = line.split("#")[0].strip.gsub(/[\\]/,'/')
|
data/lib/common/utils.rb
CHANGED
@@ -4,11 +4,21 @@ module Bake
|
|
4
4
|
|
5
5
|
module Utils
|
6
6
|
|
7
|
-
def self.gitIgnore(folder)
|
8
|
-
FileUtils::mkdir_p(folder)
|
7
|
+
def self.gitIgnore(folder, mode = :report)
|
9
8
|
gitignore = folder + "/.gitignore"
|
10
|
-
|
11
|
-
|
9
|
+
begin
|
10
|
+
FileUtils::mkdir_p(folder)
|
11
|
+
if !File.exist?(gitignore)
|
12
|
+
File.write(gitignore, ".\n")
|
13
|
+
end
|
14
|
+
rescue Exception=>e
|
15
|
+
if mode != :silent && Bake.options.verbose >= 3
|
16
|
+
Bake.formatter.printWarning("Warning: Could not write file #{gitignore}")
|
17
|
+
if Bake.options.debug
|
18
|
+
puts e.message
|
19
|
+
puts e.backtrace
|
20
|
+
end
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
14
24
|
|
data/lib/common/version.rb
CHANGED
data/lib/tocxx.rb
CHANGED
@@ -45,10 +45,19 @@ module Bake
|
|
45
45
|
class ToCxx
|
46
46
|
|
47
47
|
@@linkBlock = 0
|
48
|
+
@@include_deps = {}
|
48
49
|
|
49
50
|
def self.linkBlock
|
50
51
|
@@linkBlock = 1
|
51
52
|
end
|
53
|
+
|
54
|
+
def self.include_deps
|
55
|
+
@@include_deps
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.reset_include_deps
|
59
|
+
@@include_deps = {}
|
60
|
+
end
|
52
61
|
|
53
62
|
def initialize
|
54
63
|
@configTcMap = {}
|
@@ -232,6 +241,22 @@ module Bake
|
|
232
241
|
end
|
233
242
|
end
|
234
243
|
|
244
|
+
def makeDepOverview
|
245
|
+
return if !Bake.options.dev_features.any? {|feature| feature.start_with?("dep-overview=") }
|
246
|
+
Blocks::ALL_BLOCKS.each do |name,block|
|
247
|
+
block.bes.each do |depInc|
|
248
|
+
@@include_deps[block.projectDir] = Set.new if !@@include_deps.has_key?(block.projectDir)
|
249
|
+
if (Metamodel::Dependency === depInc)
|
250
|
+
c = @referencedConfigs[depInc.name].detect { |configRef| configRef.name == depInc.config }
|
251
|
+
@@include_deps[block.projectDir] << Blocks::ALL_BLOCKS[c.qname].projectDir
|
252
|
+
else
|
253
|
+
@@include_deps[block.projectDir] << depInc.name
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
ExitHelper.exit(0)
|
258
|
+
end
|
259
|
+
|
235
260
|
def makeIncs
|
236
261
|
Blocks::ALL_BLOCKS.each do |name,block|
|
237
262
|
bes2 = []
|
@@ -692,6 +717,8 @@ module Bake
|
|
692
717
|
makeGraph
|
693
718
|
puts "Profiling #{Time.now - $timeStart}: make includes..." if Bake.options.profiling
|
694
719
|
makeIncs
|
720
|
+
puts "Profiling #{Time.now - $timeStart}: make dep overview..." if Bake.options.profiling
|
721
|
+
makeDepOverview
|
695
722
|
puts "Profiling #{Time.now - $timeStart}: make uniq..." if Bake.options.profiling
|
696
723
|
makeUniq
|
697
724
|
puts "Profiling #{Time.now - $timeStart}: convert to building blocks..." if Bake.options.profiling
|
@@ -701,7 +728,17 @@ module Bake
|
|
701
728
|
makeDot
|
702
729
|
end
|
703
730
|
|
704
|
-
|
731
|
+
if !Bake.options.cc2j_filename
|
732
|
+
if !@mainConfig.cdb.nil?
|
733
|
+
Bake.options.cc2j_filename = @mainConfig.cdb.name
|
734
|
+
if !File.is_absolute?(Bake.options.cc2j_filename)
|
735
|
+
Bake.options.cc2j_filename = File.join(
|
736
|
+
File.rel_from_to_project(Dir.pwd, @mainConfig.parent.get_project_dir, false),
|
737
|
+
Bake.options.cc2j_filename)
|
738
|
+
end
|
739
|
+
end
|
740
|
+
end
|
741
|
+
|
705
742
|
metadata_json = Bake.options.dev_features.detect { |x| x.start_with?("metadata=") }
|
706
743
|
if metadata_json
|
707
744
|
metadata_file = metadata_json[9..-1]
|
@@ -730,7 +767,7 @@ module Bake
|
|
730
767
|
puts "File #{metadata_file} written."
|
731
768
|
ExitHelper.exit(0)
|
732
769
|
else
|
733
|
-
Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig
|
770
|
+
Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig or ExecutableConfig.")
|
734
771
|
ExitHelper.exit(1)
|
735
772
|
end
|
736
773
|
end
|
@@ -785,7 +822,14 @@ module Bake
|
|
785
822
|
|
786
823
|
if Bake.options.cc2j_filename
|
787
824
|
require "json"
|
788
|
-
|
825
|
+
begin
|
826
|
+
Bake.formatter.printInfo("Info: writing compilation database #{Bake.options.cc2j_filename}") if Bake.options.verbose >= 1
|
827
|
+
File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
|
828
|
+
rescue Exception => ex
|
829
|
+
Bake.formatter.printError("Error: could not write compilation database: #{ex.message}")
|
830
|
+
puts ex.backtrace if Bake.options.debug
|
831
|
+
result = false
|
832
|
+
end
|
789
833
|
end
|
790
834
|
|
791
835
|
if Bake.options.filelist && !Bake.options.dry
|
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.63.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Schaal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 12.
|
117
|
+
version: 12.3.3
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 12.
|
124
|
+
version: 12.3.3
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- lib/common/exit_helper.rb
|
263
263
|
- lib/common/ext/dir.rb
|
264
264
|
- lib/common/ext/file.rb
|
265
|
+
- lib/common/ext/rgen.rb
|
265
266
|
- lib/common/ext/rtext.rb
|
266
267
|
- lib/common/ext/stdout.rb
|
267
268
|
- lib/common/ide_interface.rb
|