bake-toolkit 2.62.0 → 2.64.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: b32e4c31cf5d36f26b6f3287b4c31ec250b5f6ad49118d9b8823351fcccc7a63
4
- data.tar.gz: d83e5c807aaa312b9ada14d0f330cf5b0177a7e78489ebd038f32c49c08caaf8
3
+ metadata.gz: dd55725b65ac6296092196df2fe85d8dead231341649db552cac76415643ba54
4
+ data.tar.gz: c8fc064f5c929e3968218bde7aee9b2548ee00bfcc9d55bc762f0e1ab917f0da
5
5
  SHA512:
6
- metadata.gz: f3fcbdebee31ec340a3967c11df66e905355551d7a32daa2646573c1e1b004bfcb5aab944bda38fe36bf04fe15b7c91d91948dc4822beb972b7503af72d2f092
7
- data.tar.gz: 5981dcc38b1dd5f0001b0fd4218d247499a9ae840619ed851a22f61ba940f0db3e1e840491c393079910f207262b9ceab6464403c9ae8b41aff4599ffb7ea0ee
6
+ metadata.gz: 8cad40c4ee60207533b867a29b53fb6efa8e0d5d12d1f9d929535fe5a682bc08a585ea0c64b5af3b3bcdcb80b920b3a924c460a2441ab33e1edda790bccd5b70
7
+ data.tar.gz: 577f622dc1d27c4abfa72b0ec484ffe2054f4bc75e67ae1afb4e48c598447d928ec463e6bd4cf3126fed0e9eeee743436852f1741cd54e7fa1d7809670256ccc
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
 
@@ -1,4 +1,5 @@
1
1
  require_relative '../../bake/model/loader'
2
+ require_relative '../../bake/config/loader'
2
3
  require_relative '../../bake/config/checks'
3
4
 
4
5
  module Bake
@@ -24,6 +25,10 @@ module Bake
24
25
  ExitHelper.exit(1)
25
26
  end
26
27
 
28
+ f.root_elements.each do |a|
29
+ Bake::Config::checkVer(a.requiredBakeVersion)
30
+ end
31
+
27
32
  configs = []
28
33
  f.root_elements.each { |re| configs.concat(re.getConfig) }
29
34
  AdaptConfig::checkSyntax(configs, filename)
@@ -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.delete(@cacheFilename)
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
 
@@ -103,6 +103,10 @@ module Bake
103
103
  Bake.formatter.printError("IncludeDir must have inject OR infix (deprecated)", inc)
104
104
  ExitHelper.exit(1)
105
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
106
110
  end if config.respond_to?("includeDir")
107
111
 
108
112
  if not ["", "yes", "no", "all"].include?config.mergeInc
@@ -161,7 +161,7 @@ module Bake
161
161
  [config, configname]
162
162
  end
163
163
 
164
- def checkVerFormat(ver)
164
+ def self.checkVerFormat(ver)
165
165
  return true if ver.empty?
166
166
  return false if ver.length > 3
167
167
  ver.each do |v|
@@ -170,7 +170,7 @@ module Bake
170
170
  true
171
171
  end
172
172
 
173
- def bailOutVer(reqVersion)
173
+ def self.bailOutVer(reqVersion)
174
174
  text1 = (reqVersion.minimum.empty? ? "" : "minimum = #{reqVersion.minimum}")
175
175
  text2 = ((reqVersion.minimum.empty? or reqVersion.maximum.empty?) ? "" : ", ")
176
176
  text3 = (reqVersion.maximum.empty? ? "" : "maximum = #{reqVersion.maximum}")
@@ -178,7 +178,7 @@ module Bake
178
178
  ExitHelper.exit(1)
179
179
  end
180
180
 
181
- def checkVer(reqVersion)
181
+ def self.checkVer(reqVersion)
182
182
  return if reqVersion.nil?
183
183
  min = reqVersion.minimum.split(".")
184
184
  max = reqVersion.maximum.split(".")
@@ -217,7 +217,7 @@ module Bake
217
217
  proj = projRoots[0]
218
218
 
219
219
  reqVersion = proj.getRequiredBakeVersion
220
- checkVer(reqVersion)
220
+ Bake::Config::checkVer(reqVersion)
221
221
 
