2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

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]
This commit is contained in:
Vladimir Prus
2002-07-09 15:57:21 +00:00
parent 0be5e56d68
commit 89944ebd21
18 changed files with 142 additions and 8 deletions

View File

@@ -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

View File

@@ -0,0 +1,3 @@
make a.exe : a.obj lib/b.obj/<optimization>on : yfc-link ;
make a.obj : a.cpp : yfc-compile ;

0
test/project-test4/a.cpp Normal file
View File

View File

@@ -0,0 +1,2 @@
make b.obj : b.cpp : yfc-compile ;

View File

View File

@@ -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 ;

View File

@@ -0,0 +1,2 @@
This test checks for correct properties of generated and used targets.

32
test/project_test4.py Normal file
View File

@@ -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)

View File

@@ -17,4 +17,5 @@ import startup_v1
import startup_v2
import project_test1
import project_test2
import project_test3
import project_test3
import project_test4

View File

@@ -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

View File

@@ -0,0 +1,3 @@
make a.exe : a.obj lib/b.obj/<optimization>on : yfc-link ;
make a.obj : a.cpp : yfc-compile ;

View File

View File

@@ -0,0 +1,2 @@
make b.obj : b.cpp : yfc-compile ;

View File

View File

@@ -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 ;

View File

@@ -0,0 +1,2 @@
This test checks for correct properties of generated and used targets.

32
v2/test/project_test4.py Normal file
View File

@@ -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)

View File

@@ -17,4 +17,5 @@ import startup_v1
import startup_v2
import project_test1
import project_test2
import project_test3
import project_test3
import project_test4