explicit.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. import BoostBuild
  6. t = BoostBuild.Tester(use_test_config=False)
  7. t.write("jamroot.jam", """\
  8. exe hello : hello.cpp ;
  9. exe hello2 : hello.cpp ;
  10. explicit hello2 ;
  11. """)
  12. t.write("hello.cpp", "int main() {}\n")
  13. t.run_build_system()
  14. t.ignore("*.tds")
  15. t.expect_addition(BoostBuild.List("bin/$toolset/debug*/hello") * \
  16. [".exe", ".obj"])
  17. t.ignore_addition("bin/*/hello.rsp")
  18. t.expect_nothing_more()
  19. t.run_build_system(["hello2"])
  20. t.expect_addition("bin/$toolset/debug*/hello2.exe")
  21. t.rm(".")
  22. # Test that 'explicit' used in a helper rule applies to the current project, and
  23. # not to the Jamfile where the helper rule is defined.
  24. t.write("jamroot.jam", """\
  25. rule myinstall ( name : target )
  26. {
  27. install $(name)-bin : $(target) ;
  28. explicit $(name)-bin ;
  29. alias $(name) : $(name)-bin ;
  30. }
  31. """)
  32. t.write("sub/a.cpp", "\n")
  33. t.write("sub/jamfile.jam", "myinstall dist : a.cpp ;")
  34. t.run_build_system(subdir="sub")
  35. t.expect_addition("sub/dist-bin/a.cpp")
  36. t.rm("sub/dist-bin")
  37. t.write("sub/jamfile.jam", """\
  38. myinstall dist : a.cpp ;
  39. explicit dist ;
  40. """)
  41. t.run_build_system(subdir="sub")
  42. t.expect_nothing_more()
  43. t.cleanup()