Drop support for 5-argument form of Builder#run - #84
This commit is contained in:
parent
b41a368da1
commit
7992450383
@ -1,11 +1,11 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE 5678
|
||||
EOF
|
||||
end
|
||||
target
|
||||
@target
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE 678
|
||||
EOF
|
||||
end
|
||||
target
|
||||
@target
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE #{env.expand_varref("${the_value}")}
|
||||
#define THE_VALUE #{@env.expand_varref("${the_value}")}
|
||||
EOF
|
||||
end
|
||||
target
|
||||
@target
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
class CHGen < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
c_fname = target
|
||||
h_fname = target.sub(/\.c$/, ".h")
|
||||
unless cache.up_to_date?([c_fname, h_fname], "", sources, env)
|
||||
|
@ -1,5 +1,5 @@
|
||||
class TestBuilder < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
class MyObject < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
env.run_builder(env.builders["Object"].new(target: target, sources: sources, cache: cache, env: env, vars: vars), target, sources, cache, vars)
|
||||
end
|
||||
end
|
||||
|
@ -86,29 +86,6 @@ module Rscons
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
#
|
||||
# The run method supports two different signatures - an older signature
|
||||
# with five separate arguments, and a newer one with one Hash argument. A
|
||||
# builder author can use either signature, and Rscons will automatically
|
||||
# determine which arguments to pass when invoking the run method based on
|
||||
# the method's arity.
|
||||
#
|
||||
# @overload run(target, sources, cache, env, vars)
|
||||
#
|
||||
# @param target [String]
|
||||
# Target file name.
|
||||
# @param sources [Array<String>]
|
||||
# Source file name(s).
|
||||
# @param cache [Cache]
|
||||
# The Cache object.
|
||||
# @param env [Environment]
|
||||
# The Environment executing the builder.
|
||||
# @param vars [Hash,VarSet]
|
||||
# Extra construction variables.
|
||||
#
|
||||
# @overload run(options)
|
||||
#
|
||||
# @since 1.10.0
|
||||
#
|
||||
# @param options [Hash]
|
||||
# Run options.
|
||||
# @option options [String] :target
|
||||
|
@ -20,16 +20,8 @@ module Rscons
|
||||
)
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
#
|
||||
# @param target [String] Target file name.
|
||||
# @param sources [Array<String>] Source file name(s).
|
||||
# @param cache [Cache] The Cache object.
|
||||
# @param env [Environment] The Environment executing the builder.
|
||||
# @param vars [Hash,VarSet] Extra construction variables.
|
||||
#
|
||||
# @return [String,false]
|
||||
# Name of the target file on success or false on failure.
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
vars = vars.merge({
|
||||
"_TARGET" => target,
|
||||
"_SOURCES" => sources,
|
||||
|
@ -4,16 +4,8 @@ module Rscons
|
||||
class Directory < Builder
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
#
|
||||
# @param target [String] Target file name.
|
||||
# @param sources [Array<String>] Source file name(s).
|
||||
# @param cache [Cache] The Cache object.
|
||||
# @param env [Environment] The Environment executing the builder.
|
||||
# @param vars [Hash,VarSet] Extra construction variables.
|
||||
#
|
||||
# @return [String,false]
|
||||
# Name of the target file on success or false on failure.
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
if File.directory?(target)
|
||||
target
|
||||
elsif File.exists?(target)
|
||||
|
@ -10,16 +10,8 @@ module Rscons
|
||||
)
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
#
|
||||
# @param target [String] Target file name.
|
||||
# @param sources [Array<String>] Source file name(s).
|
||||
# @param cache [Cache] The Cache object.
|
||||
# @param env [Environment] The Environment executing the builder.
|
||||
# @param vars [Hash,VarSet] Extra construction variables.
|
||||
#
|
||||
# @return [String,false]
|
||||
# Name of the target file on success or false on failure.
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
vars = vars.merge("_SOURCES" => sources)
|
||||
command = env.build_command("${DISASM_CMD}", vars)
|
||||
if cache.up_to_date?(target, command, sources, env)
|
||||
|
@ -6,16 +6,8 @@ module Rscons
|
||||
class Install < Builder
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
#
|
||||
# @param target [String] Target file name.
|
||||
# @param sources [Array<String>] Source file name(s).
|
||||
# @param cache [Cache] The Cache object.
|
||||
# @param env [Environment] The Environment executing the builder.
|
||||
# @param vars [Hash,VarSet] Extra construction variables.
|
||||
#
|
||||
# @return [String,false]
|
||||
# Name of the target file on success or false on failure.
|
||||
def run(target, sources, cache, env, vars)
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
target_is_dir = (sources.length > 1) ||
|
||||
Dir.exists?(sources.first) ||
|
||||
Dir.exists?(target)
|
||||
|
@ -541,11 +541,7 @@ module Rscons
|
||||
call_build_hooks[:pre]
|
||||
|
||||
# Call the builder's #run method.
|
||||
if builder.method(:run).arity == 5
|
||||
rv = builder.run(*build_operation.values_at(:target, :sources, :cache, :env, :vars))
|
||||
else
|
||||
rv = builder.run(build_operation)
|
||||
end
|
||||
|
||||
(@side_effects[build_operation[:target]] || []).each do |side_effect_file|
|
||||
# Register side-effect files as build targets so that a Cache clean
|
||||
|
Loading…
x
Reference in New Issue
Block a user