bake-toolkit 2.34.3 → 2.34.4

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
  SHA1:
3
- metadata.gz: 2ce09ce9775f6b4322517f6b88935b7bf473e40d
4
- data.tar.gz: be9156d919acee73ae486bb8f9a1197693701871
3
+ metadata.gz: a509502821070f924447f0e5690dac7a98efcf3c
4
+ data.tar.gz: d3ea565246f0a2e940d0cda680edc07cb6807e92
5
5
  SHA512:
6
- metadata.gz: baeb03be280b965d8f135c78b93c261cae0124e0cd59dde208ace9be0c45a4249c721c18832cffb1fec2ff3cc52d9dbe8090591030dd861e69a552f85dc20282
7
- data.tar.gz: fc054cbff5b02d3cb63aba2d0187fd96c2bc3a4941f61d60555303f77b5b33cecdf08864e2edc1264ab83fa4d5e1cce00a8d8b70c947c7a871b5a4a6ccbd33bc
6
+ metadata.gz: 9c91af0ff514ce5a5c92b501e73246ce2f4b0981427f0e30cc60febc899f06849a7df4a02689e4d07a86f4c9a38f6eee154b3730383ce8c8760dbbcc0e63f91b
7
+ data.tar.gz: 76c5d9412bf476a6eb41916a556bf844cf231c9213b2a7edfb528f161cfe9599d11651cae884e009432c078c67eabc628c8cb7109ada25a7c21da659ff748be7
@@ -66,8 +66,9 @@ def self.executeQacli(cmd, adminStepAndImmediateOutput = false)
66
66
  puts "Retry seconds left: %d" % (@options.qacretry - (Time.now - timeStart))
67
67
  end
68
68
  checkError = !cSizeCheck || licenseError || qacDaemonError
69
- puts "Retry timeout over -> failure." if @options.qacretry > 0 && checkError
70
-
69
+ if @options.qacretry > 0 && checkError
70
+ puts "Retry timeout over: %d -> failure." % (@options.qacretry - (Time.now - timeStart))
71
+ end
71
72
  success = false if checkError
72
73
  return [success, consoleOutput, checkError]
73
74
  end
@@ -50,8 +50,8 @@ module Bake
50
50
  cache = nil
51
51
  end
52
52
 
53
- puts "Cache: Checking if cache was moved: #{@cacheFilename} vs. #{cache.cache_file}" if Bake.options.debug
54
53
  if cache != nil
54
+ puts "Cache: Checking if cache was moved: #{@cacheFilename} vs. #{cache.cache_file}" if Bake.options.debug
55
55
  if cache.cache_file != @cacheFilename
56
56
  Bake.formatter.printInfo("Info: cache filename changed, reloading meta information")
57
57
  cache = nil
@@ -183,6 +183,7 @@ module Bake
183
183
  has_attr 'default', String, :defaultValueLiteral => "on"
184
184
  has_attr 'filter', String, :defaultValueLiteral => ""
185
185
  has_attr 'echo', String, :defaultValueLiteral => "on"
186
+ has_attr 'independent', Boolean, :defaultValueLiteral => "false"
186
187
  has_many_attr 'validExitCodes', Integer
187
188
  end
188
189
 
@@ -106,10 +106,7 @@ module Bake
106
106
 
107
107
  add_option(["--adapt" ], lambda { |x| set_adapt(x) })
108
108
 
109
- add_option(["-v0" ], lambda { @verbose = 0 })
110
- add_option(["-v1" ], lambda { @verbose = 1 })
111
- add_option(["-v2" ], lambda { @verbose = 2 })
112
- add_option(["-v3" ], lambda { @verbose = 3 })
109
+ add_option(["-v" ], lambda { |x, dummy1, dummy2| set_verbose(x) })
113
110
 
114
111
  add_option(["--debug" ], lambda { @debug = true })
115
112
  add_option(["--debug-threads" ], lambda { @debug_threads = true })
@@ -117,7 +114,7 @@ module Bake
117
114
 
118
115
  add_option(["--clobber" ], lambda { @clobber = true; @clean = true })
119
116
  add_option(["--ignore-cache", "--ignore_cache" ], lambda { @nocache = true })
120
- add_option(["-j", "--threads" ], lambda { |x| set_threads(x) })
117
+ add_option(["-j", "--threads" ], lambda { |x, dummy1, dummy2| set_threads(x) })
121
118
  add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
