diff --git a/build_tests/simple/cache_debugging.rb b/build_tests/simple/cache_debugging.rb index fc0699d..4a7c8ba 100644 --- a/build_tests/simple/cache_debugging.rb +++ b/build_tests/simple/cache_debugging.rb @@ -4,17 +4,17 @@ class DebugBuilder < Rscons::Builder finalize_command else @command = %W[gcc -c -o #{@target} #{@sources.first}] - if Rscons.vars["command_change"] + if ENV["command_change"] == "command_change" @command += %w[-Wall] end - if Rscons.vars["new_dep"] + if ENV["test"] == "new_dep" @sources += ["extra"] end - if Rscons.vars["strict_deps1"] + if ENV["test"] == "strict_deps1" @sources += ["extra"] strict_deps = true end - if Rscons.vars["strict_deps2"] + if ENV["test"] == "strict_deps2" @sources = ["extra"] + @sources strict_deps = true end @@ -30,7 +30,7 @@ end default do Environment.new do |env| env.add_builder(DebugBuilder) - if Rscons.vars["new_user_dep"] + if ENV["test"] == "new_user_dep" env.depends("foo.o", "new_dep") end env.DebugBuilder("foo.o", "simple.c") diff --git a/lib/rscons.rb b/lib/rscons.rb index c11e645..bfd14a1 100644 --- a/lib/rscons.rb +++ b/lib/rscons.rb @@ -50,13 +50,6 @@ module Rscons @application ||= Application.new end - # Access any variables set on the rscons command-line. - # - # @return [VarSet] - def vars(*args) - application.vars(*args) - end - # Return whether the given target is a phony target. # # @param target [Symbol, String] Target name. diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index 4ffa50d..0bec85f 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -21,16 +21,11 @@ module Rscons # Whether to run verbosely. attr_accessor :verbose - # @return [VarSet] - # Access any variables set on the rscons command-line. - attr_reader :vars - # Create Application instance. def initialize @build_dir = ENV["RSCONS_BUILD_DIR"] || "build" ENV.delete("RSCONS_BUILD_DIR") @n_threads = Util.determine_n_threads - @vars = VarSet.new @build_step = 0 end diff --git a/lib/rscons/cli.rb b/lib/rscons/cli.rb index 5f19d15..8604d29 100644 --- a/lib/rscons/cli.rb +++ b/lib/rscons/cli.rb @@ -111,14 +111,6 @@ module Rscons end.order!(argv) - # Set vars before loading the build script so the build script can - # refer to them. - argv.each do |arg| - if arg =~ /^([^=]+)=(.*)$/ - Rscons.application.vars[$1] = $2 - end - end - # Find the build script. if rsconscript unless File.exists?(rsconscript) diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 345c4a1..30a51e5 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -1544,16 +1544,19 @@ EOF test_dir("simple") result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(args: %w[-f cache_debugging.rb build command_change=yes]) + passenv["test"] = "command_change" + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the command used to build it has changed/ end it "prints a message when strict_deps is in use and the set of dependencies does not match" do test_dir("simple") - result = run_rscons(args: %w[-f cache_debugging.rb build strict_deps1=yes]) + passenv["test"] = "strict_deps1" + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(args: %w[-f cache_debugging.rb build strict_deps2=yes]) + passenv["test"] = "strict_deps2" + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies/ end @@ -1562,7 +1565,8 @@ EOF test_dir("simple") result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(args: %w[-f cache_debugging.rb build new_dep=yes]) + passenv["test"] = "new_dep" + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because there are new dependencies/ end @@ -1571,7 +1575,8 @@ EOF test_dir("simple") result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(args: %w[-f cache_debugging.rb build new_user_dep=yes]) + passenv["test"] = "new_user_dep" + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the set of user-specified dependency files has changed/ end @@ -2331,7 +2336,7 @@ EOF it "does everything" do test_dir "configure" create_exe "pkg-config", "echo '-DMYPACKAGE'" - result = run_rscons(args: %w[-f everything.rb configure --build=bb --prefix=/my/prefix]) + result = run_rscons(args: %w[-f everything.rb --build=bb configure --prefix=/my/prefix]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Configuring configure test\.\.\./