bake-toolkit 2.46.0 → 2.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bake +46 -46
  3. data/bin/bake-doc +1 -1
  4. data/bin/bake-format +1 -1
  5. data/bin/bakeclean +1 -1
  6. data/bin/bakeqac +9 -9
  7. data/bin/bakery +11 -11
  8. data/lib/adapt/config/loader.rb +2 -2
  9. data/lib/bake/cache.rb +5 -5
  10. data/lib/bake/config/loader.rb +3 -3
  11. data/lib/bake/mergeConfig.rb +1 -1
  12. data/lib/bake/model/language.rb +1 -4
  13. data/lib/bake/model/loader.rb +6 -6
  14. data/lib/bake/model/metamodel.rb +21 -0
  15. data/lib/bake/model/metamodel_ext.rb +2 -2
  16. data/lib/bake/options/create.rb +1 -1
  17. data/lib/bake/options/options.rb +24 -16
  18. data/lib/bake/options/showDoc.rb +1 -1
  19. data/lib/bake/options/usage.rb +3 -1
  20. data/lib/bake/subst.rb +14 -13
  21. data/lib/bake/toolchain/clang.rb +5 -5
  22. data/lib/bake/toolchain/clang_analyze.rb +2 -2
  23. data/lib/bake/toolchain/diab.rb +4 -4
  24. data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +1 -1
  25. data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +1 -1
  26. data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +1 -1
  27. data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +1 -1
  28. data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +1 -1
  29. data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +1 -1
  30. data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +1 -1
  31. data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +1 -1
  32. data/lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb +1 -1
  33. data/lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb +1 -1
  34. data/lib/bake/toolchain/errorparser/tasking_compiler_error_parser.rb +1 -1
  35. data/lib/bake/toolchain/errorparser/tasking_linker_error_parser.rb +1 -1
  36. data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +1 -1
  37. data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +1 -1
  38. data/lib/bake/toolchain/gcc.rb +9 -5
  39. data/lib/bake/toolchain/gcc_env.rb +5 -5
  40. data/lib/bake/toolchain/greenhills.rb +4 -4
  41. data/lib/bake/toolchain/keil.rb +5 -5
  42. data/lib/bake/toolchain/msvc.rb +5 -5
  43. data/lib/bake/toolchain/provider.rb +10 -10
  44. data/lib/bake/toolchain/tasking.rb +4 -4
  45. data/lib/bake/toolchain/ti.rb +5 -5
  46. data/lib/bake/util.rb +5 -6
  47. data/lib/bakeclean/options/options.rb +2 -2
  48. data/lib/bakeqac/options/options.rb +4 -4
  49. data/lib/bakery/model/language.rb +1 -1
  50. data/lib/bakery/model/loader.rb +5 -5
  51. data/lib/bakery/options/options.rb +4 -4
  52. data/lib/bakery/toBake.rb +1 -1
  53. data/lib/blocks/block.rb +4 -4
  54. data/lib/blocks/blockBase.rb +0 -11
  55. data/lib/blocks/commandLine.rb +2 -2
  56. data/lib/blocks/compile.rb +69 -29
  57. data/lib/blocks/convert.rb +1 -1
  58. data/lib/blocks/docu.rb +1 -1
  59. data/lib/blocks/executable.rb +1 -1
  60. data/lib/blocks/fileutil.rb +62 -0
  61. data/lib/blocks/library.rb +1 -1
  62. data/lib/blocks/makefile.rb +1 -1
  63. data/lib/blocks/showIncludes.rb +4 -4
  64. data/lib/blocks/sleep.rb +41 -0
  65. data/lib/common/cleanup.rb +1 -1
  66. data/lib/common/crc32.rb +1 -1
  67. data/lib/common/ext/file.rb +1 -1
  68. data/lib/common/ext/stdout.rb +1 -1
  69. data/lib/common/ide_interface.rb +2 -2
  70. data/lib/common/options/parser.rb +2 -2
  71. data/lib/common/version.rb +1 -1
  72. data/lib/multithread/job.rb +1 -1
  73. data/lib/tocxx.rb +124 -102
  74. metadata +5 -6
  75. data/bin/createVSProjects +0 -214
  76. data/lib/vs/options.rb +0 -69
