]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
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 | ||
7 | import BoostBuild | |
8 | import string | |
9 | ||
10 | t = BoostBuild.Tester(pass_toolset=0) | |
11 | ||
12 | t.write("a.cpp", "\n") | |
13 | ||
14 | t.write("yfc1.jam", """\ | |
15 | import feature ; | |
16 | import generators ; | |
17 | ||
18 | feature.extend toolset : yfc1 ; | |
19 | rule init ( ) { } | |
20 | ||
21 | generators.register-standard yfc1.compile : CPP : OBJ : <toolset>yfc1 ; | |
22 | generators.register-standard yfc1.link : OBJ : EXE : <toolset>yfc1 ; | |
23 | ||
24 | actions compile { yfc1-compile } | |
25 | actions link { yfc1-link } | |
26 | """) | |
27 | ||
28 | t.write( | |
29 | 'yfc1.py', | |
30 | """ | |
31 | from b2.build import feature, generators | |
32 | from b2.manager import get_manager | |
33 | ||
34 | MANAGER = get_manager() | |
35 | ENGINE = MANAGER.engine() | |
36 | ||
37 | feature.extend('toolset', ['yfc1']) | |
38 | ||
39 | generators.register_standard('yfc1.compile', ['CPP'], ['OBJ'], ['<toolset>yfc1']) | |
40 | generators.register_standard('yfc1.link', ['OBJ'], ['EXE'], ['<toolset>yfc1']) | |
41 | ||
42 | ENGINE.register_action( | |
43 | 'yfc1.compile', | |
44 | 'yfc1-compile' | |
45 | ) | |
46 | ||
47 | ENGINE.register_action( | |
48 | 'yfc1.link', | |
49 | 'yfc1-link' | |
50 | ) | |
51 | ||
52 | def init(*args): | |
53 | pass | |
54 | ||
55 | """ | |
56 | ) | |
57 | ||
58 | t.write("yfc2.jam", """\ | |
59 | import feature ; | |
60 | import toolset ; | |
61 | ||
62 | feature.extend toolset : yfc2 ; | |
63 | toolset.inherit yfc2 : yfc1 ; | |
64 | rule init ( ) { } | |
65 | ||
66 | actions link { yfc2-link } | |
67 | """) | |
68 | ||
69 | t.write( | |
70 | 'yfc2.py', | |
71 | """ | |
72 | from b2.build import feature, toolset | |
73 | from b2.manager import get_manager | |
74 | ||
75 | MANAGER = get_manager() | |
76 | ENGINE = MANAGER.engine() | |
77 | ||
78 | feature.extend('toolset', ['yfc2']) | |
79 | toolset.inherit('yfc2', 'yfc1') | |
80 | ||
81 | ENGINE.register_action('yfc2.link', 'yfc2-link') | |
82 | ||
83 | def init(*args): | |
84 | pass | |
85 | """ | |
86 | ) | |
87 | ||
88 | t.write("jamfile.jam", "exe a : a.cpp ;") | |
89 | t.write("jamroot.jam", "using yfc1 ;") | |
90 | ||
91 | t.run_build_system(["-n", "-d2", "yfc1"]) | |
92 | t.fail_test(string.find(t.stdout(), "yfc1-link") == -1) | |
93 | ||
94 | # Make sure we do not have to explicitly 'use' yfc1. | |
95 | t.write("jamroot.jam", "using yfc2 ;") | |
96 | ||
97 | t.run_build_system(["-n", "-d2", "yfc2"]) | |
98 | t.fail_test(string.find(t.stdout(), "yfc2-link") == -1) | |
99 | ||
100 | t.cleanup() |