bake-toolkit 2.59.0 → 2.63.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f180513d1b93699bc796de737af3092d8f8fca946c4288f807f4457443249cd8
4
- data.tar.gz: 3e9351c22a0b019c8898dd481d244111d8d57c58633375a23eacb14db437504d
3
+ metadata.gz: 225fc376c9b3409d01e708f2ec67bb2d80f9c081d26de339d5b4bb3451141e50
4
+ data.tar.gz: e3769b3550aee5ae45685d8445b0ea3bfec59eea4ffa885900a461c82269b16b
5
5
  SHA512:
6
- metadata.gz: 0d219c7ac0087e19df782494589127baafd9b22978d20ebaadd1a58b12936cec2c1de1447a1620413fd73b84d1edcf7e64e177cec5774032e047dc9f9770b799
7
- data.tar.gz: d2c9e76821363aa6eca4d973c4d0f550f5f62c4a7fb1d08f676c07b8f5ad03ad812c3dd73f60f689c5a76646fc7676ec4b6dd3d64b969451ef8e9b46125469bf
6
+ metadata.gz: 419125459eab7fb1ea49939389ff85c43ef6e7ddfd2fdc4bbd555e0a5b8d0e282d28e6e52da5ab3bac1d08d1b5cee4d163315d99bceab7700011aa5f3feda46f
7
+ data.tar.gz: 3e273c6f6a16f89ba30b1d40c8a787a9439693ba50dd33d4667328c91894b7302ae3c1f6e9f2c4d48078fdbba545270fb5c73ff0158f0e6766bc640774808896
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
 
@@ -15,6 +15,7 @@ module Bake
15
15
  def loadProjMeta(filename, filenum)
16
16
 
17
17
  Bake::Configs::Checks.symlinkCheck(filename)
18
+ Bake::Configs::Checks.sanityFolderName(filename)
18
19
 
19
20
  f = @loader.load(filename)
20
21
 
@@ -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
@@ -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
- @fullProjects[projName + "," + configname] = [config, configname]
141
- [config, configname]
142
- end
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
 
@@ -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)
@@ -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
@@ -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, :cc2j_filename # String
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
- root = Root.extract_depth(dir)
328
- check_valid_dir(root.dir)
329
- root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
330
- @roots << root
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
- Bake.formatter.printError("Error: #{num} is not a positive number")
342
- ExitHelper.exit(1)
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
 
@@ -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
@@ -91,10 +91,14 @@ module Bake
91
91
  end
92
92
 
93
93
  def set_root(dir)
94
- root = Root.extract_depth(dir)
95
- check_valid_dir(root.dir)
96
- root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
97
- @roots << root
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
@@ -22,8 +22,8 @@ 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
26
- attr_accessor :visited, :inDeps, :result, :bes
25
+ attr_reader :lib_elements, :projectDir, :library, :executable, :config, :projectName, :configName, :prebuild, :output_dir, :tcs
26
+ attr_accessor :visited, :inDeps, :result, :bes, :besDirect
27
27
 
28
28
  def startupSteps
29
29
  @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
@@ -82,6 +87,7 @@ module Bake
82
87
  @result = true
83
88
  @tcs = tcs
84
89
  @bes = []
90
+ @besDirect = []
85
91
  @lib_elements = []
86
92
 
87
93
  calcOutputDir
@@ -118,6 +124,13 @@ module Bake
118
124
  resPathMagic = inc[1..-1].join("/") # within self
119
125
  resPathMagic = "." if resPathMagic == ""
120
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
121
134
  elsif @referencedConfigs.include?(inc[0])
122
135
  dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
123
136
  resPathMagic = File.rel_from_to_project(@projectDir, dirOther, false)
@@ -125,17 +138,19 @@ module Bake
125
138
  resPathMagic = resPathMagic + "/" + postfix if postfix != ""
126
139
  resPathMagic = "." if resPathMagic == ""
127
140
  res << resPathMagic
141
+ Bake.formatter.printInfo("\"#{d}\" uses path magic in IncludeDir, please use a Dependency to \"#{inc[0]}\" instead", elem) if warnIfLocal
128
142
  end
