bake-toolkit 2.33.0 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bakery +11 -8
- data/lib/bake/config/loader.rb +1 -0
- data/lib/bake/options/options.rb +3 -1
- data/lib/bake/options/usage.rb +1 -0
- data/lib/blocks/block.rb +93 -58
- data/lib/blocks/compile.rb +2 -0
- data/lib/blocks/executable.rb +8 -1
- data/lib/common/cleanup.rb +1 -1
- data/lib/common/ext/stdout.rb +39 -8
- data/lib/common/version.rb +1 -1
- data/lib/multithread/job.rb +3 -1
- data/lib/tocxx.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e127ea891d694b2055ef9c7233f0c2f52955a1
|
4
|
+
data.tar.gz: 897a5a3e47ff5d351ef86395b801389395c8a21f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5380fdb0f5b84bf0e393726df5aa259502ec3f721a7e6ed110dda3f1ba845758d2c78449cf0ccb7896cff8ca9094bc930af6552c5394b9ae0deddcde4683fa
|
7
|
+
data.tar.gz: 335f22338bd491a4edab31ac75c272aef67a2bb781f775dc397be558cd9c98cb6f27f995bc5943b3a7c2dc9215017e05cc2a175748982592c76ff99f30092898
|
data/bin/bakery
CHANGED
@@ -123,6 +123,11 @@ module Bake
|
|
123
123
|
tocxx = ToCxx.new
|
124
124
|
tocxx.doit()
|
125
125
|
runOk = (ExitHelper.exit_code == 0)
|
126
|
+
if Bake::IDEInterface.instance.get_abort
|
127
|
+
abort = true
|
128
|
+
exitValue = 1
|
129
|
+
break
|
130
|
+
end
|
126
131
|
rescue SystemExit
|
127
132
|
runOk = (ExitHelper.exit_code == 0)
|
128
133
|
rescue Exception => e
|
@@ -151,16 +156,14 @@ module Bake
|
|
151
156
|
else
|
152
157
|
msg1 << "summary: #{maxRuns} of #{maxRuns} builds ok"
|
153
158
|
end
|
154
|
-
else
|
155
|
-
end
|
156
159
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
160
|
+
timeEnd = Time.now
|
161
|
+
timeDiff = timeEnd - $timeStart
|
162
|
+
failedRuns.each_with_index do |f,i|
|
163
|
+
msg1 << "\n#{i+1}: #{f}"
|
164
|
+
end
|
165
|
+
msg1 << "\ntime: %02d:%02d minutes" % [timeDiff/60, timeDiff%60]
|
161
166
|
end
|
162
|
-
msg1 << "\ntime: %02d:%02d minutes" % [timeDiff/60, timeDiff%60]
|
163
|
-
|
164
167
|
|
165
168
|
if failedRuns.length == 0
|
166
169
|
Bake.formatter.printSuccess($stars)
|
data/lib/bake/config/loader.rb
CHANGED
@@ -335,6 +335,7 @@ module Bake
|
|
335
335
|
if (r.length == 3 && r.include?(":/"))
|
336
336
|
r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
|
337
337
|
end
|
338
|
+
puts "Checking root #{r}" if Bake.options.verbose >= 1
|
338
339
|
r = r+"/**{,/*/**}/Project.meta"
|
339
340
|
@potentialProjs.concat(Dir.glob(r).sort)
|
340
341
|
end
|
data/lib/bake/options/options.rb
CHANGED
@@ -20,7 +20,7 @@ module Bake
|
|
20
20
|
attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :envToolchain, :showConfigs
|
21
21
|
attr_reader :main_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :cc2j_filename # String
|
22
22
|
attr_reader :roots, :include_filter, :exclude_filter, :adapt # String List
|
23
|
-
attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :projectPaths, :qac, :dry # Boolean
|
23
|
+
attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :projectPaths, :qac, :dry, :syncedOutput # Boolean
|
24
24
|
attr_reader :linkOnly, :compileOnly, :no_autodir, :clobber, :docu, :debug, :prepro, :oldLinkOrder, :prebuild, :printTime, :json, :wparse # Boolean
|
25
25
|
attr_reader :threads, :socket # Fixnum
|
26
26
|
attr_reader :vars # map
|
@@ -78,6 +78,7 @@ module Bake
|
|
78
78
|
@def_roots = []
|
79
79
|
@main_project_name = ""
|
80
80
|
@adapt = []
|
81
|
+
@syncedOutput = false
|
81
82
|
|
82
83
|
add_option(["-b", "" ], lambda { |x| set_build_config(x) })
|
83
84
|
add_option(["-m" ], lambda { |x| set_main_dir(x) })
|
@@ -87,6 +88,7 @@ module Bake
|
|
87
88
|
add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
|
88
89
|
add_option(["-w" ], lambda { |x| set_root(x) })
|
89
90
|
add_option(["-r" ], lambda { @stopOnFirstError = true })
|
91
|
+
add_option(["-O" ], lambda { @syncedOutput = true })
|
90
92
|
add_option(["--rebuild" ], lambda { @rebuild = true })
|
91
93
|
add_option(["--prepro" ], lambda { @prepro = true })
|
92
94
|
add_option(["--link-only", "--link_only" ], lambda { @linkOnly = true; })
|
data/lib/bake/options/usage.rb
CHANGED
@@ -33,6 +33,7 @@ module Bake
|
|
33
33
|
puts " --generate-doc Builds docu instead of compiling sources."
|
34
34
|
puts " --ignore-cache Rereads the original meta files - usefull if workspace structure has been changed."
|
35
35
|
puts " -j <num> Set NUMBER of parallel compiled files (default is 8)."
|
36
|
+
puts " -O The output will be synchronized per configuration. Note, this delays output."
|
36
37
|
puts " --socket <num> Set SOCKET for sending errors, receiving commands, etc. - used by e.g. Eclipse."
|
37
38
|
puts " --toolchain-info <name> Prints default values of a toolchain."
|
38
39
|
puts " --toolchain-names Prints available toolchains."
|
data/lib/blocks/block.rb
CHANGED
@@ -165,7 +165,11 @@ module Bake
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def self.reset_block_counter
|
168
|
-
@@block_counter =
|
168
|
+
@@block_counter = 1
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.set_delayed_result
|
172
|
+
@@delayed_result = false
|
169
173
|
end
|
170
174
|
|
171
175
|
def self.reset_delayed_result
|
@@ -271,37 +275,44 @@ module Bake
|
|
271
275
|
return depResult
|
272
276
|
end
|
273
277
|
|
278
|
+
def self.waitForFreeThread
|
279
|
+
if @@threads.length == Bake.options.threads
|
280
|
+
endedThread = ThreadsWait.new(@@threads).next_wait
|
281
|
+
@@threads.delete(endedThread)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
274
285
|
def execute_in_thread(method)
|
275
286
|
if method == :execute
|
276
287
|
@@mutex.synchronize do
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
288
|
+
Block::waitForFreeThread()
|
289
|
+
return if blockAbort?(true)
|
290
|
+
|
291
|
+
@@threads << Thread.new(Thread.current[:stdout], Thread.current[:errorStream]) { |outStr, errStr|
|
292
|
+
Thread.current[:stdout] = outStr
|
293
|
+
Thread.current[:errorStream] = errStr
|
294
|
+
exceptionOccured = false
|
295
|
+
begin
|
296
|
+
yield
|
297
|
+
exceptionOccured = true
|
298
|
+
rescue Bake::SystemCommandFailed => scf # normal compilation error
|
299
|
+
rescue SystemExit => exSys
|
300
|
+
rescue Exception => ex1
|
301
|
+
if not Bake::IDEInterface.instance.get_abort
|
302
|
+
SyncOut.mutex.synchronize do
|
303
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
304
|
+
puts ex1.backtrace if Bake.options.debug
|
305
|
+
end
|
295
306
|
end
|
296
307
|
end
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
308
|
+
if !exceptionOccured
|
309
|
+
@result = false
|
310
|
+
@@delayed_result = false
|
311
|
+
end
|
312
|
+
}
|
313
|
+
|
314
|
+
Block::waitForFreeThread()
|
315
|
+
return if blockAbort?(true)
|
305
316
|
end
|
306
317
|
else
|
307
318
|
yield
|
@@ -314,31 +325,38 @@ module Bake
|
|
314
325
|
end
|
315
326
|
|
316
327
|
def callSteps(method)
|
317
|
-
|
318
328
|
@config.writeEnvVars()
|
319
329
|
Thread.current[:lastCommand] = nil
|
320
330
|
|
321
331
|
preSteps.each do |step|
|
322
332
|
ThreadsWait.all_waits(Blocks::Block::threads)
|
323
333
|
@result = executeStep(step, method) if @result
|
324
|
-
return
|
334
|
+
return @result if blockAbort?(@result)
|
325
335
|
end unless @prebuild
|
326
336
|
|
327
337
|
threadableSteps = mainSteps.select { |step| method == :execute && (Library === step || Compile === step) }
|
328
338
|
nonThreadableSteps = mainSteps.select { |step| method != :execute || !(Library === step || Compile === step) }
|
329
339
|
|
340
|
+
@outputInMainThread = nonThreadableSteps.any?{ |step| !@prebuild || (Library === step) } ||
|
341
|
+
postSteps.length > 0 ||
|
342
|
+
(threadableSteps.length == 0 && preSteps.length > 0)
|
343
|
+
|
330
344
|
execute_in_thread(method) {
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
345
|
+
begin
|
346
|
+
threadableSteps.each do |step|
|
347
|
+
if !@prebuild || (Library === step)
|
348
|
+
Multithread::Jobs.incThread() if Library === step
|
349
|
+
begin
|
350
|
+
@result = executeStep(step, method) if @result
|
351
|
+
ensure
|
352
|
+
Multithread::Jobs.decThread() if Library === step
|
353
|
+
end
|
354
|
+
@@delayed_result &&= @result
|
338
355
|
end
|
339
|
-
|
356
|
+
break if blockAbort?(@result)
|
340
357
|
end
|
341
|
-
|
358
|
+
ensure
|
359
|
+
SyncOut.stopStream(@result) if !@outputInMainThread
|
342
360
|
end
|
343
361
|
} if !threadableSteps.empty?
|
344
362
|
nonThreadableSteps.each do |step|
|
@@ -346,13 +364,13 @@ module Bake
|
|
346
364
|
ThreadsWait.all_waits(Blocks::Block::threads)
|
347
365
|
@result = executeStep(step, method) if @result
|
348
366
|
end
|
349
|
-
return
|
367
|
+
return @result if blockAbort?(@result)
|
350
368
|
end
|
351
369
|
|
352
370
|
postSteps.each do |step|
|
353
371
|
ThreadsWait.all_waits(Blocks::Block::threads)
|
354
372
|
@result = executeStep(step, method) if @result
|
355
|
-
return
|
373
|
+
return @result if blockAbort?(@result)
|
356
374
|
end unless @prebuild
|
357
375
|
|
358
376
|
return @result
|
@@ -374,26 +392,44 @@ module Bake
|
|
374
392
|
@inDeps = true
|
375
393
|
depResult = callDeps(:execute)
|
376
394
|
@inDeps = false
|
377
|
-
return
|
395
|
+
return @result if blockAbort?(depResult)
|
378
396
|
|
379
397
|
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
380
398
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
if
|
385
|
-
|
386
|
-
|
387
|
-
|
399
|
+
begin
|
400
|
+
SyncOut.mutex.synchronize do
|
401
|
+
@outputInMainThread = true
|
402
|
+
SyncOut.startStream() if Bake.options.syncedOutput
|
403
|
+
if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
|
404
|
+
typeStr = "Building"
|
405
|
+
if @prebuild
|
406
|
+
typeStr = "Using"
|
407
|
+
elsif not isBuildBlock?
|
408
|
+
typeStr = "Applying"
|
409
|
+
end
|
410
|
+
|
411
|
+
bcStr = ">>CONF_NUM<<"
|
412
|
+
if !Bake.options.syncedOutput
|
413
|
+
bcStr = Block.block_counter
|
414
|
+
Block.inc_block_counter()
|
415
|
+
end
|
416
|
+
|
417
|
+
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{bcStr} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
388
418
|
end
|
389
|
-
|
390
|
-
|
419
|
+
puts "Project path: #{@projectDir}" if Bake.options.projectPaths
|
420
|
+
end
|
421
|
+
|
422
|
+
@result = callSteps(:execute)
|
423
|
+
ensure
|
424
|
+
if @outputInMainThread
|
425
|
+
SyncOut.stopStream(@result)
|
426
|
+
else
|
427
|
+
SyncOut.discardStreams()
|
391
428
|
end
|
392
|
-
puts "Project path: #{@projectDir}" if Bake.options.projectPaths
|
393
429
|
end
|
394
430
|
|
395
|
-
|
396
|
-
return (depResult && @result)
|
431
|
+
|
432
|
+
return (depResult && @result)# && @@delayed_result)
|
397
433
|
end
|
398
434
|
|
399
435
|
def clean
|
@@ -403,10 +439,6 @@ module Bake
|
|
403
439
|
depResult = callDeps(:clean)
|
404
440
|
return false if not depResult and Bake.options.stopOnFirstError
|
405
441
|
|
406
|
-
if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
|
407
|
-
Block.inc_block_counter()
|
408
|
-
end
|
409
|
-
|
410
442
|
if Bake.options.verbose >= 2
|
411
443
|
typeStr = "Cleaning"
|
412
444
|
if @prebuild
|
@@ -414,10 +446,13 @@ module Bake
|
|
414
446
|
elsif not isBuildBlock?
|
415
447
|
typeStr = "Skipping"
|
416
448
|
end
|
417
|
-
Block.inc_block_counter()
|
418
449
|
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
419
450
|
end
|
420
451
|
|
452
|
+
if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
|
453
|
+
Block.inc_block_counter()
|
454
|
+
end
|
455
|
+
|
421
456
|
@result = callSteps(:clean)
|
422
457
|
|
423
458
|
if Bake.options.clobber
|
data/lib/blocks/compile.rb
CHANGED
@@ -291,6 +291,7 @@ module Bake
|
|
291
291
|
end
|
292
292
|
|
293
293
|
SyncOut.startStream()
|
294
|
+
SyncOut.reset_errors()
|
294
295
|
begin
|
295
296
|
Thread.current[:filelist] = Set.new if Bake.options.filelist
|
296
297
|
Thread.current[:lastCommand] = nil
|
@@ -311,6 +312,7 @@ module Bake
|
|
311
312
|
jobs.set_failed if not result
|
312
313
|
ensure
|
313
314
|
SyncOut.stopStream(result)
|
315
|
+
SyncOut.flush_errors()
|
314
316
|
end
|
315
317
|
self.mutex.synchronize do
|
316
318
|
fileListBlock.merge(Thread.current[:filelist]) if Bake.options.filelist
|
data/lib/blocks/executable.rb
CHANGED
@@ -79,7 +79,14 @@ module Bake
|
|
79
79
|
def execute
|
80
80
|
Dir.chdir(@projectDir) do
|
81
81
|
childs = @block.getBlocks(:childs)
|
82
|
-
|
82
|
+
if childs.any? { |b| b.result == false }
|
83
|
+
if Bake.options.stopOnFirstError
|
84
|
+
Blocks::Block.set_delayed_result
|
85
|
+
return true
|
86
|
+
else
|
87
|
+
return false
|
88
|
+
end
|
89
|
+
end
|
83
90
|
|
84
91
|
allSources = []
|
85
92
|
(childs + [@block]).each do |b|
|
data/lib/common/cleanup.rb
CHANGED
data/lib/common/ext/stdout.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'stringio'
|
2
|
+
require 'blocks/block'
|
2
3
|
|
3
4
|
class ThreadOut
|
4
5
|
|
@@ -44,6 +45,10 @@ STDERR.sync = true
|
|
44
45
|
$stdout = ThreadOut.new(STDOUT)
|
45
46
|
$stderr = ThreadOut.new(STDERR)
|
46
47
|
|
48
|
+
def puts(o)
|
49
|
+
tmp = Thread.current[:stdout]
|
50
|
+
tmp ? tmp.puts(o) : super(o)
|
51
|
+
end
|
47
52
|
|
48
53
|
class SyncOut
|
49
54
|
def self.mutex
|
@@ -54,7 +59,7 @@ class SyncOut
|
|
54
59
|
mutex.synchronize do
|
55
60
|
tmp = Thread.current[:stdout]
|
56
61
|
if tmp.string.length > 0
|
57
|
-
Thread.current[:stdout] = Thread.current[:tmpStdout]
|
62
|
+
Thread.current[:stdout] = Thread.current[:tmpStdout][Thread.current[:tmpStdout].length-1]
|
58
63
|
puts tmp.string
|
59
64
|
tmp.reopen("")
|
60
65
|
Thread.current[:stdout] = tmp
|
@@ -64,31 +69,57 @@ class SyncOut
|
|
64
69
|
|
65
70
|
def self.startStream
|
66
71
|
s = StringIO.new
|
67
|
-
Thread.current[:tmpStdout]
|
72
|
+
if Thread.current[:tmpStdout].nil?
|
73
|
+
Thread.current[:tmpStdout] = [Thread.current[:stdout]]
|
74
|
+
else
|
75
|
+
Thread.current[:tmpStdout] << Thread.current[:stdout]
|
76
|
+
end
|
77
|
+
|
68
78
|
Thread.current[:stdout] = s
|
69
79
|
end
|
70
80
|
|
71
|
-
def self.
|
81
|
+
def self.convertConfNum(str)
|
82
|
+
if Bake.options.syncedOutput
|
83
|
+
while str.sub!(">>CONF_NUM<<", Bake::Blocks::Block.block_counter.to_s) do
|
84
|
+
Bake::Blocks::Block.inc_block_counter
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.stopStream(result=true)
|
72
90
|
s = Thread.current[:stdout]
|
73
|
-
|
91
|
+
return if s.nil?
|
92
|
+
Thread.current[:stdout] = Thread.current[:tmpStdout] ? Thread.current[:tmpStdout].pop : nil
|
74
93
|
if s.string.length > 0
|
75
94
|
mutex.synchronize do
|
76
95
|
if !result && Bake.options.stopOnFirstError
|
77
|
-
|
96
|
+
Thread.current[:errorStream] << s.string
|
78
97
|
else
|
98
|
+
convertConfNum(s.string)
|
79
99
|
puts s.string
|
80
100
|
end
|
81
101
|
end
|
102
|
+
s.reopen("")
|
82
103
|
end
|
83
104
|
end
|
84
105
|
|
106
|
+
|
107
|
+
def self.discardStreams()
|
108
|
+
Thread.current[:tmpStdout] = []
|
109
|
+
end
|
110
|
+
|
85
111
|
def self.flush_errors
|
86
|
-
|
87
|
-
|
112
|
+
if !Thread.current[:errorStream].empty?
|
113
|
+
mutex.synchronize do
|
114
|
+
convertConfNum(Thread.current[:errorStream])
|
115
|
+
puts Thread.current[:errorStream]
|
116
|
+
reset_errors
|
117
|
+
end
|
118
|
+
end
|
88
119
|
end
|
89
120
|
|
90
121
|
def self.reset_errors
|
91
|
-
|
122
|
+
Thread.current[:errorStream] = ""
|
92
123
|
end
|
93
124
|
|
94
125
|
end
|
data/lib/common/version.rb
CHANGED
data/lib/multithread/job.rb
CHANGED
@@ -38,7 +38,9 @@ module Bake
|
|
38
38
|
@jobs = jobs
|
39
39
|
@threads = []
|
40
40
|
nr_of_threads.times do
|
41
|
-
@threads << ::Thread.new do
|
41
|
+
@threads << ::Thread.new(Thread.current[:stdout], Thread.current[:errorStream]) do |outStr, errStr|
|
42
|
+
Thread.current[:stdout] = outStr
|
43
|
+
Thread.current[:errorStream] = errStr
|
42
44
|
Jobs.incThread()
|
43
45
|
block.call(self)
|
44
46
|
Jobs.decThread()
|
data/lib/tocxx.rb
CHANGED
@@ -356,9 +356,9 @@ module Bake
|
|
356
356
|
result = callBlock(block, method) && result
|
357
357
|
ensure
|
358
358
|
ThreadsWait.all_waits(Blocks::Block::threads)
|
359
|
-
|
359
|
+
result &&= Blocks::Block.delayed_result
|
360
|
+
SyncOut.stopStream(result)
|
360
361
|
end
|
361
|
-
result &&= Blocks::Block.delayed_result
|
362
362
|
if not ignoreStopOnFirstError
|
363
363
|
return false if not result and Bake.options.stopOnFirstError
|
364
364
|
end
|
@@ -536,6 +536,7 @@ module Bake
|
|
536
536
|
rescue AbortException
|
537
537
|
ideAbort = true
|
538
538
|
end
|
539
|
+
SyncOut.flush_errors
|
539
540
|
result = callBlocks(startBlocks, :exits, true) && result
|
540
541
|
|
541
542
|
if ideAbort || Bake::IDEInterface.instance.get_abort
|
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.
|
4
|
+
version: 2.34.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: 2017-03-
|
11
|
+
date: 2017-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|