2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-02 20:52:13 +00:00
Files
build/test/project_root_constants.py
Vladimir Prus daf4d58c63 * build/project.jam
(load-parent): New rule, extracted from 'initilize'.
  (load-jamfile): If loading project-root.jam, check for
      Jamfile and load it in the same module.
  (inherit-attributes): Simplify.
  (project-rules.constant, project-rules.path-constant): New rules.

* build/targets.jam
  (project-target.__init__): New paramater 'parent'.
  (project-target.inherit)
  (project-target.add-constant)
  (project-target.intern-constants): New rules

*


[SVN r26251]
2004-11-19 09:51:54 +00:00

69 lines
1.5 KiB
Python

#!/usr/bin/python
# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
from BoostBuild import Tester, List
from string import find
# Create a temporary working directory
t = Tester()
# Create the needed files
t.write("project-root.jam", """
constant FOO : foobar ;
ECHO $(FOO) ;
""")
t.write("Jamfile", """
""")
t.run_build_system()
t.fail_test(find(t.stdout(), "foobar") == -1)
# Regression test: when absolute paths were passed to path-constant rule,
# Boost.Build failed to recognize path as absolute and prepended current dir.
t.write("project-root.jam", """
import path ;
local here = [ path.native [ path.pwd ] ] ;
path-constant HERE : $(here) ;
if $(HERE) != $(here)
{
ECHO "PWD =" $(here) ;
ECHO "path constant =" $(HERE) ;
EXIT ;
}
""")
t.write("Jamfile", "")
t.run_build_system()
t.write("Jamfile", """
# This tests that rule 'hello' will be imported
# to children unlocalized, and will still access
# variables in this Jamfile
x = 10 ;
constant FOO : foo ;
rule hello ( ) { ECHO "Hello $(x)" ; }
""")
t.write("d/Jamfile", """
ECHO "d: $(FOO)" ;
constant BAR : bar ;
""")
t.write("d/d2/Jamfile", """
ECHO "d2: $(FOO)" ;
ECHO "d2: $(BAR)" ;
hello ;
""")
t.run_build_system(subdir="d/d2", stdout="""d: foo
d2: foo
d2: bar
Hello 10
""")
t.cleanup()