From 79924503838a44863c4f7ba6eb4444e518c780bb Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 10 Feb 2019 21:47:34 -0500 Subject: [PATCH] Drop support for 5-argument form of Builder#run - #84 --- build_tests/custom_builder/Rsconscript | 6 +-- build_tests/custom_builder/cvar_expansion.rb | 6 +-- build_tests/custom_builder/cvar_lambda.rb | 8 ++-- .../custom_builder/multiple_targets.rb | 3 +- build_tests/simple/builder_no_sources.rb | 2 +- .../backward_compatible_build_hooks.rb | 3 +- lib/rscons/builder.rb | 47 +++++-------------- lib/rscons/builders/cfile.rb | 12 +---- lib/rscons/builders/directory.rb | 12 +---- lib/rscons/builders/disassemble.rb | 12 +---- lib/rscons/builders/install.rb | 12 +---- lib/rscons/environment.rb | 6 +-- 12 files changed, 36 insertions(+), 93 deletions(-) diff --git a/build_tests/custom_builder/Rsconscript b/build_tests/custom_builder/Rsconscript index d38a962..b1ab7d2 100644 --- a/build_tests/custom_builder/Rsconscript +++ b/build_tests/custom_builder/Rsconscript @@ -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 <] - # 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 - # Target file name. - # @option options [Array] :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. + # @param options [Hash] + # Run options. + # @option options [String] :target + # Target file name. + # @option options [Array] :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] # Name of the target file on success or false on failure. diff --git a/lib/rscons/builders/cfile.rb b/lib/rscons/builders/cfile.rb index 470b780..81929c9 100644 --- a/lib/rscons/builders/cfile.rb +++ b/lib/rscons/builders/cfile.rb @@ -20,16 +20,8 @@ module Rscons ) # Run the builder to produce a build target. - # - # @param target [String] Target file name. - # @param sources [Array] 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, diff --git a/lib/rscons/builders/directory.rb b/lib/rscons/builders/directory.rb index e08b9d6..9e49e6a 100644 --- a/lib/rscons/builders/directory.rb +++ b/lib/rscons/builders/directory.rb @@ -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] 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) diff --git a/lib/rscons/builders/disassemble.rb b/lib/rscons/builders/disassemble.rb index a1aa40b..31468ec 100644 --- a/lib/rscons/builders/disassemble.rb +++ b/lib/rscons/builders/disassemble.rb @@ -10,16 +10,8 @@ module Rscons ) # Run the builder to produce a build target. - # - # @param target [String] Target file name. - # @param sources [Array] 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) diff --git a/lib/rscons/builders/install.rb b/lib/rscons/builders/install.rb index 036570b..cca8fbd 100644 --- a/lib/rscons/builders/install.rb +++ b/lib/rscons/builders/install.rb @@ -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] 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) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 05998d7..6b735b4 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -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 + rv = builder.run(build_operation) (@side_effects[build_operation[:target]] || []).each do |side_effect_file| # Register side-effect files as build targets so that a Cache clean