]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/boostbook/xsl/testing/Jamfile.xsl
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / boostbook / xsl / testing / Jamfile.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 -->
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 version="1.0">
11 <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>
12 <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/>
13
14 <!-- The root of the Boost directory -->
15 <xsl:param name="boost.root"/>
16
17 <!-- The number of columns in a source file line -->
18 <xsl:param name="boost.source.columns" select="78"/>
19
20 <xsl:output method="text"/>
21 <xsl:template match="/">
22 <xsl:if test="$boost.root">
23 <!-- Output testsuite Jamfiles -->
24 <xsl:apply-templates select="//testsuite" mode="Jamfile"/>
25
26 <!-- Output any source files that are written in XML -->
27 <xsl:apply-templates select="//source" mode="testsuite.generate"/>
28 </xsl:if>
29
30 <xsl:if test="not($boost.root)">
31 <xsl:message>
32 Please set the XSL stylesheet parameter "boost.root" to the top-level
33 Boost directory (i.e., BOOST_ROOT)
34 </xsl:message>
35 </xsl:if>
36 </xsl:template>
37
38 <xsl:template match="testsuite" mode="Jamfile">
39 <xsl:variable name="subproject"
40 select="concat('libs/',ancestor::library/attribute::dirname,'/test')"/>
41 <xsl:variable name="filename"
42 select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
43 '/test/Jamfile')"/>
44 <xsl:call-template name="write.text.chunk">
45 <xsl:with-param name="filename" select="$filename"/>
46 <xsl:with-param name="content">
47 <xsl:call-template name="source.print.header">
48 <xsl:with-param name="prefix" select="'#'"/>
49 </xsl:call-template>
50
51 # Testing Jamfile autogenerated from XML source
52 subproject <xsl:value-of select="$subproject"/> ;
53
54 # bring in rules for testing
55 SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
56 include testing.jam ;
57
58 # Make tests run by default.
59 DEPENDS all : test ;
60
61 {
62 # look in BOOST_ROOT for sources first, just in this Jamfile
63 local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ;
64
65 test-suite <xsl:value-of select="ancestor::library/attribute::dirname"/>
66 : <xsl:apply-templates mode="Jamfile"/> ;
67 }
68 </xsl:with-param>
69 </xsl:call-template>
70 </xsl:template>
71
72 <xsl:template match="compile-test|link-test|run-test|compile-fail-test|link-fail-test|run-fail-test"
73 mode="Jamfile">
74 <xsl:variable name="fullname"
75 select="concat(substring-before(local-name(.), '-test'), ' libs/',
76 ancestor::library/attribute::dirname, '/test/',
77 @filename)"/>
78 <xsl:text>[ </xsl:text>
79 <xsl:value-of select="$fullname"/>
80 <xsl:apply-templates select="lib" mode="Jamfile"/>
81 <xsl:text> : </xsl:text>
82 <!-- ... -->
83 <xsl:text> : </xsl:text>
84 <!-- ... -->
85 <xsl:text> : </xsl:text>
86 <xsl:apply-templates select="requirement" mode="Jamfile"/>
87 <!-- ... -->
88 <xsl:text> : </xsl:text>
89 <xsl:if test="@name">
90 <xsl:value-of select="@name"/>
91 </xsl:if>
92 <xsl:text> ]</xsl:text>
93 </xsl:template>
94
95 <xsl:template match="lib" mode="Jamfile">
96 <xsl:text> &lt;lib&gt;</xsl:text><xsl:value-of select="text()"/>
97 </xsl:template>
98
99 <xsl:template match="requirement" mode="Jamfile">
100 <xsl:if test="count(preceding-sibling::requirement) &gt; 0">
101 <xsl:text> </xsl:text>
102 </xsl:if>
103 <xsl:value-of select="concat('&lt;', @name, '&gt;')"/>
104 <xsl:value-of select="."/>
105 </xsl:template>
106
107 <xsl:template match="source" mode="testsuite.generate">
108 <xsl:variable name="filename"
109 select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
110 '/test/',../@filename)"/>
111
112 <xsl:variable name="prefix" select="'//'"/>
113
114 <xsl:call-template name="write.text.chunk">
115 <xsl:with-param name="filename" select="$filename"/>
116 <xsl:with-param name="content">
117 <xsl:call-template name="source.print.header">
118 <xsl:with-param name="prefix" select="'//'"/>
119 </xsl:call-template>
120 <!-- Source code -->
121 <xsl:apply-templates mode="testsuite.generate"/>
122 </xsl:with-param>
123 </xsl:call-template>
124 </xsl:template>
125
126 <xsl:template match="snippet" mode="testsuite.generate">
127 <xsl:variable name="snippet-name" select="@name"/>
128 <xsl:value-of select="//programlisting[@name=$snippet-name]"/>
129 </xsl:template>
130
131 <!-- Prints a header to a source file containing the library name,
132 copyright information, license information, and a link to the Boost
133 web site. The text is output using the "prefix" parameter at the
134 beginning of each line (it should denote a single-line comment) and
135 will only print up to boost.source.columns characters per line
136 (including the prefix). -->
137 <xsl:template name="source.print.header">
138 <xsl:param name="prefix"/>
139
140 <!-- Library name -->
141 <xsl:value-of select="concat($prefix, ' ',
142 ancestor::library/attribute::name,
143 ' library')"/>
144 <xsl:text>&#10;</xsl:text>
145
146 <!-- Copyrights -->
147 <xsl:apply-templates select="ancestor::library/libraryinfo/copyright"
148 mode="testsuite.generate">
149 <xsl:with-param name="prefix" select="$prefix"/>
150 </xsl:apply-templates>
151
152 <!-- Legal notice -->
153 <xsl:apply-templates select="ancestor::library/libraryinfo/legalnotice"
154 mode="testsuite.generate">
155 <xsl:with-param name="prefix" select="$prefix"/>
156 </xsl:apply-templates>
157
158 <xsl:text>&#10;&#10;</xsl:text>
159
160 <!-- For more information... -->
161 <xsl:value-of
162 select="concat($prefix,
163 ' For more information, see http://www.boost.org/')"/>
164 <xsl:text>&#10;</xsl:text>
165 </xsl:template>
166
167 <xsl:template match="copyright" mode="testsuite.generate">
168 <xsl:param name="prefix"/>
169
170 <xsl:text>&#10;</xsl:text>
171
172 <xsl:value-of select="concat($prefix, ' Copyright (C) ')"/>
173 <xsl:call-template name="copyright.years">
174 <xsl:with-param name="years" select="year"/>
175 <xsl:with-param name="print.ranges" select="1"/>
176 <xsl:with-param name="single.year.ranges" select="1"/>
177 </xsl:call-template>
178
179 <xsl:text> </xsl:text>
180
181 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
182 </xsl:template>
183
184 <xsl:template match="legalnotice" mode="testsuite.generate">
185 <xsl:param name="prefix"/>
186
187 <xsl:variable name="text" select="normalize-space(.)"/>
188
189 <xsl:text>&#10;&#10;</xsl:text>
190 <xsl:value-of select="concat($prefix, ' ')"/>
191
192 <xsl:call-template name="source.print.legalnotice">
193 <xsl:with-param name="prefix" select="$prefix"/>
194 <xsl:with-param name="text" select="$text"/>
195 <xsl:with-param name="column" select="string-length($prefix) + 1"/>
196 </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template name="source.print.legalnotice">
200 <xsl:param name="prefix"/>
201 <xsl:param name="text"/>
202 <xsl:param name="column"/>
203
204 <xsl:if test="contains($text, ' ') or string-length($text) &gt; 0">
205 <xsl:variable name="word">
206 <xsl:choose>
207 <xsl:when test="contains($text, ' ')">
208 <xsl:value-of select="substring-before($text, ' ')"/>
209 </xsl:when>
210 <xsl:otherwise>
211 <xsl:value-of select="$text"/>
212 </xsl:otherwise>
213 </xsl:choose>
214 </xsl:variable>
215
216 <xsl:variable name="rest" select="substring-after($text, ' ')"/>
217
218 <xsl:choose>
219 <xsl:when
220 test="$column + string-length($word) &gt; $boost.source.columns">
221 <xsl:text>&#10;</xsl:text>
222 <xsl:value-of select="concat($prefix, ' ')"/>
223 <xsl:call-template name="source.print.legalnotice">
224 <xsl:with-param name="prefix" select="$prefix"/>
225 <xsl:with-param name="text" select="$text"/>
226 <xsl:with-param name="column" select="string-length($prefix) + 1"/>
227 </xsl:call-template>
228 </xsl:when>
229 <xsl:otherwise>
230 <xsl:value-of select="concat($word, ' ')"/>
231 <xsl:call-template name="source.print.legalnotice">
232 <xsl:with-param name="prefix" select="$prefix"/>
233 <xsl:with-param name="text" select="$rest"/>
234 <xsl:with-param name="column"
235 select="$column + string-length($word) + 1"/>
236 </xsl:call-template>
237 </xsl:otherwise>
238 </xsl:choose>
239 </xsl:if>
240 </xsl:template>
241
242 <xsl:template match="*" mode="testsuite.generate"/>
243 </xsl:stylesheet>