1 <?xml version=
"1.0" encoding=
"utf-8"?>
5 Purpose: Common declarations for buildbot
8 Copyright: (c) 2007 Mike Wetherell
9 Licence: wxWidgets licence
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"
16 xsl:
extension-element-prefixes=
"func"
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>
27 checkout - build step for source checkout.
29 Usage: as <svn> with defaults for <baseURL> and <defaultBranch>
34 <checkout branch="branches/WX_2_8_BRANCH"/>
37 <xsl:template name=
"checkout">
38 <xsl:param name=
"content"/>
39 <xsl:param name=
"branch" select=
"'trunk'"/>
40 <xsl:variable name=
"nodes" select=
"exsl:node-set($content)"/>
42 <xsl:if test=
"not($nodes/svnurl)">
43 <xsl:if test=
"not($nodes/baseURL)">
44 <baseURL><SVN_URL/></baseURL>
46 <xsl:if test=
"not($nodes/defaultBranch)">
47 <defaultBranch><xsl:value-of select=
"$branch"/></defaultBranch>
50 <xsl:copy-of select=
"$content"/>
55 configure - add the options attribute to <configure>
57 Usage: <configure options="-with-foobar"/>
59 <xsl:template name=
"configure">
60 <xsl:param name=
"content"/>
61 <xsl:param name=
"options"/>
63 <copy-with-defaults content=
"{$content}">
64 <command>./configure
<xsl:value-of select=
"normalize-space($options)"/></command>
70 make - specify the make command.
72 Usage: <make>nmake -f makefile.vc SHARED=1</make>
74 Used as a child of <build> to specify the make command used by the
75 <compile> elements below, if omitted 'make' is used.
77 <xsl:template name=
"make"/>
80 compile - modifiy <compile> to default to the command given by <make>
84 The <make> element of <build> spcecifies the make command used by all
85 compile build steps in the build. If <make> is not given 'make' is used.
87 The command for a particular compile build step can be further overridden
88 using its <command> element:
90 <command>myscript</command>
93 <xsl:template name=
"compile">
94 <xsl:param name=
"content"/>
96 <copy-with-defaults content=
"{$content}">
97 <command><get name=
"make" default=
"make"/></command>
103 Adds build steps to compile the library and the usual subdirectories.
105 Usage: as <compile> with the additional attributes below.
107 Usually the attributes default to suitable values, so typical usage
108 is just <compile-all/>.
110 <compile-all [ gui = 'true'|'false' ]
111 [ msw = 'true'|'false' ]
112 [ wx = 'true'|'false' ]
113 [ samples = 'true'|'false' ]
114 [ utils = 'true'|'false' ]
115 [ demos = 'true'|'false' ]
116 [ contrib = 'true'|'false' ]
117 [ tests = 'true'|'false' ] />
119 gui - if 'true' then build fully the subdirectories specified,
120 otherwise only the wxBase subset of the directories are built.
121 msw - if 'true' then build the directory 'build/msw' when building the
122 library instead of the root.
123 wx - build the library itself.
124 samples, utils, demos, contrib, tests
125 - build subdirectories.
127 <xsl:template name=
"compile-all">
128 <xsl:param name=
"content"/>
130 <xsl:param name=
"gui"><is-gui/></xsl:param>
131 <xsl:param name=
"msw"><is-msw/></xsl:param>
133 <xsl:param name=
"wx" select=
"'true'"/>
134 <xsl:param name=
"samples" select=
"'true'"/>
135 <xsl:param name=
"utils" select=
"'true'"/>
136 <xsl:param name=
"demos" select=
"$gui"/>
137 <xsl:param name=
"contrib"><has-contrib/></xsl:param>
138 <xsl:param name=
"tests"><has-tests/></xsl:param>
140 <xsl:param name=
"wx-dirs">
141 <get-dirs wx=
"{$wx}" gui=
"{$gui}" msw=
"{$msw}"/>
143 <xsl:param name=
"sample-dirs">
144 <get-dirs samples=
"{$samples}" gui=
"{$gui}" msw=
"{$msw}"/>
146 <xsl:param name=
"util-dirs">
147 <get-dirs utils=
"{$utils}" gui=
"{$gui}" msw=
"{$msw}"/>
149 <xsl:param name=
"demo-dirs">
150 <get-dirs demos=
"{$demos}" gui=
"{$gui}" msw=
"{$msw}"/>
152 <xsl:param name=
"contrib-dirs">
153 <get-dirs contrib=
"{$contrib}" gui=
"{$gui}" msw=
"{$msw}"/>
155 <xsl:param name=
"test-dirs">
156 <get-dirs tests=
"{$tests}" gui=
"{$gui}" msw=
"{$msw}"/>
159 <compile-subdirs dirs=
"{$wx-dirs}" halt=
"true">
160 <xsl:copy-of select=
"$content"/>
162 <compile-subdirs name=
"samples" dirs=
"{$sample-dirs}">
163 <xsl:copy-of select=
"$content"/>
165 <compile-subdirs name=
"utils" dirs=
"{$util-dirs}">
166 <xsl:copy-of select=
"$content"/>
168 <compile-subdirs name=
"demos" dirs=
"{$demo-dirs}">
169 <xsl:copy-of select=
"$content"/>
171 <compile-subdirs name=
"contrib" dirs=
"{$contrib-dirs}">
172 <xsl:copy-of select=
"$content"/>
174 <compile-subdirs name=
"tests" dirs=
"{$test-dirs}" halt=
"true">
175 <xsl:copy-of select=
"$content"/>
180 Helper for compile-all.
181 Returns the directories that need to be built for the various components:
182 wx (the library itself), samples, utils, demos, contrib and tests.
184 <xsl:template name=
"get-dirs">
185 <xsl:param name=
"contents"/>
187 <xsl:param name=
"gui"/>
188 <xsl:param name=
"msw"/>
190 <xsl:param name=
"wx"/>
191 <xsl:param name=
"samples"/>
192 <xsl:param name=
"utils"/>
193 <xsl:param name=
"demos"/>
194 <xsl:param name=
"contrib"/>
195 <xsl:param name=
"tests"/>
197 <xsl:if test=
"$wx = 'true'">
199 <xsl:when test=
"$msw = 'true'">build/msw
</xsl:when>
200 <xsl:otherwise>.
</xsl:otherwise>
202 <xsl:text> </xsl:text>
205 <xsl:if test=
"$samples = 'true'">
207 <xsl:when test=
"$gui = 'true'">samples
</xsl:when>
208 <xsl:otherwise>samples/console
</xsl:otherwise>
210 <xsl:text> </xsl:text>
213 <xsl:if test=
"$utils = 'true'">
215 <xsl:when test=
"$gui = 'true'">utils
</xsl:when>
216 <xsl:otherwise>utils/tex2rtf/src ../../HelpGen/src
</xsl:otherwise>
218 <xsl:text> </xsl:text>
221 <xsl:if test=
"$demos = 'true' and $gui = 'true'">demos
</xsl:if>
223 <xsl:if test=
"$contrib = 'true' and $gui = 'true'">contrib
</xsl:if>
225 <xsl:if test=
"$tests = 'true'">tests
</xsl:if>
229 compile-subdir - build step to compile a subdirectory.
231 Usage: as <compile> plus the following attributes,
232 <compile-subdir dir="foobar" [ halt="true" ]/>
234 Compiles the named subdirectory 'foobar'. Continues with the next build
235 step on failure, unless the optional attibute 'halt="true"' is given.
236 The make command used is as described for the compile step above.
238 <xsl:template name=
"compile-subdir">
239 <xsl:param name=
"content"/>
240 <xsl:param name=
"dir"/>
241 <xsl:param name=
"halt" select=
"'false'"/>
242 <compile-subdirs name=
"{$dir}" dirs=
"{$dir}" halt=
"{$halt}">
243 <xsl:copy-of select=
"$content"/>
248 compile-subdirs - adds a compile build step for each directory in a list.
250 Usage: as <compile> plus the following attributes,
251 <compile-subdir dirs="foobar1 foobar2"
256 Compiles the named subdirectories. Continues with the next build
257 step on failure, unless the optional attibute 'halt="true"' is given.
258 The make command used is as described for the compile step above.
259 The 'name' attribute can be used to give a collective name for the
260 subdirectories, and the 'sep' attibute can be used to specify the
261 separator in the 'dirs' list (defaults to space).
263 <xsl:template name=
"compile-subdirs">
264 <xsl:param name=
"content"/>
265 <xsl:param name=
"name"/>
266 <xsl:param name=
"dirs"/>
267 <xsl:param name=
"sep" select=
"' '"/>
268 <xsl:param name=
"halt" select=
"'false'"/>
269 <xsl:if test=
"translate($dirs, $sep, '')">
271 <defaults content=
"{$content}">
273 <xsl:value-of select=
"normalize-space(concat('compile ', $name))"/>
276 <xsl:value-of select=
"normalize-space(concat('compiling ', $name))"/>
279 <xsl:value-of select=
"normalize-space(concat('compile ', $name))"/>
282 <xsl:value-of select=
"$halt"/>
286 <copy-with-defaults content=
"{$content}">
288 <compile-subdirs-cmd dirs=
"{$dirs}" sep=
"{$sep}"/>
290 </copy-with-defaults>
295 <xsl:template name=
"compile-subdirs-cmd">
296 <xsl:param name=
"content"/>
297 <xsl:param name=
"dirs"/>
298 <xsl:param name=
"sep"/>
300 <xsl:when test=
"contains($dirs, $sep)">
301 <xsl:variable name=
"before" select=
"substring-before($dirs, $sep)"/>
302 <xsl:variable name=
"after" select=
"substring-after($dirs, $sep)"/>
304 <xsl:call-template name=
"compile-subdirs-cmd">
305 <xsl:with-param name=
"dirs" select=
"$before"/>
306 <xsl:with-param name=
"sep" select=
"$sep"/>
309 <xsl:if test=
"$after and substring($after, 1, 1) != ' '">
310 <xsl:text> && </xsl:text>
313 <xsl:call-template name=
"compile-subdirs-cmd">
314 <xsl:with-param name=
"dirs" select=
"$after"/>
315 <xsl:with-param name=
"sep" select=
"$sep"/>
318 <xsl:when test=
"string($dirs)">
319 <xsl:if test=
"$dirs != '.'">cd
<xsl:value-of select=
"$dirs"/> && </xsl:if>
320 <get name=
"make" default=
"make"/>
326 run-tests - build step to run the test suites.
333 <xsl:template name=
"run-tests">
334 <xsl:param name=
"content"/>
335 <xsl:param name=
"msw"><is-msw/></xsl:param>
337 <defaults content=
"{$content}">
338 <description>running tests
</description>
339 <descriptionDone>run tests
</descriptionDone>
342 <copy-with-defaults content=
"{$content}">
345 <xsl:when test=
"$msw = 'true'">
353 </copy-with-defaults>
358 We need to add something to the wxWidgets sources to run the tests with a
359 simple command so that these aren't necessary.
361 <xsl:template name=
"run-tests-win">
364 (for /d %x in (..\lib\*_dll) do @PATH=%x;%PATH%)
&&
365 (for /d %x in (*) do @if exist %x\test.exe %x\test)
&&
366 (for /d %x in (*) do @if exist %x\test_gui.exe %x\test_gui)
370 <xsl:template name=
"run-tests-unix">
374 if [ -x test_gui ]; then ./test_gui; fi
379 defaults - supply default content for an element.
381 Usage: <defaults content="{$content}">
386 Copies those child elements that do not already exist in $content.
388 <xsl:template name=
"defaults">
389 <xsl:param name=
"defaults"/>
390 <xsl:param name=
"content"/>
392 <xsl:variable name=
"def-nodes" select=
"exsl:node-set($defaults)"/>
393 <xsl:variable name=
"cont-nodes" select=
"exsl:node-set($content)"/>
395 <xsl:for-each select=
"$def-nodes/*">
396 <xsl:if test=
"not($cont-nodes/*[name() = name(current())])">
397 <xsl:copy-of select=
"."/>
403 copy-with-defaults - copy elements supplying defaults for any that are
406 Usage: <copy-with-defaults content="{$content}">
409 </copy-with-defaults>
411 Copies $content plus any child elements that do not exist in $content,
412 substituting empty elements in $content with any child elements of the
415 <xsl:template name=
"copy-with-defaults">
416 <xsl:param name=
"defaults"/>
417 <xsl:param name=
"content"/>
419 <xsl:variable name=
"def-nodes" select=
"exsl:node-set($defaults)"/>
420 <xsl:variable name=
"cont-nodes" select=
"exsl:node-set($content)"/>
422 <xsl:for-each select=
"$def-nodes/*">
423 <xsl:if test=
"not($cont-nodes/*[name() = name(current())])">
424 <xsl:copy-of select=
"."/>
428 <xsl:for-each select=
"$cont-nodes/*">
430 <xsl:when test=
"not(node())">
431 <xsl:copy-of select=
"$def-nodes/*[name() = name(current())]"/>
434 <xsl:copy-of select=
"."/>
441 get - gets the text from a child element of the current build.
443 Usage: <get name="foobar" [ default="value" ]/>
445 Gets the text from the <foobar> element of the current build, or returns
446 $default if there is not such element.
448 <xsl:template name=
"get">
449 <xsl:param name=
"content"/>
450 <xsl:param name=
"build" select=
"get:build()"/>
451 <xsl:param name=
"name"/>
452 <xsl:param name=
"default"/>
453 <xsl:variable name=
"property" select=
"get:property($name, $build)"/>
456 <xsl:when test=
"$property">
457 <xsl:apply-templates select=
"$property/node()"/>
460 <xsl:value-of select=
"$default"/>
467 Accessors to get builds and their fields. XSLT code should use these
468 instead of traversing the input tree directly.
470 <func:function name=
"get:build">
471 <func:result select=
"ancestor-or-self::build[last()]"/>
474 <func:function name=
"get:all-builds">
475 <func:result select=
"//build[not(ancestor::*[name() != name(/*)])]"/>
478 <func:function name=
"get:preceding-builds">
479 <func:result select=
"get:build()/preceding-sibling::build"/>
482 <func:function name=
"get:property">
483 <xsl:param name=
"name"/>
484 <xsl:param name=
"build" select=
"get:build()"/>
485 <func:result select=
"$build/*[name() = $name]"/>
488 <func:function name=
"get:step">
489 <xsl:param name=
"name"/>
490 <xsl:param name=
"build" select=
"get:build()"/>
491 <func:result select=
"get:property('steps', $build)/*[name() = $name]"/>
495 Returns true if this is an msw build.
497 <xsl:template name=
"is-msw">
498 <xsl:param name=
"content"/>
499 <xsl:param name=
"build" select=
"get:build()"/>
500 <xsl:value-of select=
"not(get:step('configure', $build))"/>
504 Returns true if this a gui build.
506 <xsl:template name=
"is-gui">
507 <xsl:param name=
"content"/>
508 <xsl:param name=
"build" select=
"get:build()"/>
509 <xsl:variable name=
"make"><get name=
"make" build=
"{$build}"/></xsl:variable>
510 <xsl:variable name=
"configure"><xsl:apply-templates select=
"get:step('configure', $build)"/></xsl:variable>
511 <xsl:value-of select=
"not(contains($make, 'USE_GUI=0') or contains($configure, '--disable-gui'))"/>
515 Returns true if the branch we're building has a contrib subdirectory.
517 <xsl:template name=
"has-contrib">
518 <xsl:param name=
"content"/>
519 <xsl:param name=
"build" select=
"get:build()"/>
520 <xsl:variable name=
"checkout"><xsl:apply-templates select=
"get:step('checkout', $build)"/></xsl:variable>
521 <xsl:value-of select=
"contains($checkout, 'WX_2_') and not(contains($checkout, 'WX_2_9_'))"/>
525 Returns true if the build should build the test suite.
527 <xsl:template name=
"has-tests">
528 <xsl:param name=
"content"/>
529 <xsl:param name=
"build" select=
"get:build()"/>
530 <xsl:variable name=
"configure"><xsl:apply-templates select=
"get:step('configure', $build)"/></xsl:variable>
531 <xsl:value-of select=
"get:step('run-tests', $build) or contains($configure, '--host=')"/>
535 strip - strips leading and trailing whitespace
541 Converts to text and strips leading and trailing whitespace.
543 <xsl:template name=
"strip">
544 <xsl:param name=
"content"/>
545 <xsl:variable name=
"len" select=
"string-length($content)"/>
546 <xsl:variable name=
"norm" select=
"normalize-space($content)"/>
547 <xsl:variable name=
"normlen" select=
"string-length($norm)"/>
549 <xsl:when test=
"substring($content, 1, 1) != substring($norm, 1, 1)">
550 <xsl:call-template name=
"strip">
551 <xsl:with-param name=
"content" select=
"substring($content, 2)"/>
554 <xsl:when test=
"substring($content, $len, 1) != substring($norm, $normlen, 1)">
555 <xsl:call-template name=
"strip">
556 <xsl:with-param name=
"content" select=
"substring($content, 1, $len - 1)"/>
560 <xsl:value-of select=
"$content"/>
566 normalize-space - normalises whitespace.
568 Usage: <normalize-space>
572 Converts to text, strips leading and trailing whitespace and replaces
573 sequences of whitespace characters by a single space.
575 <xsl:template name=
"normalize-space">
576 <xsl:param name=
"content"/>
577 <xsl:value-of select=
"normalize-space($content)"/>
581 lower-case - converts to lower case.
583 Usage: <lower-case>FooBar</lower-case>
585 <xsl:template name=
"lower-case">
586 <xsl:param name=
"content"/>
587 <xsl:variable name=
"lower">abcdefghijklmnopqrstuvwxyz
</xsl:variable>
588 <xsl:variable name=
"upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ
</xsl:variable>
589 <xsl:value-of select=
"translate($content, $upper, $lower)"/>
593 Helpers to convert between day numbers and names.
595 <xsl:template name=
"day-number">
596 <xsl:param name=
"content"/>
597 <xsl:param name=
"name"/>
599 <xsl:when test=
"$name = 'sunday'">0</xsl:when>
600 <xsl:when test=
"$name = 'monday'">1</xsl:when>
601 <xsl:when test=
"$name = 'tuesday'">2</xsl:when>
602 <xsl:when test=
"$name = 'wednesday'">3</xsl:when>
603 <xsl:when test=
"$name = 'thursday'">4</xsl:when>
604 <xsl:when test=
"$name = 'friday'">5</xsl:when>
605 <xsl:when test=
"$name = 'saturday'">6</xsl:when>
609 <xsl:template name=
"day-name">
610 <xsl:param name=
"content"/>
611 <xsl:param name=
"number"/>
613 <xsl:when test=
"$number = '0'">sunday
</xsl:when>
614 <xsl:when test=
"$number = '1'">monday
</xsl:when>
615 <xsl:when test=
"$number = '2'">tuesday
</xsl:when>
616 <xsl:when test=
"$number = '3'">wednesday
</xsl:when>
617 <xsl:when test=
"$number = '4'">thursday
</xsl:when>
618 <xsl:when test=
"$number = '5'">friday
</xsl:when>
619 <xsl:when test=
"$number = '6'">saturday
</xsl:when>
624 Helpers to convert between time in the format 'hhmm' and an integer
625 count of the minutes since midnight.
627 <xsl:template name=
"time-minutes">
628 <xsl:param name=
"content"/>
629 <xsl:param name=
"hhmm"/>
630 <xsl:if test=
"string-length($hhmm) = 4 and format-number($hhmm, '0000') = $hhmm">
631 <xsl:variable name=
"hour" select=
"substring($hhmm, 1, 2)"/>
632 <xsl:variable name=
"min" select=
"substring($hhmm, 3, 2)"/>
633 <xsl:if test=
"$hour >= 0 and $hour < 24 and $min >= 0 and $min < 60">
634 <xsl:value-of select=
"$hour * 60 + $min"/>
639 <xsl:template name=
"time-hhmm">
640 <xsl:param name=
"content"/>
641 <xsl:param name=
"minutes"/>
642 <xsl:value-of select=
"format-number(floor($minutes div 60) * 100 + $minutes mod 60, '0000')"/>
648 <xsl:template name=
"nightly-schedulers">
649 <xsl:param name=
"content"/>
650 <xsl:param name=
"name"/>
651 <xsl:param name=
"day"><day-number name=
"{$name}"/></xsl:param>
652 <xsl:param name=
"hour" select=
"0"/>
653 <xsl:param name=
"minute" select=
"0"/>
654 <xsl:param name=
"step" select=
"30"/>
656 <xsl:if test=
"$hour < 24">
659 <xsl:value-of select=
"concat($name, '_', format-number($hour, '00'), format-number($minute, '00'))"/>
662 <xsl:value-of select=
"$hour"/>
665 <xsl:value-of select=
"$minute"/>
667 <xsl:if test=
"$day != ''">
669 <xsl:value-of select=
"$day"/>
673 <xsl:variable name=
"next" select=
"$hour * 60 + $minute + $step"/>
674 <xsl:call-template name=
"nightly-schedulers">
675 <xsl:with-param name=
"name" select=
"$name"/>
676 <xsl:with-param name=
"day" select=
"$day"/>
677 <xsl:with-param name=
"hour" select=
"floor($next div 60)"/>
678 <xsl:with-param name=
"minute" select=
"$next mod 60"/>
679 <xsl:with-param name=
"step" select=
"$step"/>
685 scheduler - provide default for the <scheduler> build element.
687 <xsl:template name=
"scheduler">
688 <xsl:param name=
"content"/>
689 <xsl:param name=
"previous" select=
"get:property('scheduler', get:preceding-builds()[last()])"/>
690 <xsl:param name=
"step" select=
"60"/>
693 <xsl:when test=
"exsl:node-set($content)/node()">
695 <xsl:copy-of select=
"$content"/>
699 <xsl:for-each select=
"$previous">
700 <xsl:variable name=
"text">
701 <xsl:apply-templates select=
"."/>
704 <scheduler-subst text=
"{$text}" step=
"{$step}"/>
711 <xsl:template name=
"scheduler-subst">
712 <xsl:param name=
"content"/>
713 <xsl:param name=
"text"/>
714 <xsl:param name=
"step"/>
716 <xsl:variable name=
"name" select=
"substring-before($text, '_')"/>
717 <xsl:variable name=
"hhmm" select=
"substring-after($text, '_')"/>
718 <xsl:variable name=
"day"><day-number name=
"{$name}"/></xsl:variable>
719 <xsl:variable name=
"mins"><time-minutes hhmm=
"{$hhmm}"/></xsl:variable>
722 <xsl:when test=
"$mins = ''">
723 <xsl:value-of select=
"$text"/>
725 <xsl:when test=
"$day = ''">
726 <xsl:value-of select=
"$name"/>
727 <xsl:text>_
</xsl:text>
728 <time-hhmm minutes=
"{$mins + $step}"/>
731 <xsl:variable name=
"day-mins" select=
"24 * 60"/>
732 <xsl:variable name=
"week-mins" select=
"7 * $day-mins"/>
733 <xsl:variable name=
"tmp" select=
"($day + 1) * $day-mins + $mins"/>
734 <xsl:variable name=
"next" select=
"$tmp mod $week-mins + floor($tmp div $week-mins) * $step"/>
735 <day-name number=
"{floor($next div $day-mins)}"/>
736 <xsl:text>_
</xsl:text>
737 <time-hhmm minutes=
"{$next mod $day-mins}"/>