]> git.saurik.com Git - wxWidgets.git/blob - build/buildbot/config/include/defs.xml
Make the gui test still run on the buildbot when the non-gui tests fail.
[wxWidgets.git] / build / buildbot / config / include / defs.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4 Name: include/defs.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:xsl="http://www.w3.org/1999/XSL/Transform"
13 xmlns:exsl="http://exslt.org/common"
14 xmlns:func="http://exslt.org/functions"
15 xmlns:get="local"
16 xsl:extension-element-prefixes="func"
17 xsl:version="1.0">
18
19 <!--
20 Constants
21 -->
22 <xsl:template name="SVN_URL">http://svn.wxwidgets.org/svn/wx/wxWidgets/</xsl:template>
23 <xsl:template name="STABLE_BRANCH">branches/WX_2_8_BRANCH</xsl:template>
24 <xsl:variable name="STABLE_BRANCH"><STABLE_BRANCH/></xsl:variable>
25 <xsl:template name="RELEASE_BRANCH">branches/WX_2_9_0_BRANCH</xsl:template>
26 <xsl:variable name="RELEASE_BRANCH"><RELEASE_BRANCH/></xsl:variable>
27 <xsl:template name="SNAPSHOT_URL">http://biolpc22.york.ac.uk/pub</xsl:template>
28
29 <!--
30 checkout - build step for source checkout.
31
32 Usage: as <svn> with defaults for <baseURL> and <defaultBranch>
33
34 Typically just:
35 <checkout/>
36 for the trunk, or:
37 <checkout branch="branches/WX_2_8_BRANCH"/>
38 to checkout a branch.
39 -->
40 <xsl:template name="checkout">
41 <xsl:param name="content"/>
42 <xsl:param name="branch" select="'trunk'"/>
43 <xsl:variable name="nodes" select="exsl:node-set($content)"/>
44 <svn>
45 <xsl:if test="not($nodes/svnurl)">
46 <xsl:if test="not($nodes/baseURL)">
47 <baseURL><SVN_URL/></baseURL>
48 </xsl:if>
49 <xsl:if test="not($nodes/defaultBranch)">
50 <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
51 </xsl:if>
52 </xsl:if>
53 <xsl:copy-of select="$content"/>
54 </svn>
55 </xsl:template>
56
57 <!--
58 configure - add the options attribute to <configure>
59
60 Usage: <configure options="-with-foobar"/>
61 -->
62 <xsl:template name="configure">
63 <xsl:param name="content"/>
64 <xsl:param name="options"/>
65 <configure>
66 <copy-with-defaults content="{$content}">
67 <command>./configure <xsl:value-of select="normalize-space($options)"/></command>
68 </copy-with-defaults>
69 </configure>
70 </xsl:template>
71
72 <!--
73 make - specify the make command.
74
75 Usage: <make>nmake -f makefile.vc SHARED=1</make>
76
77 Used as a child of <build> to specify the make command used by the
78 <compile> elements below, if omitted 'make' is used.
79 -->
80 <xsl:template name="make"/>
81
82 <!--
83 compile - modifiy <compile> to default to the command given by <make>
84
85 Usage: as <compile>
86
87 The <make> element of <build> spcecifies the make command used by all
88 compile build steps in the build. If <make> is not given 'make' is used.
89
90 The command for a particular compile build step can be further overridden
91 using its <command> element:
92 <compile>
93 <command>myscript</command>
94 </compile>
95 -->
96 <xsl:template name="compile">
97 <xsl:param name="content"/>
98 <compile>
99 <copy-with-defaults content="{$content}">
100 <command><get name="make" default="make"/></command>
101 </copy-with-defaults>
102 </compile>
103 </xsl:template>
104
105 <!--
106 Adds build steps to compile the library and the usual subdirectories.
107
108 Usage: as <compile> with the additional attributes below.
109
110 Usually the attributes default to suitable values, so typical usage
111 is just <compile-all/>.
112
113 <compile-all [ gui = 'true'|'false' ]
114 [ msw = 'true'|'false' ]
115 [ wx = 'true'|'false' ]
116 [ samples = 'true'|'false' ]
117 [ utils = 'true'|'false' ]
118 [ demos = 'true'|'false' ]
119 [ contrib = 'true'|'false' ]
120 [ tests = 'true'|'false' ] />
121
122 gui - if 'true' then build fully the subdirectories specified,
123 otherwise only the wxBase subset of the directories are built.
124 msw - if 'true' then build the directory 'build/msw' when building the
125 library instead of the root.
126 wx - build the library itself.
127 samples, utils, demos, contrib, tests
128 - build subdirectories.
129 -->
130 <xsl:template name="compile-all">
131 <xsl:param name="content"/>
132
133 <xsl:param name="gui"><is-gui/></xsl:param>
134 <xsl:param name="msw"><is-msw/></xsl:param>
135
136 <xsl:param name="wx" select="'true'"/>
137 <xsl:param name="samples" select="'true'"/>
138 <xsl:param name="utils" select="'true'"/>
139 <xsl:param name="demos" select="$gui"/>
140 <xsl:param name="contrib"><has-contrib/></xsl:param>
141 <xsl:param name="tests"><has-tests/></xsl:param>
142
143 <xsl:param name="wx-dirs">
144 <get-dirs wx="{$wx}" gui="{$gui}" msw="{$msw}"/>
145 </xsl:param>
146 <xsl:param name="sample-dirs">
147 <get-dirs samples="{$samples}" gui="{$gui}" msw="{$msw}"/>
148 </xsl:param>
149 <xsl:param name="util-dirs">
150 <get-dirs utils="{$utils}" gui="{$gui}" msw="{$msw}"/>
151 </xsl:param>
152 <xsl:param name="demo-dirs">
153 <get-dirs demos="{$demos}" gui="{$gui}" msw="{$msw}"/>
154 </xsl:param>
155 <xsl:param name="contrib-dirs">
156 <get-dirs contrib="{$contrib}" gui="{$gui}" msw="{$msw}"/>
157 </xsl:param>
158 <xsl:param name="test-dirs">
159 <get-dirs tests="{$tests}" gui="{$gui}" msw="{$msw}"/>
160 </xsl:param>
161
162 <compile-subdirs dirs="{$wx-dirs}" halt="true">
163 <xsl:copy-of select="$content"/>
164 </compile-subdirs>
165 <compile-subdirs name="samples" dirs="{$sample-dirs}">
166 <xsl:copy-of select="$content"/>
167 </compile-subdirs>
168 <compile-subdirs name="utils" dirs="{$util-dirs}">
169 <xsl:copy-of select="$content"/>
170 </compile-subdirs>
171 <compile-subdirs name="demos" dirs="{$demo-dirs}">
172 <xsl:copy-of select="$content"/>
173 </compile-subdirs>
174 <compile-subdirs name="contrib" dirs="{$contrib-dirs}">
175 <xsl:copy-of select="$content"/>
176 </compile-subdirs>
177 <compile-subdirs name="tests" dirs="{$test-dirs}" halt="true">
178 <xsl:copy-of select="$content"/>
179 </compile-subdirs>
180 </xsl:template>
181
182 <!--
183 Helper for compile-all.
184 Returns the directories that need to be built for the various components:
185 wx (the library itself), samples, utils, demos, contrib and tests.
186 -->
187 <xsl:template name="get-dirs">
188 <xsl:param name="contents"/>
189
190 <xsl:param name="gui"/>
191 <xsl:param name="msw"/>
192
193 <xsl:param name="wx"/>
194 <xsl:param name="samples"/>
195 <xsl:param name="utils"/>
196 <xsl:param name="demos"/>
197 <xsl:param name="contrib"/>
198 <xsl:param name="tests"/>
199
200 <xsl:if test="$wx = 'true'">
201 <xsl:choose>
202 <xsl:when test="$msw = 'true'">build/msw</xsl:when>
203 <xsl:otherwise>.</xsl:otherwise>
204 </xsl:choose>
205 <xsl:text> </xsl:text>
206 </xsl:if>
207
208 <xsl:if test="$samples = 'true'">
209 <xsl:choose>
210 <xsl:when test="$gui = 'true'">samples</xsl:when>
211 <xsl:otherwise>samples/console</xsl:otherwise>
212 </xsl:choose>
213 <xsl:text> </xsl:text>
214 </xsl:if>
215
216 <xsl:if test="$utils = 'true'">
217 <xsl:choose>
218 <xsl:when test="$gui = 'true'">utils</xsl:when>
219 <xsl:otherwise>utils/tex2rtf/src ../../HelpGen/src</xsl:otherwise>
220 </xsl:choose>
221 <xsl:text> </xsl:text>
222 </xsl:if>
223
224 <xsl:if test="$demos = 'true' and $gui = 'true'">demos </xsl:if>
225
226 <xsl:if test="$contrib = 'true' and $gui = 'true'">contrib </xsl:if>
227
228 <xsl:if test="$tests = 'true'">tests</xsl:if>
229 </xsl:template>
230
231 <!--
232 compile-subdir - build step to compile a subdirectory.
233
234 Usage: as <compile> plus the following attributes,
235 <compile-subdir dir="foobar" [ halt="true" ]/>
236
237 Compiles the named subdirectory 'foobar'. Continues with the next build
238 step on failure, unless the optional attibute 'halt="true"' is given.
239 The make command used is as described for the compile step above.
240 -->
241 <xsl:template name="compile-subdir">
242 <xsl:param name="content"/>
243 <xsl:param name="dir"/>
244 <xsl:param name="halt" select="'false'"/>
245 <compile-subdirs name="{$dir}" dirs="{$dir}" halt="{$halt}">
246 <xsl:copy-of select="$content"/>
247 </compile-subdirs>
248 </xsl:template>
249
250 <!--
251 compile-subdirs - adds a compile build step for each directory in a list.
252
253 Usage: as <compile> plus the following attributes,
254 <compile-subdir dirs="foobar1 foobar2"
255 [ name="foobars" ]
256 [ sep=" " ]
257 [ halt="true" ]/>
258
259 Compiles the named subdirectories. Continues with the next build
260 step on failure, unless the optional attibute 'halt="true"' is given.
261 The make command used is as described for the compile step above.
262 The 'name' attribute can be used to give a collective name for the
263 subdirectories, and the 'sep' attibute can be used to specify the
264 separator in the 'dirs' list (defaults to space).
265 -->
266 <xsl:template name="compile-subdirs">
267 <xsl:param name="content"/>
268 <xsl:param name="name"/>
269 <xsl:param name="dirs"/>
270 <xsl:param name="sep" select="' '"/>
271 <xsl:param name="halt" select="'false'"/>
272 <xsl:if test="translate($dirs, $sep, '')">
273 <compile>
274 <defaults content="{$content}">
275 <name>
276 <xsl:value-of select="normalize-space(concat('compile ', $name))"/>
277 </name>
278 <description>
279 <xsl:value-of select="normalize-space(concat('compiling ', $name))"/>
280 </description>
281 <descriptionDone>
282 <xsl:value-of select="normalize-space(concat('compile ', $name))"/>
283 </descriptionDone>
284 <haltOnFailure>
285 <xsl:value-of select="$halt"/>
286 </haltOnFailure>
287 <warnOnFailure/>
288 </defaults>
289 <copy-with-defaults content="{$content}">
290 <command>
291 <compile-subdirs-cmd dirs="{$dirs}" sep="{$sep}"/>
292 </command>
293 </copy-with-defaults>
294 </compile>
295 </xsl:if>
296 </xsl:template>
297
298 <xsl:template name="compile-subdirs-cmd">
299 <xsl:param name="content"/>
300 <xsl:param name="dirs"/>
301 <xsl:param name="sep"/>
302 <xsl:choose>
303 <xsl:when test="contains($dirs, $sep)">
304 <xsl:variable name="before" select="substring-before($dirs, $sep)"/>
305 <xsl:variable name="after" select="substring-after($dirs, $sep)"/>
306
307 <xsl:call-template name="compile-subdirs-cmd">
308 <xsl:with-param name="dirs" select="$before"/>
309 <xsl:with-param name="sep" select="$sep"/>
310 </xsl:call-template>
311
312 <xsl:if test="$after and substring($after, 1, 1) != ' '">
313 <xsl:text> &amp;&amp; </xsl:text>
314 </xsl:if>
315
316 <xsl:call-template name="compile-subdirs-cmd">
317 <xsl:with-param name="dirs" select="$after"/>
318 <xsl:with-param name="sep" select="$sep"/>
319 </xsl:call-template>
320 </xsl:when>
321 <xsl:when test="string($dirs)">
322 <xsl:if test="$dirs != '.'">cd <xsl:value-of select="$dirs"/> &amp;&amp; </xsl:if>
323 <get name="make" default="make"/>
324 </xsl:when>
325 </xsl:choose>
326 </xsl:template>
327
328 <!--
329 run-tests - build step to run the test suites.
330
331 Usage: as <test>
332
333 Typically just:
334 <run-tests/>
335 -->
336 <xsl:template name="run-tests">
337 <xsl:param name="content"/>
338 <xsl:param name="options"/>
339 <xsl:param name="msw"><is-msw/></xsl:param>
340 <test>
341 <defaults content="{$content}">
342 <description>running tests</description>
343 <descriptionDone>run tests</descriptionDone>
344 <warnOnFailure/>
345 </defaults>
346 <copy-with-defaults content="{$content}">
347 <command>
348 <xsl:choose>
349 <xsl:when test="$msw = 'true'">
350 <run-tests-win options="{$options}"/>
351 </xsl:when>
352 <xsl:otherwise>
353 <run-tests-unix options="{$options}"/>
354 </xsl:otherwise>
355 </xsl:choose>
356 </command>
357 </copy-with-defaults>
358 </test>
359 </xsl:template>
360
361 <xsl:template name="run-tests-win">
362 <xsl:param name="options"/>
363 <normalize-space>
364 cd tests &amp;&amp; runtests.bat
365 </normalize-space>
366 </xsl:template>
367
368 <xsl:template name="run-tests-unix">
369 <xsl:param name="options"/>
370 ERR=0
371 cd tests
372 ./test <xsl:value-of select="normalize-space($options)"/> || ERR=$?
373 if [ -n "$DISPLAY" -a -x test_gui ]; then ./test_gui || ERR=$?; fi
374 exit $ERR
375 </xsl:template>
376
377 <!--
378 defaults - supply default content for an element.
379
380 Usage: <defaults content="{$content}">
381 <foo>foo</foo>
382 <bar>bar</bar>
383 </defaults>
384
385 Copies those child elements that do not already exist in $content.
386 -->
387 <xsl:template name="defaults">
388 <xsl:param name="defaults"/>
389 <xsl:param name="content"/>
390
391 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
392 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
393
394 <xsl:for-each select="$def-nodes/*">
395 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
396 <xsl:copy-of select="."/>
397 </xsl:if>
398 </xsl:for-each>
399 </xsl:template>
400
401 <!--
402 copy-with-defaults - copy elements supplying defaults for any that are
403 missing or empty.
404
405 Usage: <copy-with-defaults content="{$content}">
406 <foo>foo</foo>
407 <bar>bar</bar>
408 </copy-with-defaults>
409
410 Copies $content plus any child elements that do not exist in $content,
411 substituting empty elements in $content with any child elements of the
412 same name.
413 -->
414 <xsl:template name="copy-with-defaults">
415 <xsl:param name="defaults"/>
416 <xsl:param name="content"/>
417
418 <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
419 <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
420
421 <xsl:for-each select="$def-nodes/*">
422 <xsl:if test="not($cont-nodes/*[name() = name(current())])">
423 <xsl:copy-of select="."/>
424 </xsl:if>
425 </xsl:for-each>
426
427 <xsl:for-each select="$cont-nodes/*">
428 <xsl:choose>
429 <xsl:when test="not(node())">
430 <xsl:copy-of select="$def-nodes/*[name() = name(current())]"/>
431 </xsl:when>
432 <xsl:otherwise>
433 <xsl:copy-of select="."/>
434 </xsl:otherwise>
435 </xsl:choose>
436 </xsl:for-each>
437 </xsl:template>
438
439 <!--
440 get - gets the text from a child element of the current build.
441
442 Usage: <get name="foobar" [ default="value" ]/>
443
444 Gets the text from the <foobar> element of the current build, or returns
445 $default if there is not such element.
446 -->
447 <xsl:template name="get">
448 <xsl:param name="content"/>
449 <xsl:param name="build" select="get:build()"/>
450 <xsl:param name="name"/>
451 <xsl:param name="default"/>
452 <xsl:variable name="property" select="get:property($name, $build)"/>
453 <strip>
454 <xsl:choose>
455 <xsl:when test="$property">
456 <xsl:apply-templates select="$property/node()"/>
457 </xsl:when>
458 <xsl:otherwise>
459 <xsl:value-of select="$default"/>
460 </xsl:otherwise>
461 </xsl:choose>
462 </strip>
463 </xsl:template>
464
465 <!--
466 Accessors to get builds and their fields. XSLT code should use these
467 instead of traversing the input tree directly.
468 -->
469 <func:function name="get:build">
470 <func:result select="ancestor-or-self::build[last()]"/>
471 </func:function>
472
473 <func:function name="get:all-builds">
474 <func:result select="//build[not(ancestor::*[name() != name(/*)])]"/>
475 </func:function>
476
477 <func:function name="get:preceding-builds">
478 <func:result select="get:build()/preceding-sibling::build"/>
479 </func:function>
480
481 <func:function name="get:property">
482 <xsl:param name="name"/>
483 <xsl:param name="build" select="get:build()"/>
484 <func:result select="$build/*[name() = $name]"/>
485 </func:function>
486
487 <func:function name="get:step">
488 <xsl:param name="name"/>
489 <xsl:param name="build" select="get:build()"/>
490 <func:result select="get:property('steps', $build)/*[name() = $name]"/>
491 </func:function>
492
493 <!--
494 Returns true if this is an msw build.
495 -->
496 <xsl:template name="is-msw">
497 <xsl:param name="content"/>
498 <xsl:param name="build" select="get:build()"/>
499 <xsl:value-of select="not(get:step('configure', $build))"/>
500 </xsl:template>
501
502 <!--
503 Returns true if this a gui build.
504 -->
505 <xsl:template name="is-gui">
506 <xsl:param name="content"/>
507 <xsl:param name="build" select="get:build()"/>
508 <xsl:variable name="make"><get name="make" build="{$build}"/></xsl:variable>
509 <xsl:variable name="configure"><xsl:apply-templates select="get:step('configure', $build)"/></xsl:variable>
510 <xsl:value-of select="not(contains($make, 'USE_GUI=0') or contains($configure, '--disable-gui'))"/>
511 </xsl:template>
512
513 <!--
514 Returns true if the branch we're building has a contrib subdirectory.
515 -->
516 <xsl:template name="has-contrib">
517 <xsl:param name="content"/>
518 <xsl:param name="build" select="get:build()"/>
519 <xsl:variable name="checkout"><xsl:apply-templates select="get:step('checkout', $build)"/></xsl:variable>
520 <xsl:value-of select="contains($checkout, 'WX_2_') and not(contains($checkout, 'WX_2_9_'))"/>
521 </xsl:template>
522
523 <!--
524 Returns true if the build should build the test suite.
525 -->
526 <xsl:template name="has-tests">
527 <xsl:param name="content"/>
528 <xsl:param name="build" select="get:build()"/>
529 <xsl:variable name="configure"><xsl:apply-templates select="get:step('configure', $build)"/></xsl:variable>
530 <xsl:value-of select="get:step('run-tests', $build) or contains($configure, '--host=')"/>
531 </xsl:template>
532
533 <!--
534 strip - strips leading and trailing whitespace
535
536 Usage: <strip>
537 foobar
538 </strip>
539
540 Converts to text and strips leading and trailing whitespace.
541 -->
542 <xsl:template name="strip">
543 <xsl:param name="content"/>
544 <xsl:variable name="len" select="string-length($content)"/>
545 <xsl:variable name="norm" select="normalize-space($content)"/>
546 <xsl:variable name="normlen" select="string-length($norm)"/>
547 <xsl:choose>
548 <xsl:when test="substring($content, 1, 1) != substring($norm, 1, 1)">
549 <xsl:call-template name="strip">
550 <xsl:with-param name="content" select="substring($content, 2)"/>
551 </xsl:call-template>
552 </xsl:when>
553 <xsl:when test="substring($content, $len, 1) != substring($norm, $normlen, 1)">
554 <xsl:call-template name="strip">
555 <xsl:with-param name="content" select="substring($content, 1, $len - 1)"/>
556 </xsl:call-template>
557 </xsl:when>
558 <xsl:otherwise>
559 <xsl:value-of select="$content"/>
560 </xsl:otherwise>
561 </xsl:choose>
562 </xsl:template>
563
564 <!--
565 normalize-space - normalises whitespace.
566
567 Usage: <normalize-space>
568 foobar
569 </normalize-space>
570
571 Converts to text, strips leading and trailing whitespace and replaces
572 sequences of whitespace characters by a single space.
573 -->
574 <xsl:template name="normalize-space">
575 <xsl:param name="content"/>
576 <xsl:value-of select="normalize-space($content)"/>
577 </xsl:template>
578
579 <!--
580 lower-case - converts to lower case.
581
582 Usage: <lower-case>FooBar</lower-case>
583 -->
584 <xsl:template name="lower-case">
585 <xsl:param name="content"/>
586 <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
587 <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
588 <xsl:value-of select="translate($content, $upper, $lower)"/>
589 </xsl:template>
590
591 <!--
592 Helpers to convert between day numbers and names.
593 -->
594 <xsl:template name="day-number">
595 <xsl:param name="content"/>
596 <xsl:param name="name"/>
597 <xsl:choose>
598 <xsl:when test="$name = 'monday'">0</xsl:when>
599 <xsl:when test="$name = 'tuesday'">1</xsl:when>
600 <xsl:when test="$name = 'wednesday'">2</xsl:when>
601 <xsl:when test="$name = 'thursday'">3</xsl:when>
602 <xsl:when test="$name = 'friday'">4</xsl:when>
603 <xsl:when test="$name = 'saturday'">5</xsl:when>
604 <xsl:when test="$name = 'sunday'">6</xsl:when>
605 </xsl:choose>
606 </xsl:template>
607
608 <xsl:template name="day-name">
609 <xsl:param name="content"/>
610 <xsl:param name="number"/>
611 <xsl:choose>
612 <xsl:when test="$number = '0'">monday</xsl:when>
613 <xsl:when test="$number = '1'">tuesday</xsl:when>
614 <xsl:when test="$number = '2'">wednesday</xsl:when>
615 <xsl:when test="$number = '3'">thursday</xsl:when>
616 <xsl:when test="$number = '4'">friday</xsl:when>
617 <xsl:when test="$number = '5'">saturday</xsl:when>
618 <xsl:when test="$number = '6'">sunday</xsl:when>
619 </xsl:choose>
620 </xsl:template>
621
622 <!--
623 Helpers to convert between time in the format 'hhmm' and an integer
624 count of the minutes since midnight.
625 -->
626 <xsl:template name="time-minutes">
627 <xsl:param name="content"/>
628 <xsl:param name="hhmm"/>
629 <xsl:if test="string-length($hhmm) = 4 and format-number($hhmm, '0000') = $hhmm">
630 <xsl:variable name="hour" select="substring($hhmm, 1, 2)"/>
631 <xsl:variable name="min" select="substring($hhmm, 3, 2)"/>
632 <xsl:if test="$hour >= 0 and $hour &lt; 24 and $min >= 0 and $min &lt; 60">
633 <xsl:value-of select="$hour * 60 + $min"/>
634 </xsl:if>
635 </xsl:if>
636 </xsl:template>
637
638 <xsl:template name="time-hhmm">
639 <xsl:param name="content"/>
640 <xsl:param name="minutes"/>
641 <xsl:value-of select="format-number(floor($minutes div 60) * 100 + $minutes mod 60, '0000')"/>
642 </xsl:template>
643
644 <!--
645 Create schedulers.
646 -->
647 <xsl:template name="nightly-schedulers">
648 <xsl:param name="content"/>
649 <xsl:param name="name"/>
650 <xsl:param name="day"><day-number name="{$name}"/></xsl:param>
651 <xsl:param name="hour" select="0"/>
652 <xsl:param name="minute" select="0"/>
653 <xsl:param name="step" select="30"/>
654
655 <xsl:if test="$hour &lt; 24">
656 <nightly>
657 <name>
658 <xsl:value-of select="concat($name, '_', format-number($hour, '00'), format-number($minute, '00'))"/>
659 </name>
660 <hour>
661 <xsl:value-of select="$hour"/>
662 </hour>
663 <minute>
664 <xsl:value-of select="$minute"/>
665 </minute>
666 <xsl:if test="$day != ''">
667 <dayOfWeek>
668 <xsl:value-of select="$day"/>
669 </dayOfWeek>
670 </xsl:if>
671 </nightly>
672 <xsl:variable name="next" select="$hour * 60 + $minute + $step"/>
673 <xsl:call-template name="nightly-schedulers">
674 <xsl:with-param name="name" select="$name"/>
675 <xsl:with-param name="day" select="$day"/>
676 <xsl:with-param name="hour" select="floor($next div 60)"/>
677 <xsl:with-param name="minute" select="$next mod 60"/>
678 <xsl:with-param name="step" select="$step"/>
679 </xsl:call-template>
680 </xsl:if>
681 </xsl:template>
682
683 <!--
684 scheduler - provide default for the <scheduler> build element.
685 -->
686 <xsl:template name="scheduler">
687 <xsl:param name="content"/>
688 <xsl:param name="previous" select="get:property('scheduler', get:preceding-builds()[last()])"/>
689 <xsl:param name="step" select="60"/>
690
691 <xsl:choose>
692 <xsl:when test="exsl:node-set($content)/node()">
693 <scheduler>
694 <xsl:copy-of select="$content"/>
695 </scheduler>
696 </xsl:when>
697 <xsl:otherwise>
698 <xsl:for-each select="$previous">
699 <xsl:variable name="text">
700 <xsl:apply-templates select="."/>
701 </xsl:variable>
702 <scheduler>
703 <scheduler-subst text="{$text}" step="{$step}"/>
704 </scheduler>
705 </xsl:for-each>
706 </xsl:otherwise>
707 </xsl:choose>
708 </xsl:template>
709
710 <xsl:template name="scheduler-subst">
711 <xsl:param name="content"/>
712 <xsl:param name="text"/>
713 <xsl:param name="step"/>
714
715 <xsl:variable name="name" select="substring-before($text, '_')"/>
716 <xsl:variable name="hhmm" select="substring-after($text, '_')"/>
717 <xsl:variable name="day"><day-number name="{$name}"/></xsl:variable>
718 <xsl:variable name="mins"><time-minutes hhmm="{$hhmm}"/></xsl:variable>
719
720 <xsl:choose>
721 <xsl:when test="$mins = ''">
722 <xsl:value-of select="$text"/>
723 </xsl:when>
724 <xsl:when test="$day = ''">
725 <xsl:value-of select="$name"/>
726 <xsl:text>_</xsl:text>
727 <time-hhmm minutes="{$mins + $step}"/>
728 </xsl:when>
729 <xsl:otherwise>
730 <xsl:variable name="day-mins" select="24 * 60"/>
731 <xsl:variable name="week-mins" select="7 * $day-mins"/>
732 <xsl:variable name="tmp" select="($day + 1) * $day-mins + $mins"/>
733 <xsl:variable name="next" select="$tmp mod $week-mins + floor($tmp div $week-mins) * $step"/>
734 <day-name number="{floor($next div $day-mins)}"/>
735 <xsl:text>_</xsl:text>
736 <time-hhmm minutes="{$next mod $day-mins}"/>
737 </xsl:otherwise>
738 </xsl:choose>
739 </xsl:template>
740
741 <!--
742 email - substitute '@' for ' -at- ' in email addresses.
743 -->
744 <xsl:template name="emailfield">
745 <xsl:param name="content"/>
746 <xsl:param name="addr"/>
747 <xsl:variable name="at"> -at- </xsl:variable>
748 <xsl:choose>
749 <xsl:when test="contains($addr, $at)">
750 <xsl:value-of select="substring-before($addr, $at)"/>
751 <xsl:text>@</xsl:text>
752 <xsl:value-of select="substring-after($addr, $at)"/>
753 </xsl:when>
754 <xsl:otherwise>
755 <xsl:value-of select="$addr"/>
756 </xsl:otherwise>
757 </xsl:choose>
758 </xsl:template>
759
760 <xsl:template name="email">
761 <xsl:param name="content"/>
762 <xsl:param name="id"/>
763 <email id="{$id}"><emailfield addr="{$content}"/></email>
764 </xsl:template>
765
766 <xsl:template name="fromaddr">
767 <xsl:param name="content"/>
768 <fromaddr><emailfield addr="{$content}"/></fromaddr>
769 </xsl:template>
770
771 <xsl:template name="extraRecipient">
772 <xsl:param name="content"/>
773 <extraRecipient><emailfield addr="{$content}"/></extraRecipient>
774 </xsl:template>
775
776 <!--
777 mailnotifier - add a default value for <fromaddr> to <mailnotifier>
778 -->
779 <xsl:template name="mailnotifier">
780 <xsl:param name="content"/>
781 <mailnotifier>
782 <defaults content="{$content}">
783 <fromaddr>noreply -at- wxsite.net</fromaddr>
784 </defaults>
785 <xsl:copy-of select="$content"/>
786 </mailnotifier>
787 </xsl:template>
788
789 </bot>