222
222
  configs = proj.getConfig
223
223
  Bake::Configs::Checks::commonMetamodelCheck(configs, filename)
@@ -236,6 +236,7 @@ module Bake
236
236
  adaptRoots = f.root_elements.select { |re| Metamodel::Adapt === re }
237
237
  if adaptRoots.length > 0
238
238
  adaptRoots.each do |adapt|
239
+ Bake::Config::checkVer(adapt.requiredBakeVersion)
239
240
  adapt.mainProject = @mainProjectName if adapt.mainProject == "__THIS__"
240
241
  adaptConfigs = adapt.getConfig
241
242
  AdaptConfig.checkSyntax(adaptConfigs, filename, true)
@@ -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)
@@ -9,6 +9,7 @@ require 'rgen/util/file_cache_map'
9
9
 
10
10
  require 'rtext/default_loader'
11
11
 
12
+ require_relative '../../common/ext/rgen'
12
13
  require_relative '../../common/exit_helper'
13
14
  require_relative '../toolchain/colorizing_formatter'
14
15
  require_relative '../options/options'
@@ -147,6 +147,7 @@ module Bake
147
147
  class Files < ModelElement
148
148
  has_attr 'name', String, :defaultValueLiteral => ""
149
149
  has_attr 'compileOnly', Boolean, :defaultValueLiteral => "false"
150
+ has_attr 'linkDirectly', Boolean, :defaultValueLiteral => "false"
150
151
  contains_many 'define', Define, 'parent'
151
152
  contains_many 'flags', Flags, 'parent'
152
153
  end
@@ -283,6 +284,12 @@ module Bake
283
284
  has_attr 'env', Boolean, :defaultValueLiteral => "false"
284
285
  end
285
286
 
287
+ class CompilationCheck < ModelElement
288
+ has_attr 'exclude', String, :defaultValueLiteral => ""
289
+ has_attr 'include', String, :defaultValueLiteral => ""
290
+ has_attr 'ignore', String, :defaultValueLiteral => ""
291
+ end
292
+
286
293
  class BaseConfig_INTERNAL < ModelElement
287
294
  has_attr 'name', String, :defaultValueLiteral => ""
288
295
  has_attr 'extends', String, :defaultValueLiteral => ""
@@ -304,6 +311,7 @@ module Bake
304
311
  contains_many 'set', Set, 'parent'
305
312
  contains_many 'prebuild', Prebuild, 'parent'
306
313
  contains_one 'cdb', CompilationDB, 'parent'
314
+ contains_many 'compilationCheck', CompilationCheck, 'parent'
307
315
 
308
316
  module ClassModule
309
317
  def ident
@@ -355,6 +363,7 @@ module Bake
355
363
  has_attr 'mainConfig', String, :defaultValueLiteral => ""
356
364
  contains_many 'config', BaseConfig_INTERNAL, 'parent'
357
365
  contains_many 'scopes', Scope, 'parent'
366
+ contains_one 'requiredBakeVersion', RequiredBakeVersion, 'parent'
358
367
  end
359
368
 
360
369
  class If < Adapt
@@ -11,13 +11,6 @@ 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
15
  attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :showConfigs, :cc2j_filename
23
16
  attr_reader :main_dir, :working_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :dotFilename # String
@@ -368,6 +361,10 @@ module Bake
368
361
  end
369
362
 
370
363
  def set_verbose(num)
364
+ if num.nil?
365
+ Bake.formatter.printError("Error: verbose must be between 0 and 3")
366
+ ExitHelper.exit(1)
367
+ end
371
368
  checkNum(num)
372
369
  @verbose = String === num ? num.to_i : num
373
370
  if @verbose < 0 || verbose > 3
@@ -393,6 +390,14 @@ module Bake
393
390
 
394
391
  end
395
392
 
393
+ def self.options
394
+ @@options ||= Options.new([])
395
+ end
396
+
397
+ def self.options=(options)
398
+ @@options = options
399
+ end
400
+
396
401
  end
397
402
 
398
403
 
@@ -7,6 +7,7 @@ require 'rgen/fragment/fragmented_model'
7
7
 
8
8
  require 'rtext/default_loader'