129
143
 
130
144
  if File.exists?(@projectDir + "/" + d) # prio 2: local, e.g. "include"
131
145
  res << d
132
146
  end
133
147
 
134
- # prioo 3: check if dir exists without Project.meta entry
148
+ # prio 3: check if dir exists without Project.meta entry
135
149
  Bake.options.roots.each do |r|
136
150
  absIncDir = r.dir+"/"+d
137
151
  if File.exists?(absIncDir)
138
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
139
154
  end
140
155
  end
141
156
 
@@ -278,9 +293,11 @@ module Bake
278
293
  end
279
294
 
280
295
  def callDeps(method)
296
+ return true if Bake.options.project
281
297
  depResult = true
282
- dependencies.each do |dep|
283
- depResult = (ALL_BLOCKS[dep].send(method) and depResult)
298
+ bes.each do |dep|
299
+ next if Metamodel::IncludeDir === dep
300
+ depResult = (ALL_BLOCKS[dep.name+","+dep.config].send(method) and depResult)
284
301
  break if (!depResult) && Bake.options.stopOnFirstError
285
302
  end
286
303
  return depResult
@@ -352,14 +369,14 @@ module Bake
352
369
  def callSteps(method)
353
370
  @config.writeEnvVars()
354
371
  Thread.current[:lastCommand] = nil
355
- allSteps = (preSteps + mainSteps + postSteps)
372
+ @allSteps = (preSteps + mainSteps + postSteps)
356
373
  # check if we have to delay the output (if the last step of this block is not in a thread)
357
374
  @outputStep = nil
358
- allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
359
- while !allSteps.empty?
375
+ @allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
376
+ while !@allSteps.empty?
360
377
  parallel = []
361
- while allSteps.first && independent?(method, allSteps.first)
362
- parallel << allSteps.shift
378
+ while @allSteps.first && independent?(method, @allSteps.first)
379
+ parallel << @allSteps.shift
363
380
  end
364
381
  if parallel.length > 0
365
382
  execute_in_thread(parallel) {
@@ -380,7 +397,7 @@ module Bake
380
397
  end
381
398
  }
382
399
  else
383
- step = allSteps.shift
400
+ step = @allSteps.shift
384
401
  Blocks::Block::waitForAllThreads()
385
402
  @result = executeStep(step, method) if @result
386
403
  @outputStep = nil if !@result && blockAbort?(@result)
@@ -401,13 +418,29 @@ module Bake
401
418
  return true
402
419
  end
403
420
 
404
- return true if (@visited)
405
- @visited = true
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
406
430
 
407
431
  @inDeps = true
408
- depResult = callDeps(:execute)
432
+ begin
433
+ depResult = callDeps(:execute)
434
+ rescue Exception => e
435
+ @allSteps = []
436
+ raise
437
+ end
438
+
409
439
  @inDeps = false
410
- return @result && depResult if blockAbort?(depResult)
440
+ if blockAbort?(depResult)
441
+ @allSteps = []
442
+ return @result && depResult
443
+ end
411
444
 
412
445
  Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
413
446
  begin
@@ -442,8 +475,9 @@ module Bake
442
475
  SyncOut.discardStreams()
443
476
  end
444
477
  end
478
+ @allSteps = []
445
479
  end
446
-
480
+
447
481
  return (depResult && @result)
448
482
  end
449
483
 
@@ -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
@@ -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 and not Bake.options.analyze and not Bake.options.prepro
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
- @objects << object unless @source_files_ignored_in_lib.include?(source)
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
- next if exclude_files.include?(f)
569
- next if source_files.include?(f)
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
 
@@ -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
@@ -1,4 +1,6 @@
1
1
  require_relative "../blocks/block"
2
+ require_relative "ext/file"
3
+ require_relative "../bake/config/checks"
2
4
 
3
5
  module Bake
4
6
 
@@ -9,6 +11,8 @@ module Bake
9
11
  Bake::IDEInterface.instance.set_abort(false)
