bake-toolkit 2.60.0 → 2.63.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a05f5baab5566671c4deff626aceaea52a9b0d4274c03f9737823b3809039bb2
4
- data.tar.gz: d407fbc0d01b0fded6b7453ac41446494725cfc575bfd472a77c2d4096738a82
3
+ metadata.gz: e7152626f57d1a24d3b46ec135225ec6d29290ed0fe7285eccf66140a068f15c
4
+ data.tar.gz: e250d345fc671c0162945a86553cdd0f1d5fac111bfb872ecf6416e7b1c17c05
5
5
  SHA512:
6
- metadata.gz: 7dc782d118b9fefd102ad6948dc4bfeb38ac7ac0cffcca4581719e994ad69927271523bd1a46472ed92573769754ca44af9c655c139e3ae4fa96a1887bd18862
7
- data.tar.gz: e89c99ee42fd0602c6cdcc443ae3924b12af3a7e84ffe308486137ba1a77921bedd991d33a41fcf5e18681c932cda416a5388a9537a1bcae20785cbcc33351ff
6
+ metadata.gz: 60e71bfaf09f2f55520a4e5be68d55ab0aa1111b0220c526ff6576e65a1a0b3bbd5ed17df608465d18d97d2599aeaaecd390515ebc59520b4c23556556039b08
7
+ data.tar.gz: c9231ab7d566c1863d4c2dd7ed9d8e686967e55a43235673e0bb14e4a795ea0e906296e3ec4c8c8ea6bb3b4aa92c023f7371fb2225109cc353322d34dab9ce70
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
@@ -35,7 +35,7 @@ module Bake
35
35
  projs << root.dir + "/Project.meta"
36
36
  end
37
37
  if projs.length == 0
38
- toBuildPattern << BuildPattern.new(nil, nil, p.args, p) # remember it for sorted info printout
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*)")+"$"
@@ -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
- # prioo 3: check if dir exists without Project.meta entry
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 !allSteps.empty?
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
- return true if (@visited)
408
- @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
409
430
 
410
431
  @inDeps = true
411
- depResult = callDeps(:execute)
432
+ begin
433
+ depResult = callDeps(:execute)
434
+ rescue Exception => e
435
+ @allSteps = []
436
+ raise
437
+ end
438
+
412
439
  @inDeps = false
413
- return @result && depResult if blockAbort?(depResult)
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
 
@@ -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.60.0"
4
+ "2.63.1"
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 = {}
@@ -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 = []
@@ -326,16 +351,11 @@ module Bake
326
351
 
327
352
  block.bes.each do |dep|
328
353
  next unless Metamodel::Dependency === dep
329
- if dep.injected?
330
- difr2 = difr.select{|d| Metamodel::IncludeDir === d }
331
- diba2 = diba.select{|d| Metamodel::IncludeDir === d }
332
- else
333
- difr2 = difr
334
- diba2 = diba
335
- end
354
+ difr2 = difr.select{|d| Metamodel::IncludeDir === d || d != dep}
355
+ diba2 = diba.select{|d| Metamodel::IncludeDir === d || d != dep}
336
356
  fde = Blocks::ALL_BLOCKS[dep.name+","+dep.config]
337
357
  l1 = fde.bes.length
338
- fde.bes = (difr2 + fde.bes + diba2).uniq # .select{|d| !(Metamodel::Dependency===d) || d.name != dep.name || d.config != dep.config }
358
+ fde.bes = (difr2 + fde.bes + diba2).uniq
339
359
  fde.besDirect = (difr2 + fde.besDirect + diba2).uniq
340
360
  l2 = fde.bes.length
341
361
  counter += 1 if (l2 != l1)
@@ -697,6 +717,8 @@ module Bake
697
717
  makeGraph
698
718
  puts "Profiling #{Time.now - $timeStart}: make includes..." if Bake.options.profiling
699
719
  makeIncs
720
+ puts "Profiling #{Time.now - $timeStart}: make dep overview..." if Bake.options.profiling
721
+ makeDepOverview
700
722
  puts "Profiling #{Time.now - $timeStart}: make uniq..." if Bake.options.profiling
701
723
  makeUniq
702
724
  puts "Profiling #{Time.now - $timeStart}: convert to building blocks..." if Bake.options.profiling
@@ -706,7 +728,17 @@ module Bake
706
728
  makeDot
707
729
  end
708
730
 
709
-
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
+
710
742
  metadata_json = Bake.options.dev_features.detect { |x| x.start_with?("metadata=") }
711
743
  if metadata_json
712
744
  metadata_file = metadata_json[9..-1]
@@ -735,7 +767,7 @@ module Bake
735
767
  puts "File #{metadata_file} written."
736
768
  ExitHelper.exit(0)
737
769
  else
738
- Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig for ExecutableConfig.")
770
+ Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig or ExecutableConfig.")
739
771
  ExitHelper.exit(1)
740
772
  end
741
773
  end
@@ -790,7 +822,14 @@ module Bake
790
822
 
791
823
  if Bake.options.cc2j_filename
792
824
  require "json"
793
- File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
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
794
833
  end
795
834
 
796
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.60.0
4
+ version: 2.63.1
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-17 00:00:00.000000000 Z
11
+ date: 2020-06-17 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.2.1
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.2.1
124
+ version: 12.3.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement