standalone.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/python
  2. # Copyright 2003 Vladimir Prus
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE.txt or copy at
  5. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. import BoostBuild
  7. t = BoostBuild.Tester(use_test_config=False)
  8. # Regression tests: standalone project were not able to refer to targets
  9. # declared in themselves.
  10. t.write("a.cpp", "int main() {}\n")
  11. t.write("jamroot.jam", "import standalone ;")
  12. t.write("standalone.jam", """\
  13. import alias ;
  14. import project ;
  15. project.initialize $(__name__) ;
  16. project standalone ;
  17. local pwd = [ PWD ] ;
  18. alias x : $(pwd)/../a.cpp ;
  19. alias runtime : x ;
  20. """)
  21. t.write("standalone.py", """\
  22. from b2.manager import get_manager
  23. # FIXME: this is ugly as death
  24. get_manager().projects().initialize(__name__)
  25. import os ;
  26. # This use of list as parameter is also ugly.
  27. project(['standalone'])
  28. pwd = os.getcwd()
  29. alias('x', [os.path.join(pwd, '../a.cpp')])
  30. alias('runtime', ['x'])
  31. """)
  32. t.write("sub/jamfile.jam", "stage bin : /standalone//runtime ;")
  33. t.run_build_system(subdir="sub")
  34. t.expect_addition("sub/bin/a.cpp")
  35. t.cleanup()