]> git.saurik.com Git - wxWidgets.git/blob - build/buildbot/config/include.xml
cleanup
[wxWidgets.git] / build / buildbot / config / include.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4 Name: include.xml
5 Purpose: Common declarations for buildbot
6 Author: Mike Wetherell
7 RCS-ID: $Id$
8 Copyright: (c) 2007 Mike Wetherell
9 Licence: wxWidgets licence
10 -->
11
12 <bot xmlns:xi="http://www.w3.org/2001/XInclude"
13 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14 xmlns:exsl="http://exslt.org/common"
15 xsl:version="1.0">
16
17 <!--
18 Constants
19 -->
20 <xsl:template name="SVN_URL">http://svn.wxwidgets.org/svn/wx/wxWidgets/</xsl:template>
21 <xsl:template name="STABLE_BRANCH">branches/WX_2_8_BRANCH</xsl:template>
22 <xsl:variable name="STABLE_BRANCH"><STABLE_BRANCH/></xsl:variable>
23
24 <!--
25 checkout - build step for source checkout.
26
27 Usage: as <svn> with defaults for <baseURL> and <defaultBranch>
28
29 Typically just:
30 <checkout/>
31 for the trunk, or:
32 <checkout branch="branches/WX_2_8_BRANCH"/>
33 to checkout a branch.
34 -->
35 <xsl:template name="checkout">
36 <xsl:param name="content"/>
37 <xsl:param name="branch" select="'trunk'"/>
38 <xsl:variable name="nodes" select="exsl:node-set($content)"/>
39 <svn>
40 <xsl:if test="not($nodes/svnurl)">
41 <xsl:if test="not($nodes/baseURL)">
42 <baseURL><SVN_URL/></baseURL>
43 </xsl:if>
44 <xsl:if test="not($nodes/defaultBranch)">
45 <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
46 </xsl:if>
47 </xsl:if>
48 <xsl:copy-of select="$content"/>
49 </svn>
50 </xsl:template>
51
52 <!--
53 configure - add the options attribute to <configure>
54
55 Usage: <configure options="-with-foobar"/>
56 -->
57 <xsl:template name="configure">
58 <xsl:param name="content"/>
59 <xsl:param name="options"/>
60 <configure>
61 <copy-with-defaults content="{$content}">
62 <command>./configure <xsl:value-of select="$options"/></command>
63 </copy-with-defaults>
64 </configure>
65 </xsl:template>
66
67 <!--
68 make - specify the make command.
69
70 Usage: <make>nmake -f makefile.vc SHARED=1</make>
71
72 Used as a child of <build> to specify the make command used by the
73 <compile> elements below, if omitted 'make' is used.
74 -->
75 <xsl:template name="make"/>
76
77 <!--
78 compile - modifiy <compile> to default to the command given by <make>
79
80 Usage: as <compile>
81
82 The <make> element of <build> spcecifies the make command used by all
83 compile build steps in the build. If <make> is not given 'make' is used.
84
85 The command for a particular compile build step can be further overridden
86 using its <command> element:
87 <compile>
88 <command>myscript</command>
89 </compile>
90 -->
91 <xsl:template name="compile">
92 <xsl:param name="content"/>
93 <compile>
94 <copy-with-defaults content="{$content}">
95 <command><get name="make" default="make"/></command>
96 </copy-with-defaults>
97 </compile>
98 </xsl:template>
99
100 <!--
101 Compile build steps for the usual subdirectories.
102
103 Usage: as <compile>
104
105 Typically just:
106 <compile-msw/>
107 <compile-samples/>
108 <compile-utils/>
109 <compile-contrib/>
110 <compile-tests/>
111
112 By default the compile command produced is:
113 cd foobar && make
114 As above, the 'make' part can be overridden using the <make> element or
115 the whole command line can be replaced using <command>.
116
117 <compile-msw> and <compile-tests> halt the build on failure, the others
118 continue with the next step (can be overridden by <haltOnFailure>).
119 -->
120 <xsl:template name="compile-msw">
121 <xsl:param name="content"/>
122 <compile-subdir dir="build\msw" halt="true">
123 <xsl:copy-of select="$content"/>
124 </compile-subdir>
125 </xsl:template>
126
127 <xsl:template name="compile-samples">
128 <xsl:param name="content"/>
129 <compile-subdir dir="samples">
130 <xsl:copy-of select="$content"/>
131 </compile-subdir>
132 </xsl:template>
133
134 <xsl:template name="compile-utils">
135 <xsl:param name="content"/>
136 <compile-subdir dir="utils">
137 <xsl:copy-of select="$content"/>
138 </compile-subdir>
139 </xsl:template>
140
141 <xsl:template name="compile-contrib">
142 <xsl:param name="content"/>
143 <compile-subdir dir="contrib">
144 <xsl:copy-of select="$content"/>
145 </compile-subdir>
146 </xsl:template>
147
148 <xsl:template name="compile-tests">
149 <xsl:param name="content"/>
150 <compile-subdir dir="tests" halt="true">
151 <xsl:copy-of select="$content"/>
152 </compile-subdir>
153 </xsl:template>
154
155 <!--
156 compile-subdir - build step to compile a subdirectory.
157
158 Usage: as <compile> plus the following attributes,
159 <compile-subdir dir="foobar" [ halt="true" ]/>
160
161 Compiles the named subdirectory 'foobar'. Continues with the next build
162 step on failure, unless the optional attibute 'halt="true"' is given.
163 The make command used is as described for the compile steps above.
164 -->
165 <xsl:template name="compile-subdir">
166 <xsl:param name="content"/>
167 <xsl:param name="dir"/>
168 <xsl:param name="halt" select="'false'"/>
169 <compile>
170 <defaults content="{$content}">
171 <name>
172 compile <xsl:value-of select="$dir"/>
173 </name>
174 <description>
175 compiling <xsl:value-of select="$dir"/>
176 </description>
177 <descriptionDone>
178 compile <xsl:value-of select="$dir"/>
179 </descriptionDone>
180 <haltOnFailure>
181 <xsl:value-of select="$halt"/>
182 </haltOnFailure>
183 <warnOnFailure/>
184 </defaults>
185 <copy-with-defaults content="{$content}">
186 <command>cd <xsl:value-of select="$dir"/> &amp;&amp; <get name="make" default="make"/></command>
187 </copy-with-defaults>
188 </compile>
189 </xsl:template>
190
191 <!--
192 run-tests - build step to run the test suites.
193
194 Usage: as <test>
195
196 For unix builds typically just:
197 <run-tests/>
198 or for Windows builds, e.g.:
199 <run-tests>
200 <command>PATH=..\lib\vc_lib;%PATH%</command>
201 <command>cd tests &amp;&amp; vc_msw\test</command>
202 </run-tests>
203 -->
204 <xsl:template name="run-tests">
205 <xsl:param name="content"/>
206 <test>
207 <defaults content="{$content}">
208 <description>running tests</description>
209 <descriptionDone>run tests</descriptionDone>
210 <warnOnFailure/>
211 </defaults>
212 <copy-with-defaults content="{$content}">
213 <command><xi:include href="run-tests.sh" parse="text"/></command>
214 </copy-with-defaults>
215 </test>
216 </xsl:template>
217
218 <!--
219 defaults - supply default content for an element.
220
221 Usage: <defaults content="{$content}">
222 <foo>foo</foo>
223 <bar>bar</bar>
224 </defaults>
225
226 Copies those child elements that do not already exist in $content.
227 -->
228 <xsl:template name="defaults">
229 <xsl:param name="defaults"/>
230 <xsl:param name="content"/>
231
232 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
233 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
234
235 <xsl:for-each select="$def-nodes/*">
236 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
237 <xsl:copy-of select="."/>
238 </xsl:if>
239 </xsl:for-each>
240 </xsl:template>
241
242 <!--
243 copy-with-defaults - copy elements supplying defaults for any that are
244 missing or empty.
245
246 Usage: <copy-with-defaults content="{$content}">
247 <foo>foo</foo>
248 <bar>bar</bar>
249 </copy-with-defaults>
250
251 Copies $content plus any child elements that do not exist in $content,
252 substituting empty elements in $content with any child elements of the
253 same name.
254 -->
255 <xsl:template name="copy-with-defaults">
256 <xsl:param name="defaults"/>
257 <xsl:param name="content"/>
258
259 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
260 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
261
262 <xsl:for-each select="$def-nodes/*">
263 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
264 <xsl:copy-of select="."/>
265 </xsl:if>
266 </xsl:for-each>
267
268 <xsl:for-each select="$cont-nodes/*">
269 <xsl:choose>
270 <xsl:when test="not(node())">
271 <xsl:copy-of select="$def-nodes/*[name() = name(current())]"/>
272 </xsl:when>
273 <xsl:otherwise>
274 <xsl:copy-of select="."/>
275 </xsl:otherwise>
276 </xsl:choose>
277 </xsl:for-each>
278 </xsl:template>
279
280 <!--
281 get - gets the value of a named element inside a <build>.
282
283 Usage: <get name="foobar" [ default="value" ]/>
284
285 Used inside a <build> evaluates to the value of the build's <foobar>
286 element, or to the value of the optional 'default' attribute if there is
287 no such element.
288 -->
289 <xsl:template name="get">
290 <xsl:param name="content"/>
291 <xsl:param name="name"/>
292 <xsl:param name="default"/>
293 <strip>
294 <xsl:choose>
295 <xsl:when test="ancestor-or-self::build/*[name() = $name]">
296 <xsl:apply-templates select="ancestor-or-self::build/*[name() = $name]/node()"/>
297 </xsl:when>
298 <xsl:otherwise>
299 <xsl:value-of select="$default"/>
300 </xsl:otherwise>
301 </xsl:choose>
302 </strip>
303 </xsl:template>
304
305 <!--
306 strip - strips leading and trailing whitespace
307
308 Usage: <strip>
309 foobar
310 </strip>
311
312 Strips leading and trailing whitespace if the content is text only,
313 otherwise copies the content unchanged.
314 -->
315 <xsl:template name="strip">
316 <xsl:param name="content"/>
317 <xsl:variable name="len" select="string-length($content)"/>
318 <xsl:variable name="norm" select="normalize-space($content)"/>
319 <xsl:variable name="normlen" select="string-length($norm)"/>
320 <xsl:choose>
321 <xsl:when test="exsl:node-set($content)/*">
322 <xsl:copy-of select="$content"/>
323 </xsl:when>
324 <xsl:when test="substring($content, 1, 1) != substring($norm, 1, 1)">
325 <xsl:call-template name="strip">
326 <xsl:with-param name="content" select="substring($content, 2)"/>
327 </xsl:call-template>
328 </xsl:when>
329 <xsl:when test="substring($content, $len, 1) != substring($norm, $normlen, 1)">
330 <xsl:call-template name="strip">
331 <xsl:with-param name="content" select="substring($content, 1, $len - 1)"/>
332 </xsl:call-template>
333 </xsl:when>
334 <xsl:otherwise>
335 <xsl:value-of select="$content"/>
336 </xsl:otherwise>
337 </xsl:choose>
338 </xsl:template>
339
340 </bot>