Remove Rscons.application.vars
This commit is contained in:
parent
b1b94595f6
commit
dbd764749b
@ -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")
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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\.\.\./
|
||||
|
Loading…
x
Reference in New Issue
Block a user