9
9
 
10
+ require_relative '../../common/ext/rgen'
10
11
  require_relative '../../common/exit_helper'
11
12
  require_relative '../../bake/toolchain/colorizing_formatter'
12
13
 
@@ -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
 
@@ -7,47 +7,52 @@ require_relative '../common/utils'
7
7
  require_relative '../bake/toolchain/colorizing_formatter'
8
8
  require_relative '../bake/config/loader'
9
9
 
10
-
11
10
  begin
12
- require 'Win32API'
11
+ module Kernel32
12
+ require 'fiddle'
13
+ require 'fiddle/import'
14
+ require 'fiddle/types'
15
+ extend Fiddle::Importer
16
+ dlload 'kernel32'
17
+ include Fiddle::Win32Types
18
+ extern 'DWORD GetLongPathName(LPCSTR, LPSTR, DWORD)'
19
+ extern 'DWORD GetShortPathName(LPCSTR, LPSTR, DWORD)'
20
+ end
13
21
 
14
- def longname short_name
15
- max_path = 1024
16
- long_name = " " * max_path
17
- lfn_size = Win32API.new("kernel32", "GetLongPathName", ['P','P','L'],'L').call(short_name, long_name, max_path)
18
- return long_name[0..lfn_size-1]
19
- end
22
+ def longname short_name
23
+ max_path = 1024
24
+ long_name = " " * max_path
25
+ lfn_size = Kernel32.GetLongPathName(short_name, long_name, max_path)
26
+ return long_name[0..lfn_size-1]
27
+ end
20
28
 
21
- def shortname long_name
22
- max_path = 1024
23
- short_name = " " * max_path
24
- lfn_size = Win32API.new("kernel32", "GetShortPathName", ['P','P','L'],'L').call(long_name, short_name, max_path)
25
- return short_name[0..lfn_size-1]
26
- end
29
+ def shortname long_name
30
+ max_path = 1024
31
+ short_name = " " * max_path
32
+ lfn_size = Kernel32.GetShortPathName(long_name, short_name, max_path)
33
+ return short_name[0..lfn_size-1]
34
+ end
27
35
 
28
- def realname file
29
- longname(shortname(file))
30
- end
36
+ def realname file
37
+ x = longname(shortname(file))
38
+ end
31
39
 
32
- rescue LoadError
40
+ rescue Fiddle::DLError
33
41
 
34
- def realname file
42
+ def realname file
35
43
  file
36
- end
44
+ end
37
45
 
38
46
  end
39
47
 
40
48
 
41
-
42
-
43
-
44
49
  module Bake
45
50
 
46
51
  module Blocks
47
52
 
48
53
  class Compile < BlockBase
49
54
 
50
- attr_reader :objects, :include_list, :source_files_ignored_in_lib
55
+ attr_reader :objects, :source_files, :source_files_compiled, :include_list, :source_files_ignored_in_lib, :object_files_ignored_in_lib
51
56
 
52
57
  def mutex
53
58
  @mutex ||= Mutex.new
@@ -421,6 +426,7 @@ module Bake
421
426
  Utils.gitIgnore(odir) if !Bake.options.dry
422
427
 
423
428
  fileListBlock = Set.new if Bake.options.filelist
429
+ @source_files_compiled = @source_files.dup
424
430
  compileJobs = Multithread::Jobs.new(@source_files) do |jobs|
425
431
  while source = jobs.get_next_or_nil do
426
432
 
@@ -513,6 +519,7 @@ module Bake
513
519
  end
514
520
 
515
521
  def calcObjects
522
+ @object_files_ignored_in_lib = []
516
523
  @source_files.each do |source|
517
524
  type = get_source_type(source)
518
525
  if not type.nil?
@@ -526,15 +533,22 @@ module Bake
526
533
  end
527
534
  end
528
535
  @object_files[source] = object
529
- @objects << object unless @source_files_ignored_in_lib.include?(source)
536
+ if @source_files_ignored_in_lib.include?(source)
537
+ if @source_files_link_directly.include?(source)
538
+ @object_files_ignored_in_lib << object
539
+ end
540
+ else
541
+ @objects << object
542
+ end
530
543
  end
531
544
  end
