bake-toolkit 2.34.1 → 2.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b11e2453cd82049d2070eb49b22ecb28d8048bde
4
- data.tar.gz: f10d2cd9bfeca29b371f7c9ee20fad0147390410
3
+ metadata.gz: 98b05bb56fe7c5eaf9c8d6c6a3c542736a790ced
4
+ data.tar.gz: 79780886841138ccce28d47f67debb6233d55da5
5
5
  SHA512:
6
- metadata.gz: f0bb5910da86ad9840662d921af520b44cb7b63b14c265ab3e3cf9e2ba3d800f23dc888fdffaea3fea7db4f6f482a088bede87ec5a968713c2eecf5825564a60
7
- data.tar.gz: bbb83467b457996c83a751383f90bae049cdba3d60c9a60258457a06a62b04bc20783ccb7c35c13b1f9eb790b9609f97aabe2f20a252cb592a5e6a9d0b6a8486
6
+ metadata.gz: f986ef4d25e75f8e6afed97a91205a5794f5165509a2afcb501863276475e79fff702dec233300d9011cc1373ae9bc3a80b37097090bd8e1c6c7434d4ed3c419
7
+ data.tar.gz: c3af0083a89660fc6bd08d86a3ea6a27ab9778e5a604cb10ce9abdc6108c739737eea2c275d3b9933139ce729458f03c4be7c2cff5c6ef5807d5505743e26987
data/bin/bakery CHANGED
@@ -138,11 +138,11 @@ module Bake
138
138
  Bake::cleanup
139
139
  ExitHelper.reset_exit_code
140
140
 
141
- if runOk == false
141
+ if runOk == false && abort == false
142
142
  exitValue = 1
143
143
  failedRuns << "bake " + cmd.join(" ")
144
144
  if @options.error
145
- msg1 << "aborted"
145
+ msg1 << "stopped on first error"
146
146
  abort = true
147
147
  break
148
148
  end
@@ -187,7 +187,9 @@ module Bake
187
187
  def self.waitForAllThreads
188
188
  if @@threads.length > 0
189
189
  STDOUT.puts "DEBUG_THREADS: Wait for all threads." if Bake.options.debug_threads
190
- ThreadsWait.all_waits(@@threads)
190
+ ThreadsWait.all_waits(@@threads) { |t|
191
+ STDOUT.puts "DEBUG_THREADS: Waited for #{t.object_id}"
192
+ }
191
193
  @@threads = []
192
194
  STDOUT.puts "DEBUG_THREADS: All threads finished." if Bake.options.debug_threads
193
195
  end
@@ -289,7 +291,7 @@ module Bake
289
291
  begin
290
292
  STDOUT.puts "DEBUG_THREADS: Wait for free thread." if Bake.options.debug_threads
291
293
  endedThread = ThreadsWait.new(@@threads).next_wait
292
- STDOUT.puts "DEBUG_THREADS: Thread free." if Bake.options.debug_threads
294
+ STDOUT.puts "DEBUG_THREADS: Thread free: #{endedThread.object_id}" if Bake.options.debug_threads
293
295
  @@threads.delete(endedThread)
294
296
  rescue ErrNoWaitingThread
295
297
  end
@@ -494,6 +496,7 @@ module Bake
494
496
  @@threads = []
495
497
  @@result = true
496
498
  @@mutex = Mutex.new
499
+ Bake::Multithread::Jobs.init_semaphore()
497
500
  end
498
501
 
499
502
  def startup
@@ -6,7 +6,7 @@ module Bake
6
6
 
7
7
  def self.run(cmdLineArray, immediateOutput=false, force=true, outpipe=nil, exitCodeArray = [0], dir = Dir.pwd)
8
8
  rd, wr = IO.pipe
9
- @@rd = rd if force
9
+ @@rd = force ? rd : nil
10
10
  duppedCmdLineArray = cmdLineArray.dup
11
11
  duppedCmdLineArray << { :chdir=>dir, :err=>wr, :out=>(outpipe ? outpipe : wr) }
12
12
  begin
@@ -14,7 +14,7 @@ module Bake
14
14
  rescue Exception => e
15
15
  return [false, e.message]
16
16
  end
17
- @@pid = pid if force
17
+ @@pid = force ? pid : nil
18
18
  wr.close
19
19
  output = ""
20
20
  begin
@@ -42,22 +42,38 @@ module Bake
42
42
  pid, status = Process.wait2(pid)
