1#!/usr/local/bin/python3.8
2
3# Copyright 2003 Vladimir Prus
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7import BoostBuild
8
9t = BoostBuild.Tester(use_test_config=False)
10
11t.write("jamroot.jam", """\
12exe hello : hello.cpp ;
13exe hello2 : hello.cpp ;
14explicit hello2 ;
15""")
16
17t.write("hello.cpp", "int main() {}\n")
18
19t.run_build_system()
20t.ignore("*.tds")
21t.expect_addition(BoostBuild.List("bin/$toolset/debug*/hello") * \
22    [".exe", ".obj"])
23t.ignore_addition("bin/*/hello.rsp")
24t.expect_nothing_more()
25
26t.run_build_system(["hello2"])
27t.expect_addition("bin/$toolset/debug*/hello2.exe")
28
29t.rm(".")
30
31
32# Test that 'explicit' used in a helper rule applies to the current project, and
33# not to the Jamfile where the helper rule is defined.
34t.write("jamroot.jam", """\
35rule myinstall ( name : target )
36{
37    install $(name)-bin : $(target) ;
38    explicit $(name)-bin ;
39    alias $(name) : $(name)-bin ;
40}
41""")
42
43t.write("sub/a.cpp", "\n")
44t.write("sub/jamfile.jam", "myinstall dist : a.cpp ;")
45
46t.run_build_system(subdir="sub")
47t.expect_addition("sub/dist-bin/a.cpp")
48
49t.rm("sub/dist-bin")
50
51t.write("sub/jamfile.jam", """\
52myinstall dist : a.cpp ;
53explicit dist ;
54""")
55
56t.run_build_system(subdir="sub")
57t.expect_nothing_more()
58
59t.cleanup()
60