Store build targets, sources, and user dependencies internally as absolute paths
This commit is contained in:
1 parent
a3d739c472
commit
13bd827d57
8 files changed
+69
-51
No files matched your search
@@ -726,7 +726,7 @@ test 'supports build hooks to override the entire vars hash' do
|
||||
result = run_rscons(args: %w[-f build_hooks_override_vars.rb])
|
||||
expect_eq(result.stderr, "")
|
||||
verify_lines(lines(result.stdout), [
|
||||
%r{gcc -c -o one.o -MMD -MF build/o/one.o.mf -Isrc -Isrc/one -Isrc/two -O1 src/two/two.c},
|
||||
%r{gcc -c -o one.o -MMD -MF build/o/one.o.mf -Isrc -Isrc/one -Isrc/two -O1 src/one/one.c},
|
||||
%r{gcc -c -o two.o -MMD -MF build/o/two.o.mf -Isrc -Isrc/one -Isrc/two -O2 src/two/two.c},
|
||||
])
|
||||
expect_truthy(File.exist?('one.o'))
|
||||
@@ -3557,4 +3557,12 @@ test "supports a Barrier builder to order builds" do
|
||||
expect_match(slines[2], /B:one/)
|
||||
end
|
||||
|
||||
test "maps relative paths to absolute paths for dependency resolution" do
|
||||
test_dir "simple"
|
||||
result = run_rscons(args: %w[-f abs_rel_paths.rb])
|
||||
expect_eq(result.stderr, "")
|
||||
expect_eq(result.status, 0)
|
||||
expect_match(result.stdout, /three.*two.*one/m)
|
||||
end
|
||||
|
||||
run_tests
|
||||
@@ -0,0 +1,14 @@
|
||||
class B < Builder
|
||||
def run(*args)
|
||||
puts @target
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
env do |env|
|
||||
env.add_builder(B)
|
||||
env.B("one", File.expand_path("two"))
|
||||
env.B("two")
|
||||
env.B("three")
|
||||
env.depends("two", File.expand_path("three"))
|
||||
end
|
||||
@@ -3,7 +3,6 @@ env(echo: :command) do |env|
|
||||
env.add_build_hook do |builder|
|
||||
if builder.name == "Object" && builder.sources.first =~ %r{one\.c}
|
||||
builder.vars["CFLAGS"] << "-O1"
|
||||
builder.sources = ['src/two/two.c']
|
||||
elsif builder.name == "Object" && builder.target =~ %r{two\.o}
|
||||
new_vars = builder.vars.clone
|
||||
new_vars["CFLAGS"] << "-O2"
|
||||
|
||||
Reference in new issue
Block a user