]> git.saurik.com Git - wxWidgets.git/blame - build/buildbot/config/include.xml
forgot to commit
[wxWidgets.git] / build / buildbot / config / include.xml
CommitLineData
c005fb28
MW
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 <description>
172 compiling <xsl:value-of select="$dir"/>
173 </description>
174 <descriptionDone>
175 compile <xsl:value-of select="$dir"/>
176 </descriptionDone>
177 <haltOnFailure>
178 <xsl:value-of select="$halt"/>
179 </haltOnFailure>
180 <warnOnFailure/>
181 </defaults>
182 <copy-with-defaults content="{$content}">
183 <command>cd <xsl:value-of select="$dir"/> &amp;&amp; <get name="make" default="make"/></command>
184 </copy-with-defaults>
185 </compile>
186</xsl:template>
187
188<!--
189 run-tests - build step to run the test suites.
190
191 Usage: as <test>
192
193 For unix builds typically just:
194 <run-tests/>
195 or for Windows builds, e.g.:
196 <run-tests>
197 <command>PATH=..\lib\vc_lib;%PATH%</command>
198 <command>cd tests &amp;&amp; vc_msw\test</command>
199 </run-tests>
200-->
201<xsl:template name="run-tests">
202 <xsl:param name="content"/>
203 <test>
204 <defaults content="{$content}">
205 <description>running tests</description>
206 <descriptionDone>run tests</descriptionDone>
207 <warnOnFailure/>
208 </defaults>
209 <copy-with-defaults content="{$content}">
210 <command><xi:include href="run-tests.sh" parse="text"/></command>
211 </copy-with-defaults>
212 </test>
213</xsl:template>
214
215<!--
216 defaults - supply default content for an element.
217
218 Usage: <defaults content="{$content}">
219 <foo>foo</foo>
220 <bar>bar</bar>
221 </defaults>
222
223 Copies those child elements that do not already exist in $content.
224-->
225<xsl:template name="defaults">
226 <xsl:param name="defaults"/>
227 <xsl:param name="content"/>
228
229 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
230 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
231
232 <xsl:for-each select="$def-nodes/*">
233 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
234 <xsl:copy-of select="."/>
235 </xsl:if>
236 </xsl:for-each>
237</xsl:template>
238
239<!--
240 copy-with-defaults - copy elements supplying defaults for any that are
241 missing or empty.
242
243 Usage: <copy-with-defaults content="{$content}">
244 <foo>foo</foo>
245 <bar>bar</bar>
246 </copy-with-defaults>
247
248 Copies $content plus any child elements that do not exist in $content,
249 substituting empty elements in $content with any child elements of the
250 same name.
251-->
252<xsl:template name="copy-with-defaults">
253 <xsl:param name="defaults"/>
254 <xsl:param name="content"/>
255
256 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
257 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
258
259 <xsl:for-each select="$def-nodes/*">
260 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
261 <xsl:copy-of select="."/>
262 </xsl:if>
263 </xsl:for-each>
264
265 <xsl:for-each select="$cont-nodes/*">
266 <xsl:choose>
267 <xsl:when test="not(node())">
268 <xsl:copy-of select="$def-nodes/*[name() = name(current())]"/>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:copy-of select="."/>
272 </xsl:otherwise>
273 </xsl:choose>
274 </xsl:for-each>
275</xsl:template>
276
277<!--
278 get - gets the value of a named element inside a <build>.
279
280 Usage: <get name="foobar" [ default="value" ]/>
281
282 Used inside a <build> evaluates to the value of the build's <foobar>
283 element, or to the value of the optional 'default' attribute if there is
284 no such element.
285-->
286<xsl:template name="get">
287 <xsl:param name="content"/>
288 <xsl:param name="name"/>
289 <xsl:param name="default"/>
290 <strip>
291 <xsl:choose>
292 <xsl:when test="ancestor-or-self::build/*[name() = $name]">
293 <xsl:apply-templates select="ancestor-or-self::build/*[name() = $name]/node()"/>
294 </xsl:when>
295 <xsl:otherwise>
296 <xsl:value-of select="$default"/>
297 </xsl:otherwise>
298 </xsl:choose>
299 </strip>
300</xsl:template>
301
302<!--
303 strip - strips leading and trailing whitespace
304
305 Usage: <strip>
306 foobar
307 </strip>
308
309 Strips leading and trailing whitespace if the content is text only,
310 otherwise copies the content unchanged.
311-->
312<xsl:template name="strip">
313 <xsl:param name="content"/>
314 <xsl:variable name="len" select="string-length($content)"/>
315 <xsl:variable name="norm" select="normalize-space($content)"/>
316 <xsl:variable name="normlen" select="string-length($norm)"/>
317 <xsl:choose>
318 <xsl:when test="exsl:node-set($content)/*">
319 <xsl:copy-of select="$content"/>
320 </xsl:when>
321 <xsl:when test="substring($content, 1, 1) != substring($norm, 1, 1)">
322 <xsl:call-template name="strip">
323 <xsl:with-param name="content" select="substring($content, 2)"/>
324 </xsl:call-template>
325 </xsl:when>
326 <xsl:when test="substring($content, $len, 1) != substring($norm, $normlen, 1)">
327 <xsl:call-template name="strip">
328 <xsl:with-param name="content" select="substring($content, 1, $len - 1)"/>
329 </xsl:call-template>
330 </xsl:when>
331 <xsl:otherwise>
332 <xsl:value-of select="$content"/>
333 </xsl:otherwise>
334 </xsl:choose>
335</xsl:template>
336
337</bot>