From 4ed584701a3a2cee17ffe956c18a2bc696e2b645 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 17 May 2017 13:50:31 -0400 Subject: [PATCH] pass setup_info to the builder's #run method --- lib/rscons/environment.rb | 12 +++++++++--- spec/rscons/environment_spec.rb | 8 ++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index ef46d51..90fde90 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -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] 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 diff --git a/spec/rscons/environment_spec.rb b/spec/rscons/environment_spec.rb index a4094d9..d6ac557 100644 --- a/spec/rscons/environment_spec.rb +++ b/spec/rscons/environment_spec.rb @@ -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/