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