532
545
  end
533
546
 
534
547
  def calcSources(cleaning = false, keep = false)
535
- return @source_files if @source_files and not @source_files.empty?
548
+ return @source_files if @source_files && !@source_files.empty?
536
549
  @source_files = []
537
550
  @source_files_ignored_in_lib = []
551
+ @source_files_link_directly = []
538
552
  @fileTcs = {}
539
553
 
540
554
  exclude_files = Set.new
@@ -564,11 +578,17 @@ module Bake
564
578
  if ((!@fileTcs.has_key?(f)) || singleFile)
565
579
  @fileTcs[f] = icf
566
580
  end
567
- next if exclude_files.include?(f)
568
- next if source_files.include?(f)
581
+ if source_files.include?(f) || exclude_files.include?(f)
582
+ if (singleFile)
583
+ @source_files_ignored_in_lib << f if sources.compileOnly || sources.linkDirectly
584
+ @source_files_link_directly << f if sources.linkDirectly
585
+ end
586
+ next
587
+ end
569
588
  source_files << f
570
589
  @source_files << f
571
- @source_files_ignored_in_lib << f if sources.compileOnly
590
+ @source_files_ignored_in_lib << f if sources.compileOnly || sources.linkDirectly
591
+ @source_files_link_directly << f if sources.linkDirectly
572
592
  end
573
593
  end
574
594
 
@@ -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
@@ -12,7 +12,7 @@ module Bake
12
12
  Blocks::Block.reset_block_counter
13
13
  Blocks::Block.reset_delayed_result
14
14
  Configs::Checks.cleanupWarnings
15
-
15
+ ToCxx::reset_include_deps
16
16
  end
17
17
 
18
18
  end
@@ -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
@@ -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
- if !File.exist?(gitignore)
11
- File.write(gitignore, ".\n")
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
 
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.62.0"
4
+ "2.64.1"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -36,6 +36,7 @@ require_relative 'common/abortException'
36
36
 
37
37
  require_relative 'adapt/config/loader'
38
38
  require "thwait"
39
+ require 'pathname'
39
40
 
40
41
  module Bake
41
42
 
@@ -45,10 +46,19 @@ module Bake
45
46
  class ToCxx
46
47
 
47
48
  @@linkBlock = 0
49
+ @@include_deps = {}
48
50
 
49
51
  def self.linkBlock
50
52
  @@linkBlock = 1
51
53
  end
54
+
55
+ def self.include_deps
56
+ @@include_deps
57
+ end
58
+
59
+ def self.reset_include_deps
60
+ @@include_deps = {}
61
+ end
52
62
 
53
63
  def initialize
54
64
  @configTcMap = {}
@@ -232,6 +242,22 @@ module Bake
232
242
  end
233
243
  end
234
244
 
245
+ def makeDepOverview
246
+ return if !Bake.options.dev_features.any? {|feature| feature.start_with?("dep-overview=") }
247
+ Blocks::ALL_BLOCKS.each do |name,block|
248
+ block.bes.each do |depInc|
249
+ @@include_deps[block.projectDir] = Set.new if !@@include_deps.has_key?(block.projectDir)
250
+ if (Metamodel::Dependency === depInc)
251
+ c = @referencedConfigs[depInc.name].detect { |configRef| configRef.name == depInc.config }
252
+ @@include_deps[block.projectDir] << Blocks::ALL_BLOCKS[c.qname].projectDir
253
+ else
254
+ @@include_deps[block.projectDir] << depInc.name
255
+ end
256
+ end
257
+ end
258
+ ExitHelper.exit(0)
259
+ end
260
+
235
261
  def makeIncs
236
262
  Blocks::ALL_BLOCKS.each do |name,block|
237
263
  bes2 = []
@@ -692,6 +718,8 @@ module Bake
692
718
  makeGraph
693
719
  puts "Profiling #{Time.now - $timeStart}: make includes..." if Bake.options.profiling
694
720
  makeIncs
721
+ puts "Profiling #{Time.now - $timeStart}: make dep overview..." if Bake.options.profiling
722
+ makeDepOverview
695
723
  puts "Profiling #{Time.now - $timeStart}: make uniq..." if Bake.options.profiling
696
724
  makeUniq
697
725
  puts "Profiling #{Time.now - $timeStart}: convert to building blocks..." if Bake.options.profiling
@@ -825,6 +853,84 @@ module Bake
825
853
  if Bake.options.linkOnly and @@linkBlock == 0
826
854
  Bake.formatter.printSuccess("\nNothing to link.")
827
855
  else
856
+ # CompilationCheck
857
+ if !Bake.options.project &&
858
+ !Bake.options.filename &&
859
+ !Bake.options.linkOnly &&
860
+ !Bake.options.prepro &&
861
+ !Bake.options.compileOnly &&
862
+ !Bake.options.clean
863
+
864
+ ccChecks = []
865
+ ccIncludes = Set.new
866
+ ccExcludes = Set.new
867
+ ccIgnores = Set.new
868
+ @referencedConfigs.each do |projName, configs|
869
+ configs.compilationCheck.each do |cc|
870
+ ccChecks << cc
871
+ end
872
+ end
873
+ ccChecks.each do |cc|
874
+ Dir.chdir(cc.parent.parent.get_project_dir) do
875
+ Dir.glob(cc.include).select {|f| File.file?(f)}.each {|f| ccIncludes << File.expand_path(f)}
876
+ Dir.glob(cc.exclude).select {|f| File.file?(f)}.each {|f| ccExcludes << File.expand_path(f)}
877
+ Dir.glob(cc.ignore). select {|f| File.file?(f)}.each {|f| ccIgnores << File.expand_path(f)}
878
+ end
879
+ end
880
+ ccIncludes -= ccIgnores
881
+ ccExcludes -= ccIgnores
882
+ ccIncludes -= ccExcludes
883
+
884
+ if !ccIncludes.empty? || !ccExcludes.empty?
885
+ inCompilation = Set.new
886
+ Blocks::ALL_BLOCKS.each do |name,block|
887
+ block.mainSteps.each do |b|
888
+ if Blocks::Compile === b && !b.source_files_compiled.nil?
889
+ b.source_files_compiled.each do |s|
890
+ inCompilation << File.expand_path(s, b.projectDir)
891
+ type = b.get_source_type(s)
892
+ if type != :ASM
893
+ b.objects.each do |o|
894
+ dep_filename = b.calcDepFile(o, type)
895
+ dep_filename_conv = b.calcDepFileConv(dep_filename)
896
+ File.readlines(File.expand_path(dep_filename_conv, b.projectDir)).map{|line| line.strip}.each do |dep|
897
+ header = File.expand_path(dep, b.projectDir)
898
+ if File.exist?(header)
899
+ inCompilation << header
900
+ end
901
+ end
902
+ end
903
+ end
904
+ end
905
+ end
906
+ end
907
+ end
908
+ pnPwd = Pathname.new(Dir.pwd)
909
+ ccNotIncluded = (ccIncludes - inCompilation).to_a
910
+ ccNotExcluded = inCompilation.select {|i| ccExcludes.include?(i) }
911
+ ccNotIncluded.each do |cc|
912
+ cc = Pathname.new(cc).relative_path_from(pnPwd)
913
+ Bake.formatter.printWarning("Warning: file not included in build: #{cc}")
914
+ end
915
+ ccNotExcluded.each do |cc|
916
+ cc = Pathname.new(cc).relative_path_from(pnPwd)
917
+ Bake.formatter.printWarning("Warning: file not excluded from build: #{cc}")
918
+ end
919
+
920
+ if Bake.options.verbose >= 3
921
+ if ccNotIncluded.empty? && ccNotExcluded.empty?
922
+ Bake.formatter.printInfo("Info: CompilationCheck passed")
923
+ end
924
+ end
925
+
926
+ elsif !ccChecks.empty?
927
+ if Bake.options.verbose >= 3
928
+ Bake.formatter.printInfo("Info: CompilationCheck passed")
929
+ end
930
+ end
931
+ end
932
+
933
+
828
934
  Bake.formatter.printSuccess("\n#{taskType} done.")
829
935
  end
830
936
  end
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.62.0
4
+ version: 2.64.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-05-14 00:00:00.000000000 Z
11
+ date: 2020-07-24 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
@@ -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