Place object files for absolute source paths under build_root - close #30
This commit is contained in:
1 parent
1880e6650e
commit
8cbb9fa30e
6 files changed
+68
-7
No files matched your search
@@ -662,6 +662,15 @@ EOF
|
||||
]
|
||||
end
|
||||
|
||||
it "creates object files under the build root for absolute source paths" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "absolute_source_path.rb")
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
expect(slines[0]).to match(%r{^CC build/.*/abs\.o$})
|
||||
expect(slines[1]).to eq "LD abs.exe"
|
||||
end
|
||||
|
||||
context "backward compatibility" do
|
||||
it "allows a builder to call Environment#run_builder in a non-threaded manner" do
|
||||
test_dir("simple")
|
||||
|
||||
@@ -91,12 +91,13 @@ module Rscons
|
||||
end
|
||||
|
||||
context "with a build_root" do
|
||||
it "uses the build_root unless the path is absolute" do
|
||||
it "uses the build_root" do
|
||||
stub_const("RUBY_PLATFORM", "mingw")
|
||||
env = Environment.new
|
||||
env.build_root = "build/proj"
|
||||
expect(env.get_build_fname("src/dir/file.c", ".o")).to eq "build/proj/src/dir/file.o"
|
||||
expect(env.get_build_fname("/some/lib.c", ".a")).to eq "/some/lib.a"
|
||||
expect(env.get_build_fname("C:\\abspath\\mod.cc", ".o")).to eq "C:/abspath/mod.o"
|
||||
expect(env.get_build_fname("/some/lib.c", ".a")).to eq "build/proj/_/some/lib.a"
|
||||
expect(env.get_build_fname("C:\\abspath\\mod.cc", ".o")).to eq "build/proj/_C/abspath/mod.o"
|
||||
expect(env.get_build_fname("build\\proj\\generated.c", ".o")).to eq "build/proj/generated.o"
|
||||
expect(env.get_build_fname("build/proj.XX", ".yy")).to eq "build/proj/build/proj.yy"
|
||||
end
|
||||
|
||||
@@ -24,6 +24,34 @@ describe Rscons do
|
||||
end
|
||||
end
|
||||
|
||||
describe ".absolute_path?" do
|
||||
context "on Windows" do
|
||||
it "returns whether a path is absolute" do
|
||||
stub_const("RUBY_PLATFORM", "mingw")
|
||||
expect(Rscons.absolute_path?("/foo")).to be_truthy
|
||||
expect(Rscons.absolute_path?("\\Windows")).to be_truthy
|
||||
expect(Rscons.absolute_path?("C:\\Windows")).to be_truthy
|
||||
expect(Rscons.absolute_path?("f:\\stuff")).to be_truthy
|
||||
expect(Rscons.absolute_path?("g:/projects")).to be_truthy
|
||||
expect(Rscons.absolute_path?("x:foo")).to be_falsey
|
||||
expect(Rscons.absolute_path?("file.txt")).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
context "not on Windows" do
|
||||
it "returns whether a path is absolute" do
|
||||
stub_const("RUBY_PLATFORM", "linux")
|
||||
expect(Rscons.absolute_path?("/foo")).to be_truthy
|
||||
expect(Rscons.absolute_path?("\\Windows")).to be_falsey
|
||||
expect(Rscons.absolute_path?("C:\\Windows")).to be_falsey
|
||||
expect(Rscons.absolute_path?("f:\\stuff")).to be_falsey
|
||||
expect(Rscons.absolute_path?("g:/projects")).to be_falsey
|
||||
expect(Rscons.absolute_path?("x:foo")).to be_falsey
|
||||
expect(Rscons.absolute_path?("file.txt")).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".set_suffix" do
|
||||
it "changes the suffix to the new one" do
|
||||
expect(Rscons.set_suffix("foo.c", ".h")).to eq("foo.h")
|
||||
|
||||
Reference in new issue
Block a user