122
119
  add_option(["--toolchain-info", "--toolchain_info" ], lambda { |x| ToolchainInfo.showToolchain(x) })
123
120
  add_option(["--toolchain-names", "--toolchain_names" ], lambda { ToolchainInfo.showToolchainList })
@@ -286,7 +283,15 @@ module Bake
286
283
  @adapt << name if not @adapt.include?name
287
284
  end
288
285
 
286
+ def checkNum(num)
287
+ if String === num && !/\A\d+\z/.match(num)
288
+ Bake.formatter.printError("Error: #{num} is not a positive number")
289
+ ExitHelper.exit(1)
290
+ end
291
+ end
292
+
289
293
  def set_threads(num)
294
+ checkNum(num)
290
295
  @threads = String === num ? num.to_i : num
291
296
  if @threads <= 0
292
297
  Bake.formatter.printError("Error: number of threads must be > 0")
@@ -294,6 +299,15 @@ module Bake
294
299
  end
295
300
  end
296
301
 
302
+ def set_verbose(num)
303
+ checkNum(num)
304
+ @verbose = String === num ? num.to_i : num
305
+ if @verbose < 0 || verbose > 3
306
+ Bake.formatter.printError("Error: verbose must be between 0 and 3")
307
+ ExitHelper.exit(1)
308
+ end
309
+ end
310
+
297
311
  def set_set(str)
298
312
  ar = str.split("=")
299
313
  if not str.include?"=" or ar[0].length == 0
@@ -296,42 +296,41 @@ module Bake
296
296
  end
297
297
  end
298
298
 
299
- def execute_in_thread(method)
300
- if method == :execute
301
- @@mutex.synchronize do
302
- Block::waitForFreeThread()
303
- return if blockAbort?(true)
304
-
305
- @@threads << Thread.new(Thread.current[:stdout], Thread.current[:errorStream]) { |outStr, errStr|
306
- STDOUT.puts "DEBUG_THREADS: Started: #{Thread.current.object_id} (#{@projectName}, #{@config.name})" if Bake.options.debug_threads
307
- Thread.current[:stdout] = outStr
308
- Thread.current[:errorStream] = errStr
309
- exceptionOccured = false
310
- begin
311
- yield
312
- exceptionOccured = true
313
- rescue Bake::SystemCommandFailed => scf # normal compilation error
314
- rescue SystemExit => exSys
315
- rescue Exception => ex1
316
- if not Bake::IDEInterface.instance.get_abort
317
- SyncOut.mutex.synchronize do
318
- Bake.formatter.printError("Error: #{ex1.message}")
319
- puts ex1.backtrace if Bake.options.debug
320
- end
299
+ def execute_in_thread(steps)
300
+ @@mutex.synchronize do
301
+ Block::waitForFreeThread()
302
+ return if blockAbort?(true)
303
+
304
+ tmpstdout = Thread.current[:tmpStdout].nil? ? nil : Thread.current[:tmpStdout].dup
305
+ @@threads << Thread.new(Thread.current[:stdout], Thread.current[:errorStream], tmpstdout, steps) { |outStr, errStr, tmpStdout, steps|
306
+ STDOUT.puts "DEBUG_THREADS: Started: #{Thread.current.object_id} (#{@projectName}, #{@config.name})" if Bake.options.debug_threads
307
+ Thread.current[:stdout] = outStr
308
+ Thread.current[:errorStream] = errStr
309
+ Thread.current[:tmpStdout] = tmpStdout
310
+ Thread.current[:steps] = steps
311
+ exceptionOccured = false
312
+ begin
313
+ yield
314
+ exceptionOccured = true
315
+ rescue Bake::SystemCommandFailed => scf # normal compilation error
316
+ rescue SystemExit => exSys
317
+ rescue Exception => ex1
318
+ if not Bake::IDEInterface.instance.get_abort
319
+ SyncOut.mutex.synchronize do
320
+ Bake.formatter.printError("Error: #{ex1.message}")
321
+ puts ex1.backtrace if Bake.options.debug
321
322
  end
322
323
  end
323
- if !exceptionOccured
324
- @result = false
325
- @@delayed_result = false
326
- end
327
- STDOUT.puts "DEBUG_THREADS: Stopped: #{Thread.current.object_id} (#{@projectName}, #{@config.name})" if Bake.options.debug_threads
328
- }
324
+ end
325
+ if !exceptionOccured
326
+ @result = false
327
+ @@delayed_result = false
328
+ end
329
+ STDOUT.puts "DEBUG_THREADS: Stopped: #{Thread.current.object_id} (#{@projectName}, #{@config.name})" if Bake.options.debug_threads
330
+ }
329
331
 