10
12
  Blocks::Block.reset_block_counter
11
13
  Blocks::Block.reset_delayed_result
14
+ Configs::Checks.cleanupWarnings
15
+ ToCxx::reset_include_deps
12
16
  end
13
17
 
14
18
  end
@@ -1,96 +1,115 @@
1
- require_relative '../utils'
2
-
3
- class File
4
-
5
- SLASH = '/'
6
-
7
- def self.is_absolute?(filename)
8
- filename[0] == SLASH or filename[1] == ':'
9
- end
10
-
11
- def self.normalize(filename)
12
- if filename.length > 1
13
- toIsWindowsAbs = filename[1] == ':'
14
- return filename[0].downcase + filename[1..-1] if toIsWindowsAbs
15
- end
16
- return filename
17
- end
18
-
19
- # seems both are rel or both are abs in all cases
20
- def self.rel_from_to_project(from,to,endWithSlash = true)
21
-
22
- return nil if from.nil? or to.nil?
23
-
24
- toSplitted = to.split('/')
25
- fromSplitted = from.split('/')
26
-
27
- max = [toSplitted.length, fromSplitted.length].min
28
-
29
-
30
- return nil if max < 1
31
-
32
- i = 0
33
-
34
- # path letter in windows may be case different
35
- toIsWindowsAbs = false
36
- if toSplitted[0].length > 1 and fromSplitted[0].length > 1
37
- toIsWindowsAbs = toSplitted[0][1] == ':'
38
- i = 1 if toIsWindowsAbs and fromSplitted[0][1] == ':' and toSplitted[0][0].downcase == fromSplitted[0][0].downcase
39
- end
40
-
41
- if (toIsWindowsAbs and i==0)
42
- res = to
43
- res += "/" if endWithSlash
44
- return res
45
- end
46
-
47
- while i < max
48
- break if toSplitted[i] != fromSplitted[i]
49
- i += 1
50
- end
51
- j = i
52
-
53
- res = []
54
- while i < fromSplitted.length
55
- res << ".."
56
- i += 1
57
- end
58
-
59
- while j < toSplitted.length
60
- res << toSplitted[j]
61
- j += 1
62
- end
63
-
64
- if res.length == 0
65
- return ""
66
- end
67
-
68
- res = res.join('/')
69
- res += "/" if endWithSlash
70
- res
71
- end
72
-
73
-
74
- def self.add_prefix(prefix, file)
75
- if not prefix or is_absolute?(file)
76
- file
77
- else
78
- prefix + file
79
- end
80
- end
81
-
82
- def self.which(cmd)
83
- return "" if not cmd
84
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
85
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
86
- exts.each { |ext|
87
- exe = File.join(path, "#{cmd}#{ext}")
88
- if File.executable?(exe) && !File.directory?(exe)
89
- return File.dirname(exe.gsub(/[\\]/,'/'))
90
- end
91
- }
92
- end
93
- return ""
94
- end
95
-
96
- end
1
+ require_relative '../utils'
2
+
3
+ class File
4
+
5
+ SLASH = '/'
6
+
7
+ @@warnedCase = []
8
+
9
+ def self.cleanupWarnings
10
+ @@warnedCase.clear
11
+ end
12
+
13
+ def self.is_absolute?(filename)
14
+ filename[0] == SLASH or filename[1] == ':'
15
+ end
16
+
17
+ def self.normalize(filename)
18
+ if filename.length > 1
19
+ toIsWindowsAbs = filename[1] == ':'
20
+ return filename[0].downcase + filename[1..-1] if toIsWindowsAbs
21
+ end
22
+ return filename
23
+ end
24
+
25
+ # seems both are rel or both are abs in all cases
26
+ def self.rel_from_to_project(from,to,endWithSlash = true)
27
+
28
+ return nil if from.nil? or to.nil?
29
+
30
+ toSplitted = to.split('/')
31
+ fromSplitted = from.split('/')
32
+
33
+ max = [toSplitted.length, fromSplitted.length].min
34
+
35
+
36
+ return nil if max < 1
37
+
38
+ i = 0
39
+
40
+ # path letter in windows may be case different
41
+ toIsWindowsAbs = false
42
+ if toSplitted[0].length > 1 and fromSplitted[0].length > 1
43
+ toIsWindowsAbs = toSplitted[0][1] == ':'
44
+ i = 1 if toIsWindowsAbs and fromSplitted[0][1] == ':' and toSplitted[0][0].downcase == fromSplitted[0][0].downcase
45
+ end
46
+
47
+ if (toIsWindowsAbs and i==0)
48
+ res = to
49
+ res += "/" if endWithSlash
50
+ return res
51
+ end
52
+
53
+ while i < max
54
+ if toSplitted[i] != fromSplitted[i]
55
+ if Bake.options.verbose >= 1 && Bake.options.caseSensitivityCheck
56
+ if toSplitted[i].casecmp(fromSplitted[i]) == 0
57
+ if !@@warnedCase.include?(fromSplitted[0..i].join("/"))
58
+ fromsj = fromSplitted[0..i].join("/")
59
+ tosj = toSplitted[0..i].join("/")
60
+ @@warnedCase << fromsj
61
+ @@warnedCase << tosj
62
+ Bake.formatter.printWarning("Warning: different cases for folders \"#{fromsj}\" and \"#{tosj}\" detected.")
63
+ end
64
+ end
65
+ end
66
+ break
67
+ end
68
+ i += 1
69
+ end
70
+ j = i
71
+
72
+ res = []
73
+ while i < fromSplitted.length
74
+ res << ".."
75
+ i += 1
76
+ end
77
+
78
+ while j < toSplitted.length
79
+ res << toSplitted[j]
80
+ j += 1
81
+ end
82
+
83
+ if res.length == 0
84
+ return ""
85
+ end
86
+
87
+ res = res.join('/')
88
+ res += "/" if endWithSlash
89
+ res
90
+ end
91
+
92
+
93
+ def self.add_prefix(prefix, file)
94
+ if not prefix or is_absolute?(file)
95
+ file
96
+ else
97
+ prefix + file
98
+ end
99
+ end
100
+
101
+ def self.which(cmd)
102
+ return "" if not cmd
103
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
104
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
105
+ exts.each { |ext|
106
+ exe = File.join(path, "#{cmd}#{ext}")
107
+ if File.executable?(exe) && !File.directory?(exe)
108
+ return File.dirname(exe.gsub(/[\\]/,'/'))
109
+ end
110
+ }
111
+ end
112
+ return ""
113
+ end
114
+
115
+ 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)
@@ -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(/[\\]/,'/')
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.59.0"
4
+ "2.63.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -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 = {}
@@ -156,6 +165,7 @@ module Bake
156
165
  block.visited = true
