From 89944ebd2169719a26cc346fbd7d3beb00eec878 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 9 Jul 2002 15:57:21 +0000 Subject: [PATCH] Specifying target properties in target references now actually work. * new/targets.jam (basic-target.generate-source): Fix regex. * test/project_test4.py: New test. [SVN r14374] --- new/targets.jam | 6 ++--- test/project-test4/Jamfile | 3 +++ test/project-test4/a.cpp | 0 test/project-test4/lib/Jamfile | 2 ++ test/project-test4/lib/b.cpp | 0 test/project-test4/project-root.jam | 27 ++++++++++++++++++++++ test/project-test4/readme.txt | 2 ++ test/project_test4.py | 32 ++++++++++++++++++++++++++ test/test_all.py | 3 ++- v2/build/targets.jam | 6 ++--- v2/test/project-test4/Jamfile | 3 +++ v2/test/project-test4/a.cpp | 0 v2/test/project-test4/lib/Jamfile | 2 ++ v2/test/project-test4/lib/b.cpp | 0 v2/test/project-test4/project-root.jam | 27 ++++++++++++++++++++++ v2/test/project-test4/readme.txt | 2 ++ v2/test/project_test4.py | 32 ++++++++++++++++++++++++++ v2/test/test_all.py | 3 ++- 18 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 test/project-test4/Jamfile create mode 100644 test/project-test4/a.cpp create mode 100644 test/project-test4/lib/Jamfile create mode 100644 test/project-test4/lib/b.cpp create mode 100644 test/project-test4/project-root.jam create mode 100644 test/project-test4/readme.txt create mode 100644 test/project_test4.py create mode 100644 v2/test/project-test4/Jamfile create mode 100644 v2/test/project-test4/a.cpp create mode 100644 v2/test/project-test4/lib/Jamfile create mode 100644 v2/test/project-test4/lib/b.cpp create mode 100644 v2/test/project-test4/project-root.jam create mode 100644 v2/test/project-test4/readme.txt create mode 100644 v2/test/project_test4.py diff --git a/new/targets.jam b/new/targets.jam index a55b41a9e..196944ba7 100644 --- a/new/targets.jam +++ b/new/targets.jam @@ -261,12 +261,12 @@ rule basic-target ( name : project rule generate-source ( source : properties * ) { # Separate target name from properties override - local split = [ MATCH "([^<]*)(/<.*)?" : $(source) ] ; + local split = [ MATCH "^([^<]*)(/(<.*))?$" : $(source) ] ; local id = $(split[1]) ; local sproperties = ; - if $(split[2]) + if $(split[3]) { - sproperties = [ property.make [ feature.split $(split[2]) ] ] ; + sproperties = [ property.make [ feature.split $(split[3]) ] ] ; } # Check if such target exists diff --git a/test/project-test4/Jamfile b/test/project-test4/Jamfile new file mode 100644 index 000000000..d8a22032d --- /dev/null +++ b/test/project-test4/Jamfile @@ -0,0 +1,3 @@ + +make a.exe : a.obj lib/b.obj/on : yfc-link ; +make a.obj : a.cpp : yfc-compile ; diff --git a/test/project-test4/a.cpp b/test/project-test4/a.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/test/project-test4/lib/Jamfile b/test/project-test4/lib/Jamfile new file mode 100644 index 000000000..be2c3649a --- /dev/null +++ b/test/project-test4/lib/Jamfile @@ -0,0 +1,2 @@ + +make b.obj : b.cpp : yfc-compile ; diff --git a/test/project-test4/lib/b.cpp b/test/project-test4/lib/b.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/test/project-test4/project-root.jam b/test/project-test4/project-root.jam new file mode 100644 index 000000000..a6f85e166 --- /dev/null +++ b/test/project-test4/project-root.jam @@ -0,0 +1,27 @@ + +import property ; + +rule yfc-compile ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ property.as-path $(property-set) ] ; +} + +actions yfc-compile +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + +rule yfc-link ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ property.as-path $(property-set) ] ; +} + +actions yfc-link +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + + +IMPORT $(__name__) : yfc-compile yfc-link : : yfc-compile yfc-link ; diff --git a/test/project-test4/readme.txt b/test/project-test4/readme.txt new file mode 100644 index 000000000..ec68724af --- /dev/null +++ b/test/project-test4/readme.txt @@ -0,0 +1,2 @@ + +This test checks for correct properties of generated and used targets. \ No newline at end of file diff --git a/test/project_test4.py b/test/project_test4.py new file mode 100644 index 000000000..ec6595db5 --- /dev/null +++ b/test/project_test4.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +from BoostBuild import Tester +import os +from string import strip + +t = Tester() + + +t.set_tree("project-test4") + +t.run_build_system() + +t.expect_addition("bin/gcc/debug/threading-single/a.obj") +t.expect_content("bin/gcc/debug/threading-single/a.obj", +"""gcc/debug/threading-single +a.cpp +""") + +t.expect_addition("bin/gcc/debug/threading-single/a.exe") +t.expect_content("bin/gcc/debug/threading-single/a.exe", +"gcc/debug/threading-single\n" + +"bin/gcc/debug/threading-single/a.obj lib/bin/gcc/debug/optimization-on/threading-single/b.obj\n" +) + +t.expect_addition("lib/bin/gcc/debug/optimization-on/threading-single/b.obj") +t.expect_content("lib/bin/gcc/debug/optimization-on/threading-single/b.obj", +"""gcc/debug/optimization-on/threading-single +lib/b.cpp +""") + +os.chdir(t.original_workdir) \ No newline at end of file diff --git a/test/test_all.py b/test/test_all.py index 8a91a40d2..99644baa9 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -17,4 +17,5 @@ import startup_v1 import startup_v2 import project_test1 import project_test2 -import project_test3 \ No newline at end of file +import project_test3 +import project_test4 diff --git a/v2/build/targets.jam b/v2/build/targets.jam index a55b41a9e..196944ba7 100644 --- a/v2/build/targets.jam +++ b/v2/build/targets.jam @@ -261,12 +261,12 @@ rule basic-target ( name : project rule generate-source ( source : properties * ) { # Separate target name from properties override - local split = [ MATCH "([^<]*)(/<.*)?" : $(source) ] ; + local split = [ MATCH "^([^<]*)(/(<.*))?$" : $(source) ] ; local id = $(split[1]) ; local sproperties = ; - if $(split[2]) + if $(split[3]) { - sproperties = [ property.make [ feature.split $(split[2]) ] ] ; + sproperties = [ property.make [ feature.split $(split[3]) ] ] ; } # Check if such target exists diff --git a/v2/test/project-test4/Jamfile b/v2/test/project-test4/Jamfile new file mode 100644 index 000000000..d8a22032d --- /dev/null +++ b/v2/test/project-test4/Jamfile @@ -0,0 +1,3 @@ + +make a.exe : a.obj lib/b.obj/on : yfc-link ; +make a.obj : a.cpp : yfc-compile ; diff --git a/v2/test/project-test4/a.cpp b/v2/test/project-test4/a.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/v2/test/project-test4/lib/Jamfile b/v2/test/project-test4/lib/Jamfile new file mode 100644 index 000000000..be2c3649a --- /dev/null +++ b/v2/test/project-test4/lib/Jamfile @@ -0,0 +1,2 @@ + +make b.obj : b.cpp : yfc-compile ; diff --git a/v2/test/project-test4/lib/b.cpp b/v2/test/project-test4/lib/b.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/v2/test/project-test4/project-root.jam b/v2/test/project-test4/project-root.jam new file mode 100644 index 000000000..a6f85e166 --- /dev/null +++ b/v2/test/project-test4/project-root.jam @@ -0,0 +1,27 @@ + +import property ; + +rule yfc-compile ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ property.as-path $(property-set) ] ; +} + +actions yfc-compile +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + +rule yfc-link ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ property.as-path $(property-set) ] ; +} + +actions yfc-link +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + + +IMPORT $(__name__) : yfc-compile yfc-link : : yfc-compile yfc-link ; diff --git a/v2/test/project-test4/readme.txt b/v2/test/project-test4/readme.txt new file mode 100644 index 000000000..ec68724af --- /dev/null +++ b/v2/test/project-test4/readme.txt @@ -0,0 +1,2 @@ + +This test checks for correct properties of generated and used targets. \ No newline at end of file diff --git a/v2/test/project_test4.py b/v2/test/project_test4.py new file mode 100644 index 000000000..ec6595db5 --- /dev/null +++ b/v2/test/project_test4.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +from BoostBuild import Tester +import os +from string import strip + +t = Tester() + + +t.set_tree("project-test4") + +t.run_build_system() + +t.expect_addition("bin/gcc/debug/threading-single/a.obj") +t.expect_content("bin/gcc/debug/threading-single/a.obj", +"""gcc/debug/threading-single +a.cpp +""") + +t.expect_addition("bin/gcc/debug/threading-single/a.exe") +t.expect_content("bin/gcc/debug/threading-single/a.exe", +"gcc/debug/threading-single\n" + +"bin/gcc/debug/threading-single/a.obj lib/bin/gcc/debug/optimization-on/threading-single/b.obj\n" +) + +t.expect_addition("lib/bin/gcc/debug/optimization-on/threading-single/b.obj") +t.expect_content("lib/bin/gcc/debug/optimization-on/threading-single/b.obj", +"""gcc/debug/optimization-on/threading-single +lib/b.cpp +""") + +os.chdir(t.original_workdir) \ No newline at end of file diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 8a91a40d2..99644baa9 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -17,4 +17,5 @@ import startup_v1 import startup_v2 import project_test1 import project_test2 -import project_test3 \ No newline at end of file +import project_test3 +import project_test4