wait for in-progress subcommands to complete on build failure - close #39

This commit is contained in:
josh committed 2017-06-26 22:44:49 -04:00
1 parent 15e52e488c
commit 2a96495e83
4 files changed
+48 -6

No files matched your search

-1
View File
@@ -70,7 +70,6 @@ module Rscons
begin
load rsconsfile
rescue Rscons::BuildError => e
$stderr.puts e.message
exit 1
end
+18 -5
View File
@@ -302,13 +302,19 @@ module Rscons
# @return [void]
def process
cache = Cache.instance
failure = nil
begin
while @job_set.size > 0 or @threaded_commands.size > 0
targets_still_building = @threaded_commands.map do |tc|
tc.build_operation[:target]
if failure
@job_set.clear!
job = nil
else
targets_still_building = @threaded_commands.map do |tc|
tc.build_operation[:target]
end
job = @job_set.get_next_job_to_run(targets_still_building)
end
job = @job_set.get_next_job_to_run(targets_still_building)
# TODO: have Cache determine when checksums may be invalid based on
# file size and/or timestamp.
@@ -323,7 +329,9 @@ module Rscons
allow_delayed_execution: true,
setup_info: job[:setup_info])
unless result
raise BuildError.new("Failed to build #{job[:target]}")
failure = "Failed to build #{job[:target]}"
$stderr.puts failure
next
end
end
@@ -351,7 +359,9 @@ module Rscons
unless @echo == :command
$stdout.puts "Failed command was: #{command_to_s(tc.command)}"
end
raise BuildError.new("Failed to build #{tc.build_operation[:target]}")
failure = "Failed to build #{tc.build_operation[:target]}"
$stderr.puts failure
break
end
end
@@ -359,6 +369,9 @@ module Rscons
ensure
cache.write
end
if failure
raise BuildError.new(failure)
end
end
# Clear all targets registered for the Environment.