157
166
 
158
167
  block.bes = []
168
+ block.besDirect = []
159
169
  block.config.depInc.each do |dep|
160
170
  if (Metamodel::Dependency === dep)
161
171
  @referencedConfigs[dep.name].each do |configRef|
@@ -175,6 +185,7 @@ module Bake
175
185
  block.bes += subDeps
176
186
  end
177
187
  block.bes << dep
188
+ block.besDirect << dep
178
189
  break
179
190
  end
180
191
  end
@@ -230,6 +241,21 @@ module Bake
230
241
  end
231
242
  end
232
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
+ end
258
+
233
259
  def makeIncs
234
260
  Blocks::ALL_BLOCKS.each do |name,block|
235
261
  bes2 = []
@@ -324,17 +350,12 @@ module Bake
324
350
 
325
351
  block.bes.each do |dep|
326
352
  next unless Metamodel::Dependency === dep
327
- if dep.injected?
328
- difr2 = difr.select{|d| Metamodel::IncludeDir === d }
329
- diba2 = diba.select{|d| Metamodel::IncludeDir === d }
330
- else
331
- difr2 = difr
332
- diba2 = diba
333
- end
334
-
353
+ difr2 = difr.select{|d| Metamodel::IncludeDir === d || d != dep}
354
+ diba2 = diba.select{|d| Metamodel::IncludeDir === d || d != dep}
335
355
  fde = Blocks::ALL_BLOCKS[dep.name+","+dep.config]
