Remove Environment#run_builder :allow_delayed_execution option - #84
This commit is contained in:
parent
a1f5f022d1
commit
f2cfc25604
@ -1,14 +0,0 @@
|
|||||||
class MyObject < Rscons::Builder
|
|
||||||
def run(options)
|
|
||||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
|
||||||
env.run_builder(env.builders["Object"].new(env: env, target: target, sources: sources, cache: cache, vars: vars), target, sources, cache, vars)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.add_builder(MyObject)
|
|
||||||
env.MyObject("simple.o", "simple.c")
|
|
||||||
env.Program("simple.exe", "simple.o")
|
|
||||||
end
|
|
||||||
end
|
|
@ -281,8 +281,7 @@ module Rscons
|
|||||||
job[:target],
|
job[:target],
|
||||||
job[:sources],
|
job[:sources],
|
||||||
cache,
|
cache,
|
||||||
job[:vars],
|
job[:vars])
|
||||||
allow_delayed_execution: true)
|
|
||||||
unless result
|
unless result
|
||||||
failure = "Failed to build #{job[:target]}"
|
failure = "Failed to build #{job[:target]}"
|
||||||
Ansi.write($stderr, :red, failure, :reset, "\n")
|
Ansi.write($stderr, :red, failure, :reset, "\n")
|
||||||
@ -515,10 +514,6 @@ module Rscons
|
|||||||
# @param options [Hash]
|
# @param options [Hash]
|
||||||
# @since 1.10.0
|
# @since 1.10.0
|
||||||
# Options.
|
# Options.
|
||||||
# @option options [Boolean] :allow_delayed_execution
|
|
||||||
# @since 1.10.0
|
|
||||||
# Allow a threaded command to be scheduled but not yet completed before
|
|
||||||
# this method returns.
|
|
||||||
#
|
#
|
||||||
# @return [String,false] Return value from the {Builder}'s +run+ method.
|
# @return [String,false] Return value from the {Builder}'s +run+ method.
|
||||||
def run_builder(builder, target, sources, cache, vars, options = {})
|
def run_builder(builder, target, sources, cache, vars, options = {})
|
||||||
@ -554,19 +549,6 @@ module Rscons
|
|||||||
# with it when the threaded command completes.
|
# with it when the threaded command completes.
|
||||||
rv.build_operation = build_operation
|
rv.build_operation = build_operation
|
||||||
start_threaded_command(rv)
|
start_threaded_command(rv)
|
||||||
unless options[:allow_delayed_execution]
|
|
||||||
# Delayed command execution is not allowed, so we need to execute
|
|
||||||
# the command and finalize the builder now.
|
|
||||||
tc = wait_for_threaded_commands(which: [rv])
|
|
||||||
rv = finalize_builder(tc)
|
|
||||||
if rv
|
|
||||||
call_build_hooks[:post]
|
|
||||||
else
|
|
||||||
unless @echo == :command
|
|
||||||
print_failed_command(tc.command)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
call_build_hooks[:post] if rv
|
call_build_hooks[:post] if rv
|
||||||
end
|
end
|
||||||
|
@ -843,28 +843,6 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "backward compatibility" do
|
|
||||||
it "allows a builder to call Environment#run_builder in a non-threaded manner" do
|
|
||||||
test_dir("simple")
|
|
||||||
result = run_rscons(rsconscript: "run_builder.rb")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
expect(lines(result.stdout)).to include *[
|
|
||||||
"CC simple.o",
|
|
||||||
"LD simple.exe",
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
it "prints the failed build command for a threaded builder when called via Environment#run_builder without delayed execution" do
|
|
||||||
test_dir("simple")
|
|
||||||
File.open("simple.c", "wb") do |fh|
|
|
||||||
fh.write("FOOBAR")
|
|
||||||
end
|
|
||||||
result = run_rscons(rsconscript: "run_builder.rb")
|
|
||||||
expect(result.stderr).to match /Failed to build/
|
|
||||||
expect(result.stdout).to match /Failed command was: gcc/
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "CFile builder" do
|
context "CFile builder" do
|
||||||
it "builds a .c file using flex and bison" do
|
it "builds a .c file using flex and bison" do
|
||||||
test_dir("cfile")
|
test_dir("cfile")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user