add Rscons::BuildTarget

Return a BuildTarget object from Environment#method_missing when a build target is registered.
This commit is contained in:
josh committed 2014-06-12 13:31:17 -04:00
1 parent 87b25d7bfd
commit 1b50a9dd3c
8 files changed
+69 -15

No files matched your search

+2 -2
View File
@@ -5,13 +5,13 @@ module Rscons
subject {Program.new}
it "supports overriding CC construction variable" do
subject.should_receive(:standard_build).with("LD prog#{env["PROGSUFFIX"]}", "prog#{env["PROGSUFFIX"]}", ["sp-c++", "-o", "prog#{env["PROGSUFFIX"]}", "prog.o"], ["prog.o"], env, :cache)
subject.should_receive(:standard_build).with("LD prog", "prog", ["sp-c++", "-o", "prog", "prog.o"], ["prog.o"], env, :cache)
subject.run("prog", ["prog.o"], :cache, env, "CC" => "sp-c++")
end
it "supports overriding LDCMD construction variable" do
subject.should_receive(:standard_build).with("LD prog.exe", "prog.exe", ["special", "LD!", "prog.o"], ["prog.o"], env, :cache)
subject.run("prog", ["prog.o"], :cache, env, "LDCMD" => ["special", "LD!", "${_SOURCES}"])
subject.run("prog.exe", ["prog.o"], :cache, env, "LDCMD" => ["special", "LD!", "${_SOURCES}"])
end
end
end
+3 -3
View File
@@ -295,11 +295,11 @@ module Rscons
it "records the target when the target method is a known builder" do
env = Environment.new
env.instance_variable_get(:@targets).should == {}
env.Program("target", ["src1", "src2"], var: "val")
target = env.instance_variable_get(:@targets)["target"]
env.Object("target.o", ["src1.c", "src2.c"], var: "val")
target = env.instance_variable_get(:@targets)["target.o"]
target.should_not be_nil
target[:builder].is_a?(Builder).should be_true
target[:sources].should == ["src1", "src2"]
target[:sources].should == ["src1.c", "src2.c"]
target[:vars].should == {var: "val"}
target[:args].should == []
end