@@ -1,4 +1,4 @@
1
- require 'blocks/has_execute_command'
1
+ require_relative 'has_execute_command'
2
2
 
3
3
  module Bake
4
4
  module Blocks
@@ -6,7 +6,7 @@ module Bake
6
6
  class CommandLine
7
7
  include HasExecuteCommand
8
8
 
9
- def initialize(config, referencedConfigs)
9
+ def initialize(config)
10
10
  @config = config # Bake::Metamodel::CommandLine
11
11
  @commandLine = config.name
12
12
  @projectDir = config.get_project_dir
@@ -1,11 +1,11 @@
1
- require 'blocks/blockBase'
1
+ require_relative 'blockBase'
2
2
 
3
- require 'multithread/job'
4
- require 'common/process'
5
- require 'common/ext/dir'
6
- require 'common/utils'
7
- require 'bake/toolchain/colorizing_formatter'
8
- require 'bake/config/loader'
3
+ require_relative '../multithread/job'
4
+ require_relative '../common/process'
5
+ require_relative '../common/ext/dir'
6
+ require_relative '../common/utils'
7
+ require_relative '../bake/toolchain/colorizing_formatter'
8
+ require_relative '../bake/config/loader'
9
9
 
10
10
 
11
11
  begin
@@ -254,14 +254,70 @@ module Bake
254
254
 
255
255
  success = true
256
256
  consoleOutput = ""
257
- success, consoleOutput = ProcessHelper.run(cmd, false, false, nil, [0], @projectDir) if !Bake.options.dry
258
- incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], nil, reason, success)
257
+ incList = nil
258
+ if !Bake.options.diabCaseCheck
259
+ success, consoleOutput = ProcessHelper.run(cmd, false, false, nil, [0], @projectDir) if !Bake.options.dry
260
+ incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], nil, reason, success)
261
+ end
262
+
259
263
  if type != :ASM and not Bake.options.analyze and not Bake.options.prepro
260
264
  Dir.mutex.synchronize do
261
- Dir.chdir(@projectDir) do
262
- incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
263
- Compile.write_depfile(source, incList, dep_filename_conv, @projectDir)
265
+ if !Bake.options.diabCaseCheck
266
+ Dir.chdir(@projectDir) do
267
+ incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
268
+ Compile.write_depfile(source, incList, dep_filename_conv, @projectDir)
269
+ end
264
270
  end
