pass setup_info to the builder's #run method

This commit is contained in:
Josh Holtrop 2017-05-17 13:50:31 -04:00
parent 5de52620e4
commit 4ed584701a
2 changed files with 13 additions and 7 deletions

View File

@ -301,7 +301,8 @@ module Rscons
job[:sources],
cache,
job[:vars],
allow_delayed_execution: true)
allow_delayed_execution: true,
setup_info: job[:setup_info])
unless result.is_a?(ThreadedCommand)
unless result
raise BuildError.new("Failed to build #{job[:target]}")
@ -554,11 +555,15 @@ module Rscons
# @param sources [Array<String>] List of source files.
# @param cache [Cache] The Cache.
# @param vars [Hash] Extra variables to pass to the builder.
# @param options [Hash] Options.
# @param options [Hash]
# @since 1.10.0
# 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.
# @option options [Object] :setup_info
# Arbitrary builder info returned by Builder#setup.
#
# @return [String,false] Return value from the {Builder}'s +run+ method.
def run_builder(builder, target, sources, cache, vars, options = {})
@ -593,7 +598,8 @@ module Rscons
sources: sources,
cache: cache,
env: self,
vars: vars)
vars: vars,
setup_info: options[:setup_info])
else
rv = builder.run(target, sources, cache, self, vars)
end

View File

@ -170,7 +170,7 @@ module Rscons
cache = "cache"
expect(Cache).to receive(:instance).and_return(cache)
allow(cache).to receive(:clear_checksum_cache!)
expect(env).to receive(:run_builder).with(anything, "a.out", ["main.c"], cache, {}, allow_delayed_execution: true).and_return(true)
expect(env).to receive(:run_builder).with(anything, "a.out", ["main.c"], cache, {}, allow_delayed_execution: true, setup_info: nil).and_return(true)
expect(cache).to receive(:write)
env.process
@ -184,8 +184,8 @@ module Rscons
cache = "cache"
expect(Cache).to receive(:instance).and_return(cache)
allow(cache).to receive(:clear_checksum_cache!)
expect(env).to receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}, allow_delayed_execution: true).and_return("main.o")
expect(env).to receive(:run_builder).with(anything, "a.out", ["main.o"], cache, {}, allow_delayed_execution: true).and_return("a.out")
expect(env).to receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}, allow_delayed_execution: true, setup_info: nil).and_return("main.o")
expect(env).to receive(:run_builder).with(anything, "a.out", ["main.o"], cache, {}, allow_delayed_execution: true, setup_info: nil).and_return("a.out")
expect(cache).to receive(:write)
env.process
@ -199,7 +199,7 @@ module Rscons
cache = "cache"
expect(Cache).to receive(:instance).and_return(cache)
allow(cache).to receive(:clear_checksum_cache!)
expect(env).to receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}, allow_delayed_execution: true).and_return(false)
expect(env).to receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}, allow_delayed_execution: true, setup_info: nil).and_return(false)
expect(cache).to receive(:write)
expect { env.process }.to raise_error BuildError, /Failed.to.build.main.o/