]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2007 Rene Rivera. | |
4 | # Copyright 2011 Steven Watanabe | |
5 | # Distributed under the Boost Software License, Version 1.0. | |
6 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | # Added to guard against a bug causing targets to be used before they | |
9 | # themselves have finished building. This used to happen for targets built by a | |
10 | # multi-file action that got triggered by another target. | |
11 | # | |
12 | # Example: | |
13 | # When target A and target B were declared as created by a single action and | |
14 | # target A triggered running that action then, while the action was still | |
15 | # running, target B was already reporting as being built causing other targets | |
16 | # depending on target A to be built prematurely. | |
17 | ||
18 | import BoostBuild | |
19 | ||
11fdf7f2 | 20 | t = BoostBuild.Tester(["-d1"], pass_toolset=0) |
7c673cae FG |
21 | |
22 | t.write("sleep.bat", """\ | |
23 | ::@timeout /T %1 /NOBREAK >nul | |
24 | @ping 127.0.0.1 -n 2 -w 1000 >nul | |
25 | @ping 127.0.0.1 -n %1 -w 1000 >nul | |
26 | @exit /B 0 | |
27 | """) | |
28 | ||
29 | t.write("file.jam", """\ | |
30 | if $(NT) | |
31 | { | |
32 | SLEEP = @call sleep.bat ; | |
33 | } | |
34 | else | |
35 | { | |
36 | SLEEP = sleep ; | |
37 | } | |
38 | ||
39 | actions .gen. | |
40 | { | |
41 | echo 001 | |
42 | $(SLEEP) 4 | |
43 | echo 002 | |
44 | } | |
45 | rule .use.1 { DEPENDS $(<) : $(>) ; } | |
46 | actions .use.1 | |
47 | { | |
48 | echo 003 | |
49 | } | |
50 | ||
51 | rule .use.2 { DEPENDS $(<) : $(>) ; } | |
52 | actions .use.2 | |
53 | { | |
54 | $(SLEEP) 1 | |
55 | echo 004 | |
56 | } | |
57 | ||
58 | .gen. g1.generated g2.generated ; | |
59 | .use.1 u1.user : g1.generated ; | |
60 | .use.2 u2.user : g2.generated ; | |
61 | ||
62 | DEPENDS all : u1.user u2.user ; | |
63 | """) | |
64 | ||
65 | t.run_build_system(["-ffile.jam", "-j2"], stdout="""\ | |
66 | ...found 5 targets... | |
67 | ...updating 4 targets... | |
68 | .gen. g1.generated | |
69 | 001 | |
70 | 002 | |
71 | .use.1 u1.user | |
72 | 003 | |
73 | .use.2 u2.user | |
74 | 004 | |
75 | ...updated 4 targets... | |
76 | """) | |
77 | ||
78 | t.cleanup() |