330
- Block::waitForFreeThread()
331
- return if blockAbort?(true)
332
- end
333
- else
334
- yield
332
+ Block::waitForFreeThread()
333
+ return if blockAbort?(true)
335
334
  end
336
335
  raise AbortException.new if Bake::IDEInterface.instance.get_abort
337
336
  end
@@ -340,55 +339,54 @@ module Bake
340
339
  ((not res) || !@@delayed_result) and Bake.options.stopOnFirstError or Bake::IDEInterface.instance.get_abort
341
340
  end
342
341
 
342
+ def independent?(method, step)
343
+ method == :execute && (Library === step || Compile === step ||
344
+ (CommandLine === step && step.config.independent) ||
345
+ (Makefile === step && step.config.independent))
346
+ end
347
+
343
348
  def callSteps(method)
344
349
  @config.writeEnvVars()
345
350
  Thread.current[:lastCommand] = nil
346
351
 
347
- preSteps.each do |step|
348
- Blocks::Block::waitForAllThreads()
349
- @result = executeStep(step, method) if @result
350
- return @result if blockAbort?(@result)
351
- end unless @prebuild
352
+ allSteps = (preSteps + mainSteps + postSteps)
352
353
 
353
- threadableSteps = mainSteps.select { |step| method == :execute && (Library === step || Compile === step) }
354
- nonThreadableSteps = mainSteps.select { |step| method != :execute || !(Library === step || Compile === step) }
354
+ # check if we have to delay the output (if the last step of this block is not in a thread)
355
+ # todo: sync output if commandline and makefile!!!!!!!!!!!!!!!!!!!
356
+ @outputStep = nil
357
+ allSteps.each { |step| @outputStep = independent?(method, step) ? step : nil }
355
358
 
356
- @outputInMainThread = nonThreadableSteps.any?{ |step| !@prebuild || (Library === step) } ||
357
- postSteps.length > 0 ||
358
- (threadableSteps.length == 0 && preSteps.length > 0)
359
-
360
- execute_in_thread(method) {
361
- begin
362
- threadableSteps.each do |step|
363
- if !@prebuild || (Library === step)
364
- Multithread::Jobs.incThread() if Library === step
365
- begin
366
- @result = executeStep(step, method) if @result
367
- ensure
368
- Multithread::Jobs.decThread() if Library === step
369
- end
370
- @@delayed_result &&= @result
371
- end
372
- break if blockAbort?(@result)
373
- end
374
- ensure
375
- SyncOut.stopStream(@result) if !@outputInMainThread
359
+ while !allSteps.empty?
360
+ parallel = []
361
+ while allSteps.first && independent?(method, allSteps.first)
362
+ parallel << allSteps.shift
376
363
  end
377
- } if !threadableSteps.empty?
378
- nonThreadableSteps.each do |step|
379
- if !@prebuild || (Library === step)
364
+ if parallel.length > 0
365
+ execute_in_thread(parallel) {
366
+ lastStep = Thread.current[:steps].last
367
+ begin
368
+ Thread.current[:steps].each do |step|
369
+ Multithread::Jobs.incThread() if !Compile === step
370
+ begin
371
+ @result = executeStep(step, :execute) if @result
372
+ ensure
373
+ Multithread::Jobs.decThread() if !Compile === step
374
+ end
375
+ @@delayed_result &&= @result
376
+ break if blockAbort?(@result)
377
+ end
378
+ ensure
379
+ SyncOut.stopStream(@result) if lastStep == @outputStep if Bake.options.syncedOutput
380
+ end
381
+ }
382
+ else
383
+ step = allSteps.shift
380
384
  Blocks::Block::waitForAllThreads()
381
385
  @result = executeStep(step, method) if @result
382
386
  end
383
387
  return @result if blockAbort?(@result)
384
388
  end
385
389
 
386
- postSteps.each do |step|
387
- Blocks::Block::waitForAllThreads()
388
- @result = executeStep(step, method) if @result
389
- return @result if blockAbort?(@result)
390
- end unless @prebuild
391
-
392
390
  return @result
393
391
  end
394
392
 
@@ -414,7 +412,7 @@ module Bake
414
412
 
415
413
  begin
416
414
  SyncOut.mutex.synchronize do
417
- @outputInMainThread = true
415
+ @outputStep = nil
418
416
  SyncOut.startStream() if Bake.options.syncedOutput