43
43
  @@pid = nil
44
44
  @@rd = nil
45
+
46
+ if status.nil? && output.empty?
47
+ puts output.inspect
48
+ output = "Process returned with unknown exit status"
49
+ puts output if immediateOutput
50
+ end
45
51
  return [false, output] if status.nil?
52
+
46
53
  exitCodeArray = [0] if exitCodeArray.empty?
47
- [(exitCodeArray.include?status.exitstatus), output]
54
+ ret = (exitCodeArray.include?status.exitstatus)
55
+ if ret == false && output.empty?
56
+ output = "Process returned with exit status #{status.exitstatus}"
57
+ puts output if immediateOutput
58
+ end
59
+ [ret, output]
48
60
  end
49
61
 
50
62
  def self.killProcess(force) # do not kill compile processes or implement rd and pid array if really needed
51
- begin
52
- @@rd.close
53
- rescue Exception => e
63
+ if @@rd
64
+ begin
65
+ @@rd.close
66
+ rescue Exception => e
67
+ end
68
+ @@rd = nil
54
69
  end
55
- begin
56
- Process.kill("KILL",@@pid)
57
- rescue Exception => e
70
+ if @@pid
71
+ begin
72
+ Process.kill("KILL",@@pid)
73
+ rescue Exception => e
74
+ end
75
+ @@pid = nil
58
76
  end
59
- @@rd = nil
60
- @@pid = nil
61
77
  end
62
78
 
63
79
  end
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.34.1"
4
+ "2.34.2"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -23,6 +23,7 @@ module Bake
23
23
 
24
24
  expectedRGen = "0.8.2"
25
25
  expectedRText = "0.9.0"
26
+ expectedConcurrent = "1.0.5"
26
27
 
27
28
  begin
28
29
  gem "rgen", "=#{expectedRGen}"
@@ -36,4 +37,10 @@ module Bake
36
37
  puts "Warning: Failed to load rtext #{expectedRText}, using latest version"
37
38
  end
38
39
 
40
+ begin
41
+ gem "concurrent-ruby", "=#{expectedConcurrent}"
42
+ rescue Exception => e
43
+ puts "Warning: Failed to load concurrent-ruby #{expectedConcurrent}, using latest version"
44
+ end
45
+
39
46
  end
@@ -1,36 +1,21 @@
1
1
  require 'common/ext/stdout'
2
2
  require 'stringio'
3
3
  require 'thread'
4
+ require 'concurrent/atomic/mutex_semaphore'
4
5
 
5
6
  module Bake
6
7
  module Multithread
7
8
 
8
9
  class Jobs
9
10
 
10
- @@mutex_sempaphore = Mutex.new
11
- @@running_threads = 0
12
- @@waiting_threads = 0
13
- @@cv = ConditionVariable.new
14
-
15
11
  def self.incThread
16
- @@mutex_sempaphore.synchronize do
17
- if @@running_threads >= Bake.options.threads
18
- @@waiting_threads += 1
19
- @@cv.wait(@@mutex_sempaphore)
20
- @@waiting_threads -= 1
21
- @@running_threads += 1
22
- else
23
- @@running_threads += 1
24
- end
25
- end
12
+ @@semaphore.acquire
26
13
  end
27
14
  def self.decThread
28
- @@mutex_sempaphore.synchronize do
29
- @@running_threads -= 1
30
- if @@waiting_threads > 0
31
- @@cv.signal
32
- end
33
- end
15
+ @@semaphore.release
16
+ end
17
+ def self.init_semaphore
18
+ @@semaphore = ::Concurrent::MutexSemaphore.new(Bake.options.threads)
34
19
  end
35
20
 
36
21
  def initialize(jobs, &block)
@@ -41,9 +26,12 @@ module Bake
41
26
  @threads << ::Thread.new(Thread.current[:stdout], Thread.current[:errorStream]) do |outStr, errStr|
42
27
  Thread.current[:stdout] = outStr
43
28
  Thread.current[:errorStream] = errStr
44
- Jobs.incThread()
45
- block.call(self)
46
- Jobs.decThread()
29
+ begin
30
+ Jobs.incThread()
31
+ block.call(self)
32
+ ensure
33
+ Jobs.decThread()
34
+ end
47
35
  end
48
36
  end
49
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.1
4
+ version: 2.34.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.7.8
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.5
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.5
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: colored
57
71
  requirement: !ruby/object:Gem::Requirement