271
+ if !Bake.options.dry && Bake.options.caseSensitivityCheck
272
+ wrongCase = []
273
+
274
+ if compiler[:COMMAND] == "dcc"
275
+ if Bake.options.diabCaseCheck
276
+ pos = cmd.find_index(compiler[:OBJECT_FILE_FLAG])
277
+ preProCmd = (cmd[0..pos-1] + cmd[pos+2..-1] + ["-E"])
278
+ success, consoleOutput = ProcessHelper.run(preProCmd, false, false, nil, [0], @projectDir)
279
+ if !success
280
+ Bake.formatter.printError("Error: could not compile #{source}")
281
+ raise SystemCommandFailed.new
282
+ end
283
+ Dir.chdir(@projectDir) do
284
+ incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE])
285
+ Compile.write_depfile(source, incList, dep_filename_conv, @projectDir)
286
+ end
287
+ ergs = consoleOutput.scan(/# \d+ "([^"]+)" \d+/)
288
+ ergs.each do |f|
289
+ next if source.include?f[0]
290
+ next if f[0].length>=2 && f[0][1] == ":"
291
+ filenameToCheck = f[0].gsub(/\\/,"/").gsub(/\/\//,"/").gsub(/\A\.\//,"")
292
+ if incList.none?{|i| i.include?(filenameToCheck) }
293
+ Dir.chdir(@projectDir) do
294
+ wrongCase << [filenameToCheck, realname(filenameToCheck)]
295
+ end
296
+ end
297
+ end
298
+ end
299
+ else # not diab
300
+ Dir.chdir(@projectDir) do
301
+ incList.each do |dep|
302
+ if dep.length<2 || dep[1] != ":"
303
+ real = realname(dep)
304
+ if dep != real && dep.upcase == real.upcase
305
+ wrongCase << [dep, real]
306
+ end
307
+ end
308
+ end unless incList.nil?
309
+ end
310
+ end
311
+
312
+ if wrongCase.length > 0
313
+ wrongCase.each do |c|
314
+ Bake.formatter.printError("Case sensitivity error in #{source}:\n included: #{c[0]}\n realname: #{c[1]}")
315
+ end
316
+ FileUtils.rm_f(dep_filename_conv)
317
+ raise SystemCommandFailed.new
318
+ end
319
+ end
320
+
265
321
  end
266
322
 
267
323
  incList.each do |h|
@@ -316,32 +372,16 @@ module Bake
316
372
  # todo: move to toolchain util file
317
373
  def self.write_depfile(source, deps, dep_filename_conv, projDir)
318
374
  if deps && !Bake.options.dry
319
- wrongCase = false
320
375
  begin
321
376
  File.open(dep_filename_conv, 'wb') do |f|
322
377
  deps.each do |dep|
323
378
  f.puts(dep)
324
-
325
- if (Bake.options.caseSensitivityCheck)
326
- if dep.length<2 || dep[1] != ":"
327
- real = realname(dep)
328
- if dep != real && dep.upcase == real.upcase
329
- Bake.formatter.printError("Case sensitivity error in #{source}:\n included: #{dep}\n realname: #{real}")
330
- wrongCase = true
331
- end
332
- end
333
- end
334
-
335
379
  end
336
380
  end
337
381
  rescue Exception
338
382
  Bake.formatter.printWarning("Could not write '#{dep_filename_conv}'", projDir)
339
383
  return nil
340
384
  end
341
- if wrongCase
342
- FileUtils.rm_f(dep_filename_conv)
343
- raise SystemCommandFailed.new
344
- end
345
385
  end
346
386
  end
347
387
 
@@ -601,7 +641,7 @@ module Bake
601
641
  end
602
642
 
603
643
  def getDefines(compiler)
604
- compiler[:DEFINES].map {|k| "#{compiler[:DEFINE_FLAG]}#{k}"}
644
+ (compiler[:DEFINES] + Bake.options.defines).map {|k| "#{compiler[:DEFINE_FLAG]}#{k}"}
605
645
  end
606
646
 
607
647
  def getFlags(compiler)
@@ -1,4 +1,4 @@
1
- require 'blocks/compile'
1
+ require_relative 'compile'
2
2
 
3
3
  module Bake
4
4
 
@@ -1,4 +1,4 @@
1
- require 'blocks/compile'
1
+ require_relative 'compile'
2
2
 
3
3
  module Bake
4
4
  module Blocks
@@ -1,4 +1,4 @@
1
- require 'blocks/blockBase'
1
+ require_relative 'blockBase'
2
2
 
3
3
  module Bake
4
4
 
@@ -0,0 +1,62 @@
1
+ require 'fileutils'
2
+
3
+ module Bake
4
+ module Blocks
5
+
6
+ class FileUtil
7
+
8
+ def initialize(config, type, projectDir)
9
+ @arg1 = config.name
10
+ @arg2 = config.respond_to?(:to) ? config.to : nil
11
+ @type = type
12
+ @projectDir = projectDir
13
+ @echo = (config.echo != "off")
14
+ end
15
+
16
+ def run
17
+ Dir.chdir(@projectDir) do
18
+ if @type == :touch
19
+ puts "Touching #{@arg1}" if @echo
20
+ FileUtils.touch(@arg1)
21
+ elsif @type == :move
22
+ puts "Moving #{@arg1} to #{@arg2}" if @echo
23
+ FileUtils.mv(@arg1, @arg2)
24
+ elsif @type == :copy
25
+ puts "Copying #{@arg1} to #{@arg2}" if @echo
26
+ FileUtils.cp_r(@arg1, @arg2)
27
+ elsif @type == :remove
28
+ puts "Removing #{@arg1}" if @echo
29
+ FileUtils.rm_rf(@arg1)
30
+ elsif @type == :makedir
31
+ puts "Making #{@arg1}" if @echo
32
+ FileUtils.mkdir_p(@arg1)
33
+ end
34
+ end
35
+ return true
36
+ end
37
+
38
+ def execute
39
+ return run()
40
+ end
41
+
42
+ def startupStep
43
+ return run()
44
+ end
45
+
46
+ def exitStep
47
+ return run()
48
+ end
49
+
50
+ def cleanStep
51
+ return run()
52
+ end
53
+
54
+ def clean
55
+ # nothing to do here
56
+ return true
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
@@ -1,4 +1,4 @@
1
- require 'blocks/blockBase'
1
+ require_relative 'blockBase'
2
2
 
3
3
  module Bake
4
4
 
@@ -1,4 +1,4 @@
1
- require 'blocks/has_execute_command'
1
+ require_relative 'has_execute_command'
2
2
 
3
3
  module Bake
4
4
  module Blocks
@@ -110,9 +110,9 @@ module Bake
110
110
  if Bake.options.json
111
111
  projs[projName] =
112
112
  { :includes => (blockIncs + intIncs).uniq,
113
- :cpp_defines => (blockDefs[:CPP] + intDefs[:CPP]).uniq,
114
- :c_defines => (blockDefs[:C] + intDefs[:C]).uniq,
115
- :asm_defines => (blockDefs[:ASM] + intDefs[:ASM]).uniq,
113
+ :cpp_defines => (blockDefs[:CPP] + intDefs[:CPP]).uniq + Bake.options.defines,
114
+ :c_defines => (blockDefs[:C] + intDefs[:C]).uniq + Bake.options.defines,
115
+ :asm_defines => (blockDefs[:ASM] + intDefs[:ASM]).uniq + Bake.options.defines,
116
116
  :dir => blocks.first.projectDir
117
117
  }
118
118
  else
@@ -122,7 +122,7 @@ module Bake
122
122
  (blockIncs + intIncs).uniq.each { |i| puts " #{i}" }
123
123
  [:CPP, :C, :ASM].each do |type|
124
124
  puts " #{type} defines"
125
- (blockDefs[type] + intDefs[type]).uniq.each { |d| puts " #{d}" }
125
+ (blockDefs[type] + intDefs[type] + Bake.options.defines).uniq.each { |d| puts " #{d}" }
126
126
  end
127
127
  puts " done"
128
128
  end
@@ -0,0 +1,41 @@
1
+ module Bake
2
+ module Blocks
3
+
4
+ class Sleep
5
+
6
+ def initialize(config)
7
+ @echo = (config.echo != "off")
8
+ @time = config.name.to_f
9
+ end
10
+
11
+ def run
12
+ puts "Sleeping #{@time}s" if @echo
13
+ sleep @time
14
+ return true
15
+ end
16
+
17
+ def execute
18
+ return run()
19
+ end
20
+
21
+ def startupStep
22
+ return run()
23
+ end
24
+
25
+ def exitStep
26
+ return run()
27
+ end
28
+
29
+ def cleanStep
30
+ return run()
31
+ end
32
+
33
+ def clean
34
+ # nothing to do here
35
+ return true
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
@@ -1,4 +1,4 @@
1
- require "blocks/block"
1
+ require_relative "../blocks/block"
2
2
 
3
3
  module Bake
4
4
 
@@ -1,4 +1,4 @@
1
- require 'common/exit_helper'
1
+ require_relative 'exit_helper'
2
2
 
3
3
  module Bake
4
4
 
@@ -1,4 +1,4 @@
1
- require 'common/utils'
1
+ require_relative '../utils'
2
2
 
3
3
  class File
4
4
 
@@ -1,5 +1,5 @@
1
1
  require 'stringio'
2
- require 'blocks/block'
2
+ require_relative '../../blocks/block'
3
3
 
4
4
  class ThreadOut
5
5
 
@@ -1,5 +1,5 @@
1
- require 'bake/toolchain/errorparser/error_parser'
2
- require 'bake/toolchain/colorizing_formatter'
1
+ require_relative '../bake/toolchain/errorparser/error_parser'
2
+ require_relative '../bake/toolchain/colorizing_formatter'
3
3
  require 'thread'
4
4
 
5
5
  module Bake
@@ -1,5 +1,5 @@
1
- require 'bake/toolchain/colorizing_formatter'
2
- require 'common/exit_helper'
1
+ require_relative '../../bake/toolchain/colorizing_formatter'
2
+ require_relative '../exit_helper'
3
3
 
4
4
  module Bake
5
5
 
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.46.0"
4
+ "2.47.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -1,4 +1,4 @@
1
- require 'common/ext/stdout'
1
+ require_relative '../common/ext/stdout'
2
2
  require 'stringio'
3
3
  require 'thread'
4
4
  require 'monitor' # this should fix a missing require in concurrent gem
@@ -1,38 +1,40 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
 
4
- require 'bake/model/metamodel_ext'
5
-
6
- require 'bake/util'
7
- require 'bake/cache'
8
- require 'bake/subst'
9
- require 'bake/mergeConfig'
10
-
11
- require 'common/exit_helper'
12
- require 'common/ide_interface'
13
- require 'common/ext/file'
14
- require 'bake/toolchain/provider'
15
- require 'common/ext/stdout'
16
- require 'common/utils'
17
- require 'bake/toolchain/colorizing_formatter'
18
- require 'bake/config/loader'
19
-
20
- require 'blocks/block'
21
- require 'blocks/commandLine'
22
- require 'blocks/makefile'
23
- require 'blocks/compile'
24
- require 'blocks/convert'
25
- require 'blocks/library'
26
- require 'blocks/executable'
27
- require 'blocks/docu'
4
+ require_relative 'bake/model/metamodel_ext'
5
+
6
+ require_relative 'bake/util'
7
+ require_relative 'bake/cache'
8
+ require_relative 'bake/subst'
9
+ require_relative 'bake/mergeConfig'
10
+
11
+ require_relative 'common/exit_helper'
12
+ require_relative 'common/ide_interface'
13
+ require_relative 'common/ext/file'
14
+ require_relative 'bake/toolchain/provider'
15
+ require_relative 'common/ext/stdout'
16
+ require_relative 'common/utils'
17
+ require_relative 'bake/toolchain/colorizing_formatter'
18
+ require_relative 'bake/config/loader'
19
+
20
+ require_relative 'blocks/block'
21
+ require_relative 'blocks/commandLine'
22
+ require_relative 'blocks/sleep'
23
+ require_relative 'blocks/fileutil'
24
+ require_relative 'blocks/makefile'
25
+ require_relative 'blocks/compile'
26
+ require_relative 'blocks/convert'
27
+ require_relative 'blocks/library'
28
+ require_relative 'blocks/executable'
29
+ require_relative 'blocks/docu'
28
30
 
29
31
  require 'set'
30
32
  require 'socket'
31
33
 
32
- require 'blocks/showIncludes'
33
- require 'common/abortException'
34
+ require_relative 'blocks/showIncludes'
35
+ require_relative 'common/abortException'
34
36
 
35
- require 'adapt/config/loader'
37
+ require_relative 'adapt/config/loader'
36
38
  require "thwait"
37
39
 
38
40
  module Bake
@@ -94,7 +96,19 @@ module Bake
94
96
  if Bake::Metamodel::Makefile === step
95
97
  blockSteps << Blocks::Makefile.new(step, @referencedConfigs, block)
96
98
  elsif Bake::Metamodel::CommandLine === step
97
- blockSteps << Blocks::CommandLine.new(step, @referencedConfigs)
99
+ blockSteps << Blocks::CommandLine.new(step)
100
+ elsif Bake::Metamodel::Sleep === step
101
+ blockSteps << Blocks::Sleep.new(step)
102
+ elsif Bake::Metamodel::Move === step
103
+ blockSteps << Blocks::FileUtil.new(step, :move, block.projectDir)
104
+ elsif Bake::Metamodel::Copy === step
105
+ blockSteps << Blocks::FileUtil.new(step, :copy, block.projectDir)
106
+ elsif Bake::Metamodel::Remove === step
107
+ blockSteps << Blocks::FileUtil.new(step, :remove, block.projectDir)
108
+ elsif Bake::Metamodel::MakeDir === step
109
+ blockSteps << Blocks::FileUtil.new(step, :makedir, block.projectDir)
110
+ elsif Bake::Metamodel::Touch === step
111
+ blockSteps << Blocks::FileUtil.new(step, :touch, block.projectDir)
98
112
  end
99
113
  end if configSteps
100
114
  end
@@ -422,111 +436,119 @@ module Bake
422
436
 
423
437
  def doit()
424
438
 
425
- if Bake.options.show_includes or Bake.options.show_includes_and_defines
426
- s = StringIO.new
427
- tmp = Thread.current[:stdout]
428
- Thread.current[:stdout] = s unless tmp
429
- end
430
-
431
- taskType = "Building"
432
- if Bake.options.conversion_info
433
- taskType = "Showing conversion infos"
434
- elsif Bake.options.docu
435
- taskType = "Generating documentation"
436
- elsif Bake.options.prepro
437
- taskType = "Preprocessing"
438
- elsif Bake.options.linkOnly
439
- taskType = "Linking"
440
- elsif Bake.options.rebuild
441
- taskType = "Rebuilding"
442
- elsif Bake.options.clean
443
- taskType = "Cleaning"
439
+ stdoutSuppression = nil
440
+ orgStdout = nil
441
+ if Bake.options.show_includes || Bake.options.show_includes_and_defines
442
+ stdoutSuppression = StringIO.new
443
+ orgStdout = Thread.current[:stdout]
444
+ Thread.current[:stdout] = stdoutSuppression unless orgStdout
444
445
  end
445
446
 
446
447
  begin
447
448
 
448
- if Bake.options.showConfigs
449
- al = AdaptConfig.new
450
- adaptConfigs = al.load()
451
- Config.new.printConfigs(adaptConfigs)
452
- else
453
- cache = CacheAccess.new()
454
- @referencedConfigs = cache.load_cache unless Bake.options.nocache
449
+ taskType = "Building"
450
+ if Bake.options.conversion_info
451
+ taskType = "Showing conversion infos"
452
+ elsif Bake.options.docu
453
+ taskType = "Generating documentation"
454
+ elsif Bake.options.prepro
455
+ taskType = "Preprocessing"
456
+ elsif Bake.options.linkOnly
457
+ taskType = "Linking"
458
+ elsif Bake.options.rebuild
459
+ taskType = "Rebuilding"
460
+ elsif Bake.options.clean
461
+ taskType = "Cleaning"
462
+ end
463
+
464
+ begin
455
465
 
456
- if @referencedConfigs.nil?
466
+ if Bake.options.showConfigs
457
467
  al = AdaptConfig.new
458
468
  adaptConfigs = al.load()
469
+ Config.new.printConfigs(adaptConfigs)
470
+ else
471
+ cache = CacheAccess.new()
472
+ @referencedConfigs = cache.load_cache unless Bake.options.nocache
473
+
474
+ if @referencedConfigs.nil?
475
+ al = AdaptConfig.new
476
+ adaptConfigs = al.load()
459
477
 
460
- @loadedConfig = Config.new
461
- @referencedConfigs = @loadedConfig.load(adaptConfigs)
478
+ @loadedConfig = Config.new
479
+ @referencedConfigs = @loadedConfig.load(adaptConfigs)
462
480
 
463
- cache.write_cache(@referencedConfigs, adaptConfigs)
481
+ cache.write_cache(@referencedConfigs, adaptConfigs)
482
+ end
464
483
  end
465
- end
466
484
 
467
- taskType = "Analyzing" if Bake.options.analyze
485
+ taskType = "Analyzing" if Bake.options.analyze
468
486
 
469
- @mainConfig = @referencedConfigs[Bake.options.main_project_name].select { |c| c.name == Bake.options.build_config }.first
487
+ @mainConfig = @referencedConfigs[Bake.options.main_project_name].select { |c| c.name == Bake.options.build_config }.first
470
488
 
471
- basedOn = @mainConfig.defaultToolchain.basedOn
472
- basedOnToolchain = Bake::Toolchain::Provider[basedOn]
473
- if basedOnToolchain.nil?
474
- Bake.formatter.printError("DefaultToolchain based on unknown compiler '#{basedOn}'", @mainConfig.defaultToolchain)
475
- ExitHelper.exit(1)
476
- end
489
+ basedOn = @mainConfig.defaultToolchain.basedOn
490
+ basedOnToolchain = Bake::Toolchain::Provider[basedOn]
491
+ if basedOnToolchain.nil?
492
+ Bake.formatter.printError("DefaultToolchain based on unknown compiler '#{basedOn}'", @mainConfig.defaultToolchain)
493
+ ExitHelper.exit(1)
494
+ end
477
495
 
478
- # The flag "-FS" must only be set for VS2013 and above
479
- ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = ""
480
- if basedOn == "MSVC"
481
- begin
482
- res = `cl.exe 2>&1`
483
- raise Exception.new unless $?.success?
484
- scan_res = res.scan(/ersion (\d+).(\d+).(\d+)/)
485
- if scan_res.length > 0
486
- ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = "-FS" if scan_res[0][0].to_i >= 18 # 18 is the compiler major version in VS2013
487
- else
488
- Bake.formatter.printError("Could not read MSVC version")
496
+ # The flag "-FS" must only be set for VS2013 and above
497
+ ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = ""
498
+ if basedOn == "MSVC"
499
+ begin
500
+ res = `cl.exe 2>&1`
501
+ raise Exception.new unless $?.success?
502
+ scan_res = res.scan(/ersion (\d+).(\d+).(\d+)/)
503
+ if scan_res.length > 0
504
+ ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = "-FS" if scan_res[0][0].to_i >= 18 # 18 is the compiler major version in VS2013
505
+ else
506
+ Bake.formatter.printError("Could not read MSVC version")
507
+ ExitHelper.exit(1)
508
+ end
509
+ rescue SystemExit
510
+ raise
511
+ rescue Exception => e
512
+ Bake.formatter.printError("Could not detect MSVC compiler")
489
513
  ExitHelper.exit(1)
490
514
  end
491
- rescue SystemExit
492
- raise
493
- rescue Exception => e
494
- Bake.formatter.printError("Could not detect MSVC compiler")
495
- ExitHelper.exit(1)
496
515
  end
497
- end
498
516
 
499
- @defaultToolchain = Utils.deep_copy(basedOnToolchain)
500
- Bake.options.envToolchain = true if (basedOn.include?"_ENV")
517
+ @defaultToolchain = Utils.deep_copy(basedOnToolchain)
518
+ Bake.options.envToolchain = true if (basedOn.include?"_ENV")
501
519
 
502
- integrateToolchain(@defaultToolchain, @mainConfig.defaultToolchain)
520
+ integrateToolchain(@defaultToolchain, @mainConfig.defaultToolchain)
503
521
 
504
- # todo: cleanup this hack
505
- Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
506
- Bake.options.eclipseOrder = @mainConfig.defaultToolchain.eclipseOrder
522
+ # todo: cleanup this hack
523
+ Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
524
+ Bake.options.eclipseOrder = @mainConfig.defaultToolchain.eclipseOrder
507
525
 
508
- createBaseTcsForConfig
509
- substVars
510
- createTcsForConfig
526
+ createBaseTcsForConfig
527
+ substVars
528
+ createTcsForConfig
511
529
 
512
- @@linkBlock = 0
530
+ @@linkBlock = 0
513
531
 
514
- @prebuild = nil
515
- calcPrebuildBlocks if Bake.options.prebuild
532
+ @prebuild = nil
533
+ calcPrebuildBlocks if Bake.options.prebuild
516
534
 
517
- makeBlocks
518
- makeGraph
519
- makeDot if Bake.options.dot
535
+ makeBlocks
536
+ makeGraph
537
+ makeDot if Bake.options.dot
520
538
 
521
- convert2bb
539
+ convert2bb
540
+ ensure
541
+ if Bake.options.show_includes || Bake.options.show_includes_and_defines
542
+ Thread.current[:stdout] = orgStdout
543
+ puts stdoutSuppression.string # this ensures to print a error message is needed even in case of an exception
544
+ end
545
+ end
522
546
 
523
547
  if Bake.options.show_includes
524
- Thread.current[:stdout] = tmp
525
548
  Blocks::Show.includes
526
549
  end
527
550
 
528
551
  if Bake.options.show_includes_and_defines
529
- Thread.current[:stdout] = tmp
530
552
  Blocks::Show.includesAndDefines(@mainConfig, @configTcMap[@mainConfig])
531
553
  end
532
554