419
417
  if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
420
418
  typeStr = "Building"
@@ -437,10 +435,12 @@ module Bake
437
435
 
438
436
  @result = callSteps(:execute)
439
437
  ensure
440
- if @outputInMainThread
441
- SyncOut.stopStream(@result)
442
- else
443
- SyncOut.discardStreams()
438
+ if Bake.options.syncedOutput
439
+ if !@outputStep
440
+ SyncOut.stopStream(@result)
441
+ else
442
+ SyncOut.discardStreams()
443
+ end
444
444
  end
445
445
  end
446
446
 
@@ -485,7 +485,7 @@ module Bake
485
485
  cleanSteps.each do |step|
486
486
  @result = executeStep(step, :cleanStep) if @result
487
487
  return false if not @result and Bake.options.stopOnFirstError
488
- end unless @prebuild
488
+ end
489
489
 
490
490
  return (depResult && @result)
491
491
  end
@@ -3,6 +3,7 @@ module Bake
3
3
  module Blocks
4
4
 
5
5
  module HasExecuteCommand
6
+ attr_reader :config
6
7
 
7
8
  def executeCommand(commandLine, ignoreStr=nil, exitCodeArray = [0], echo = "on")
8
9
  if Bake.options.dry
@@ -15,9 +16,7 @@ module Bake
15
16
  cmd_result = false
16
17
  output = ""
17
18
  begin
18
- Dir.chdir(@projectDir) do
19
- cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray)
20
- end
19
+ cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray, @projectDir)
21
20
  rescue Exception=>e
22
21
  puts e.message
23
22
  puts e.backtrace if Bake.options.debug
@@ -74,7 +74,6 @@ class SyncOut
74
74
  else
75
75
  Thread.current[:tmpStdout] << Thread.current[:stdout]
76
76
  end
77
-
78
77
  Thread.current[:stdout] = s
79
78
  end
80
79
 
@@ -90,6 +89,7 @@ class SyncOut
90
89
  s = Thread.current[:stdout]
91
90
  return if s.nil?
92
91
  Thread.current[:stdout] = Thread.current[:tmpStdout] ? Thread.current[:tmpStdout].pop : nil
92
+
93
93
  if s.string.length > 0
94
94
  mutex.synchronize do
95
95
  if !result && Bake.options.stopOnFirstError
@@ -105,7 +105,7 @@ class SyncOut
105
105
 
106
106
 
107
107
  def self.discardStreams()
108
- Thread.current[:tmpStdout] = []
108
+ Thread.current[:stdout] = Thread.current[:tmpStdout] ? Thread.current[:tmpStdout].pop : nil
109
109
  end
110
110
 
111
111
  def self.flush_errors
@@ -18,19 +18,27 @@ module Bake
18
18
  params.each { |p| @arguments[p] = block }
19
19
  end
20
20
 
21
- def get_block(param)
22
- opt = @arguments[param]
23
- raise "Internal error in option handling" unless opt
24
- opt.block
21
+ def valid?(argument)
22
+ @arguments.keys.any? { |a| a != "" && argument.start_with?(a) }
25
23
  end
26
24
 
27
- def valid?(argument)
28
- @arguments.include?argument
25
+ def get_block(argument)
26
+ arg = nil
27
+ block = nil
28
+ @arguments.each do |a, b|
29
+ if argument.start_with?(a) && a != ""
30
+ return [b, nil] if a == argument
31
+ block = b
32
+ arg = b.parameters.length==3 ? argument[a.length..-1] : nil
33
+ end
34
+ end
35
+ return [block, arg]
29
36
  end
30
37
 
31
38
  def has_parameter?(argument)
32
- return false unless valid?(argument)
33
- @arguments[argument].parameters.length == 1
39
+ b, inPlaceArg = get_block(argument)
40
+ return false unless b
41
+ b.parameters.length == 1
34
42
  end
35
43
 
36
44
  def parse_internal(ignore_invalid, subOptions = nil)
@@ -55,29 +63,32 @@ module Bake
55
63
  if index != nil and index == 0
56
64
  raise "Option #{arg} unknown" if not ignore_invalid
57
65
  else
58
- @arguments[""].call(arg) # default paramter without "-"
66
+ @arguments[""].call(arg) # default parameter without "-"
59
67
  end
60
68
  else
