]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/feature_implicit_dependency.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / test / feature_implicit_dependency.py
1 #!/usr/bin/python
2
3 # Copyright (c) Steven Watanabe 2018.
4 # Distributed under the Boost Software License, Version 1.0. (See
5 # accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
7
8 # Tests that a single main target can be used for
9 # implicit dependencies of multiple different types.
10
11 import BoostBuild
12
13 t = BoostBuild.Tester(pass_toolset=False)
14
15 t.write("input.sss", "")
16
17 t.write("Jamroot.jam", """
18 import type ;
19 import common ;
20 import generators ;
21 import "class" : new ;
22 import feature : feature ;
23 import toolset : flags ;
24
25 type.register AAA : aaa ;
26 type.register BBB : bbb ;
27 type.register CCC : ccc ;
28 type.register DDD : ddd ;
29 type.register SSS : sss ;
30
31 feature aaa-path : : free path ;
32 feature bbb-path : : free path ;
33
34 class aaa-action : action
35 {
36 rule adjust-properties ( property-set )
37 {
38 local s = [ $(self.targets[1]).creating-subvariant ] ;
39 return [ $(property-set).add-raw
40 [ $(s).implicit-includes aaa-path : AAA ] ] ;
41 }
42 }
43
44 class aaa-generator : generator
45 {
46 rule action-class ( )
47 {
48 return aaa-action ;
49 }
50 }
51
52 class bbb-action : action
53 {
54 rule adjust-properties ( property-set )
55 {
56 local s = [ $(self.targets[1]).creating-subvariant ] ;
57 return [ $(property-set).add-raw
58 [ $(s).implicit-includes bbb-path : BBB ] ] ;
59 }
60 }
61
62 class bbb-generator : generator
63 {
64 rule action-class ( )
65 {
66 return bbb-action ;
67 }
68 }
69
70 generators.register-standard common.copy : SSS : AAA ;
71 generators.register-standard common.copy : SSS : BBB ;
72
73 # Produce two targets from a single source
74 rule make-aaa-bbb ( project name ? : property-set : sources * )
75 {
76 local result ;
77 local aaa = [ generators.construct $(project) $(name) : AAA :
78 [ $(property-set).add-raw <location-prefix>a-loc ] : $(sources) ] ;
79 local bbb = [ generators.construct $(project) $(name) : BBB :
80 [ $(property-set).add-raw <location-prefix>b-loc ] : $(sources) ] ;
81 return [ $(aaa[1]).add $(bbb[1]) ] $(aaa[2-]) $(bbb[2-]) ;
82 }
83
84 generate input : input.sss : <generating-rule>@make-aaa-bbb ;
85 explicit input ;
86
87 flags make-ccc AAAPATH : <aaa-path> ;
88 rule make-ccc ( target : sources * : properties * )
89 {
90 ECHO aaa path\: [ on $(target) return $(AAAPATH) ] ;
91 common.copy $(target) : $(sources) ;
92 }
93
94 flags make-ddd BBBPATH : <bbb-path> ;
95 rule make-ddd ( target : sources * : properties * )
96 {
97 ECHO bbb path\: [ on $(target) return $(BBBPATH) ] ;
98 common.copy $(target) : $(sources) ;
99 }
100
101 generators.register [ new aaa-generator $(__name__).make-ccc : SSS : CCC ] ;
102 generators.register [ new bbb-generator $(__name__).make-ddd : SSS : DDD ] ;
103
104 # This should have <aaapath>bin/a-loc
105 ccc output-c : input.sss : <implicit-dependency>input ;
106 # This should have <bbbpath>bin/b-loc
107 ddd output-d : input.sss : <implicit-dependency>input ;
108 """)
109
110 t.run_build_system()
111 t.expect_output_lines(["aaa path: bin/a-loc", "bbb path: bin/b-loc"])
112
113 t.cleanup()