]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/feature_implicit_dependency.py
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)
8 # Tests that a single main target can be used for
9 # implicit dependencies of multiple different types.
13 t
= BoostBuild
.Tester(pass_toolset
=False)
15 t
.write("input.sss", "")
17 t
.write("Jamroot.jam", """
21 import "class" : new ;
22 import feature : feature ;
23 import toolset : flags ;
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 ;
31 feature aaa-path : : free path ;
32 feature bbb-path : : free path ;
34 class aaa-action : action
36 rule adjust-properties ( property-set )
38 local s = [ $(self.targets[1]).creating-subvariant ] ;
39 return [ $(property-set).add-raw
40 [ $(s).implicit-includes aaa-path : AAA ] ] ;
44 class aaa-generator : generator
52 class bbb-action : action
54 rule adjust-properties ( property-set )
56 local s = [ $(self.targets[1]).creating-subvariant ] ;
57 return [ $(property-set).add-raw
58 [ $(s).implicit-includes bbb-path : BBB ] ] ;
62 class bbb-generator : generator
70 generators.register-standard common.copy : SSS : AAA ;
71 generators.register-standard common.copy : SSS : BBB ;
73 # Produce two targets from a single source
74 rule make-aaa-bbb ( project name ? : property-set : sources * )
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-]) ;
84 generate input : input.sss : <generating-rule>@make-aaa-bbb ;
87 flags make-ccc AAAPATH : <aaa-path> ;
88 rule make-ccc ( target : sources * : properties * )
90 ECHO aaa path\: [ on $(target) return $(AAAPATH) ] ;
91 common.copy $(target) : $(sources) ;
94 flags make-ddd BBBPATH : <bbb-path> ;
95 rule make-ddd ( target : sources * : properties * )
97 ECHO bbb path\: [ on $(target) return $(BBBPATH) ] ;
98 common.copy $(target) : $(sources) ;
101 generators.register [ new aaa-generator $(__name__).make-ccc : SSS : CCC ] ;
102 generators.register [ new bbb-generator $(__name__).make-ddd : SSS : DDD ] ;
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 ;
111 t
.expect_output_lines(["aaa path: bin/a-loc", "bbb path: bin/b-loc"])