61
- option = @arguments[arg]
62
- if option.parameters.length >= 1
63
- hasArgument = (pos+1 < @argv.length and @argv[pos+1][0] != "-")
64
- if option.parameters.length == 2 or hasArgument
65
- if option.parameters.length == 2
66
- if hasArgument
67
- option.call(@argv[pos+1], nil) # do not use default value
68
- pos = pos + 1
69
- else
70
- option.call(nil, nil) # use default value
71
- end
72
- else
73
- option.call(@argv[pos+1])
74
- pos = pos + 1
75
- end
69
+ option, inPlaceArg = get_block(arg)
70
+ hasArgument = (pos+1 < @argv.length and @argv[pos+1][0] != "-")
71
+ if option.parameters.length == 3 && (hasArgument || inPlaceArg)
72
+ if inPlaceArg
73
+ option.call(inPlaceArg, nil, nil)
76
74
  else
77
- raise "Argument for option #{arg} missing"
75
+ option.call(@argv[pos+1], nil, nil) # do not use inplace value
76
+ pos = pos + 1
78
77
  end
79
- else
78
+ elsif option.parameters.length == 2
79
+ if hasArgument
80
+ option.call(@argv[pos+1], nil) # do not use default value
81
+ pos = pos + 1
82
+ else
83
+ option.call(nil, nil) # use default value
84
+ end
85
+ elsif option.parameters.length == 1 && hasArgument
86
+ option.call(@argv[pos+1])
87
+ pos = pos + 1
88
+ elsif option.parameters.length == 0
80
89
  option.call()
90
+ else
91
+ raise "Argument for option #{arg} missing"
81
92
  end
82
93
  end
83
94
  pos = pos + 1
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.34.3"
4
+ "2.34.4"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -299,29 +299,31 @@ module Bake
299
299
  addSteps(block, block.startupSteps, config.startupSteps)
300
300
  addSteps(block, block.exitSteps, config.exitSteps)
301
301
 
302
- if not Bake.options.prepro and not Bake.options.conversion_info and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
302
+ if not block.prebuild and not Bake.options.prepro and not Bake.options.conversion_info and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
303
303
  addSteps(block, block.preSteps, config.preSteps)
304
304
  addSteps(block, block.postSteps, config.postSteps)
305
305
  addSteps(block, block.cleanSteps, config.cleanSteps)
306
306
  end
307
307
 
308
308
  if Bake.options.docu
309
- block.mainSteps << Blocks::Docu.new(config, @configTcMap[config])
309
+ block.mainSteps << Blocks::Docu.new(config, @configTcMap[config]) unless block.prebuild
310
310
  elsif Metamodel::CustomConfig === config
311
311
  if not Bake.options.prepro and not Bake.options.conversion_info and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
312
- addSteps(block, block.mainSteps, config) if config.step
312
+ addSteps(block, block.mainSteps, config) if config.step unless block.prebuild
313
313
  end
314
314
  elsif Bake.options.conversion_info
315
- block.mainSteps << Blocks::Convert.new(block, config, @referencedConfigs)
315
+ block.mainSteps << Blocks::Convert.new(block, config, @referencedConfigs) unless block.prebuild
316
316
  else
317
- compile = Blocks::Compile.new(block, config, @referencedConfigs)
318
- (Blocks::ALL_COMPILE_BLOCKS[projName] ||= []) << compile
319
- block.mainSteps << compile
317
+ if not block.prebuild
318
+ compile = Blocks::Compile.new(block, config, @referencedConfigs)
319
+ (Blocks::ALL_COMPILE_BLOCKS[projName] ||= []) << compile
320
+ block.mainSteps << compile
321
+ end
320
322
  if not Bake.options.filename and not Bake.options.analyze
321
323
  if Metamodel::LibraryConfig === config
322
324
  block.mainSteps << Blocks::Library.new(block, config, @referencedConfigs, compile)
323
325
  else
324
- block.mainSteps << Blocks::Executable.new(block, config, @referencedConfigs, compile)
326
+ block.mainSteps << Blocks::Executable.new(block, config, @referencedConfigs, compile) unless block.prebuild
325
327
  end
326
328
  end
327
329
  end
@@ -357,7 +359,6 @@ module Bake
357
359
  ensure
358
360
  Blocks::Block::waitForAllThreads()
359
361
  result &&= Blocks::Block.delayed_result
360
- SyncOut.stopStream(result)
361
362
  end
362
363
  if not ignoreStopOnFirstError
363
364
  return false if not result and Bake.options.stopOnFirstError
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.34.3
4
+ version: 2.34.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext