bake-toolkit 2.62.0 → 2.63.0

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: 225fc376c9b3409d01e708f2ec67bb2d80f9c081d26de339d5b4bb3451141e50
4
+ data.tar.gz: e3769b3550aee5ae45685d8445b0ea3bfec59eea4ffa885900a461c82269b16b
5
5
  SHA512:
6
- metadata.gz: f3fcbdebee31ec340a3967c11df66e905355551d7a32daa2646573c1e1b004bfcb5aab944bda38fe36bf04fe15b7c91d91948dc4822beb972b7503af72d2f092
7
- data.tar.gz: 5981dcc38b1dd5f0001b0fd4218d247499a9ae840619ed851a22f61ba940f0db3e1e840491c393079910f207262b9ceab6464403c9ae8b41aff4599ffb7ea0ee
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
 
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -393,6 +386,14 @@ module Bake
393
386
 
394
387
  end
395
388
 
389
+ def self.options
390
+ @@options ||= Options.new([])
391
+ end
392
+
393
+ def self.options=(options)
394
+ @@options = options
395
+ end
396
+
396
397
  end
397
398
 
398
399
 
@@ -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
 
@@ -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
@@ -513,6 +513,7 @@ module Bake
513
513
  end
514
514
 
515
515
  def calcObjects
516
+ @object_files_ignored_in_lib = []
516
517
  @source_files.each do |source|
517
518
  type = get_source_type(source)
518
519
  if not type.nil?
@@ -526,7 +527,13 @@ module Bake
526
527
  end
527
528
  end
528
529
  @object_files[source] = object
529
- @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
530
537
  end
531
538
  end
532
539
  end
@@ -535,6 +542,7 @@ module Bake
535
542
  return @source_files if @source_files and not @source_files.empty?
536
543
  @source_files = []
537
544
  @source_files_ignored_in_lib = []
545
+ @source_files_link_directly = []
538
546
  @fileTcs = {}
539
547
 
540
548
  exclude_files = Set.new
@@ -564,11 +572,17 @@ module Bake
564
572
  if ((!@fileTcs.has_key?(f)) || singleFile)
565
573
  @fileTcs[f] = icf
566
574
  end
567
- next if exclude_files.include?(f)
568
- 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
569
582
  source_files << f
570
583
  @source_files << f
571
- @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
572
586
  end
573
587
  end
574
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
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.62.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 = {}
@@ -232,6 +241,21 @@ 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
+ end
258
+
235
259
  def makeIncs
236
260
  Blocks::ALL_BLOCKS.each do |name,block|
237
261
  bes2 = []
@@ -692,6 +716,8 @@ module Bake
692
716
  makeGraph
693
717
  puts "Profiling #{Time.now - $timeStart}: make includes..." if Bake.options.profiling
694
718
  makeIncs
719
+ puts "Profiling #{Time.now - $timeStart}: make dep overview..." if Bake.options.profiling
720
+ makeDepOverview
695
721
  puts "Profiling #{Time.now - $timeStart}: make uniq..." if Bake.options.profiling
696
722
  makeUniq
697
723
  puts "Profiling #{Time.now - $timeStart}: convert to building blocks..." if Bake.options.profiling
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.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-05-14 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