336
356
  l1 = fde.bes.length
337
- fde.bes = (difr2 + fde.bes + diba2).uniq # .select{|d| !(Metamodel::Dependency===d) || d.name != dep.name || d.config != dep.config }
357
+ fde.bes = (difr2 + fde.bes + diba2).uniq
358
+ fde.besDirect = (difr2 + fde.besDirect + diba2).uniq
338
359
  l2 = fde.bes.length
339
360
  counter += 1 if (l2 != l1)
340
361
  end
@@ -410,13 +431,15 @@ module Bake
410
431
  @referencedConfigs.each do |projName, configs|
411
432
  depsToProj = []
412
433
  configs.each do |config|
413
- config.dependency.each do |d|
434
+ the_c = Blocks::ALL_BLOCKS[config.parent.name+","+config.name]
435
+ the_c.besDirect.each do |d|
436
+ next if Metamodel::IncludeDir === d
414
437
  if onlyProjectName
415
438
  next if config.parent.name != onlyProjectName && d.name != onlyProjectName
416
439
  if onlyConfigName
417
440
  leftSide = config.name == onlyConfigName && config.parent.name == onlyProjectName
418
441
  rightSide = d.config == onlyConfigName && d.name == onlyProjectName
419
- next if not leftSide and not rightSide
442
+ next if !leftSide && !rightSide
420
443
  end
421
444
  end
422
445
  if Bake.options.dotShowProjOnly
@@ -693,6 +716,8 @@ module Bake
693
716
  makeGraph
694
717
  puts "Profiling #{Time.now - $timeStart}: make includes..." if Bake.options.profiling
695
718
  makeIncs
719
+ puts "Profiling #{Time.now - $timeStart}: make dep overview..." if Bake.options.profiling
720
+ makeDepOverview
696
721
  puts "Profiling #{Time.now - $timeStart}: make uniq..." if Bake.options.profiling
697
722
  makeUniq
698
723
  puts "Profiling #{Time.now - $timeStart}: convert to building blocks..." if Bake.options.profiling
@@ -702,7 +727,17 @@ module Bake
702
727
  makeDot
703
728
  end
704
729
 
705
-
730
+ if !Bake.options.cc2j_filename
731
+ if !@mainConfig.cdb.nil?
732
+ Bake.options.cc2j_filename = @mainConfig.cdb.name
733
+ if !File.is_absolute?(Bake.options.cc2j_filename)
734
+ Bake.options.cc2j_filename = File.join(
735
+ File.rel_from_to_project(Dir.pwd, @mainConfig.parent.get_project_dir, false),
736
+ Bake.options.cc2j_filename)
737
+ end
738
+ end
739
+ end
740
+
706
741
  metadata_json = Bake.options.dev_features.detect { |x| x.start_with?("metadata=") }
707
742
  if metadata_json
708
743
  metadata_file = metadata_json[9..-1]
@@ -731,7 +766,7 @@ module Bake
731
766
  puts "File #{metadata_file} written."
732
767
  ExitHelper.exit(0)
733
768
  else
734
- Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig for ExecutableConfig.")
769
+ Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig or ExecutableConfig.")
735
770
  ExitHelper.exit(1)
736
771
  end
737
772
  end
@@ -786,7 +821,14 @@ module Bake
786
821
 
787
822
  if Bake.options.cc2j_filename
788
823
  require "json"
789
- File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
824
+ begin
825
+ Bake.formatter.printInfo("Info: writing compilation database #{Bake.options.cc2j_filename}") if Bake.options.verbose >= 1
826
+ File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
827
+ rescue Exception => ex
828
+ Bake.formatter.printError("Error: could not write compilation database: #{ex.message}")
829
+ puts ex.backtrace if Bake.options.debug
830
+ result = false
831
+ end
790
832
  end
791
833
 
792
834
  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.59.0
4
+ version: 2.63.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: 2020-03-06 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext