suffix.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/python
  2. # Copyright 2003, 2004 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()
  7. # Regression test: when staging V2 used to change suffixes on targets
  8. # corresponding to real files.
  9. t.write("jamfile.jam", """
  10. import type : register ;
  11. register A : a1 a2 a3 ;
  12. stage a : a.a3 ;
  13. """)
  14. t.write("jamroot.jam", "")
  15. t.write("a.a3", "")
  16. t.run_build_system()
  17. t.expect_addition("a/a.a3");
  18. # Regression test: we should be able to specify empty suffix for derived target
  19. # type, even if base type has non-empty suffix.
  20. t.write("a.cpp", "")
  21. t.write("suffixes.jam", """
  22. import type ;
  23. import generators ;
  24. import common ;
  25. type.register First : first : ;
  26. type.register Second : "" : First ;
  27. generators.register-standard $(__name__).second : CPP : Second ;
  28. rule second
  29. {
  30. TOUCH on $(<) = [ common.file-creation-command ] ;
  31. }
  32. actions second
  33. {
  34. $(TOUCH) $(<)
  35. }
  36. """)
  37. t.write("suffixes.py", """
  38. import b2.build.type as type
  39. import b2.build.generators as generators
  40. import b2.tools.common as common
  41. from b2.manager import get_manager
  42. type.register("First", ["first"])
  43. type.register("Second", [""], "First")
  44. generators.register_standard("suffixes.second", ["CPP"], ["Second"])
  45. get_manager().engine().register_action("suffixes.second",
  46. "%s $(<)" % common.file_creation_command())
  47. """)
  48. t.write("jamroot.jam", """
  49. import suffixes ;
  50. """)
  51. t.write("jamfile.jam", """
  52. second a : a.cpp ;
  53. """)
  54. t.run_build_system()
  55. t.expect_addition("bin/a")
  56. t.cleanup()