build_hooks.py 747 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/python
  2. # Copyright (C) Vladimir Prus 2006.
  3. # Distributed under the Boost Software License, Version 1.0. (See
  4. # accompanying file LICENSE.txt or copy at
  5. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. # Tests add-pre-build-hook and add-post-build-hook
  7. import BoostBuild
  8. t = BoostBuild.Tester()
  9. t.write("Jamroot.jam", """
  10. import build-system ;
  11. build-system.add-pre-build-hook pre-build ;
  12. build-system.add-post-build-hook post-build ;
  13. rule pre-build ( )
  14. {
  15. ECHO "in" pre-build hook ;
  16. }
  17. rule post-build ( okay ? )
  18. {
  19. ECHO "in" post-build hook $(okay) ;
  20. }
  21. message show : building main targets ;
  22. """)
  23. t.run_build_system(stdout="""\
  24. building main targets
  25. in pre-build hook
  26. ...found 1 target...
  27. in post-build hook ok
  28. """)
  29. t.cleanup()