-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.xml
154 lines (133 loc) · 6.42 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- File: build.xml -->
<!-- Author: Jeni Tennison -->
<!-- URI: http://xspec.googlecode.com/ -->
<!-- Tags: -->
<!-- Copyright (c) 2008, 2010 Jeni Tennison (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<project name="xspec" default="xspec">
<description>XSpec is a Behavior Driven Development (BDD) framework for XSLT and XQuery.
Usage:
ant -Dxspec.xml=filename
where:
filename XSpec tests XML file
</description>
<dirname property="xspec.project.dir" file="${ant.file.xspec}"/>
<!-- File of properties determining or describing local
configuration. -->
<property name="xspec.properties" location="${xspec.project.dir}/xspec.properties"/>
<property file="${xspec.properties}"/>
<!-- saxon.jar location depends on OS. -->
<condition property="saxon.jar" value="${saxon.jar.windows}">
<os family="windows" />
</condition>
<condition property="saxon.jar" value="${saxon.jar.mac}">
<os family="mac" />
</condition>
<condition property="saxon.jar" value="${saxon.jar.unix}">
<os family="unix" />
</condition>
<property name="saxon.home" location="/Library/Application Support/saxonb9" />
<property name="saxon.jar" location="${saxon.home}/saxon9.jar" />
<dirname property="xspec.base.dir" file="${xspec.xml}" />
<basename property="xspec.xml.base" file="${xspec.xml}" suffix=".xml" />
<basename property="xspec.base" file="${xspec.xml.base}" suffix=".xspec" />
<property name="xspec.dir"
value="${xspec.base.dir}/xspec" />
<property name="xspec.xsl"
value="${xspec.dir}/${xspec.base}.xsl" />
<property name="xspec.result.xml"
value="${xspec.dir}/${xspec.base}-result.xml" />
<property name="xspec.result.html"
value="${xspec.dir}/${xspec.base}-result.html" />
<macrodef name="xspec"
description="Run XSpec tests">
<attribute name="xspec.xml" description="XSpec tests file" />
<sequential>
<local name="xspec.base.dir" />
<dirname property="xspec.base.dir" file="@{xspec.xml}" />
<local name="xspec.xml.base" />
<basename property="xspec.xml.base" file="@{xspec.xml}" suffix=".xml" />
<local name="xspec.base" />
<basename property="xspec.base" file="${xspec.xml.base}" suffix=".xspec" />
<antcall target="xspec.xspec" inheritall="false">
<param name="xspec.xml"
location="@{xspec.xml}" />
<param name="xspec.base.dir"
location="${xspec.base.dir}" />
<param name="xspec.dir"
location="${xspec.base.dir}/xspec" />
<param name="xspec.base"
value="${xspec.base}" />
</antcall>
</sequential>
</macrodef>
<target name="xspec"
description="Runs the XSpec unit tests in ${xspec.xml}">
<xslt in="${xspec.xml}"
out="${xspec.xsl}"
style="${xspec.project.dir}/src/compiler/generate-xspec-tests.xsl"
classpath="${saxon.jar}">
<factory name="net.sf.saxon.TransformerFactoryImpl" />
</xslt>
<!-- Can't specify initial template with <xslt> task so have to
fall back to running Saxon as Java app. -->
<java classname="net.sf.saxon.Transform"
classpath="${saxon.jar}"
fork="true">
<arg value="-ext:on" />
<arg value="-s:${xspec.xml}" />
<arg value="-o:${xspec.result.xml}" />
<arg value="-xsl:${xspec.xsl}" />
<arg value="-it:{http://www.jenitennison.com/xslt/xspec}main" />
</java>
<xslt in="${xspec.result.xml}"
out="${xspec.result.html}"
style="${xspec.project.dir}/src/reporter/format-xspec-report.xsl"
classpath="${saxon.jar}">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute
name="http://saxon.sf.net/feature/allow-external-functions"
value="true"/>
</factory>
</xslt>
<loadfile srcfile="${xspec.result.xml}"
property="xspec.result" />
<fail message="XSpec tests failed. See ${xspec.result.html} for a report">
<condition>
<contains string="${xspec.result}" substring='successful="false"' />
</condition>
</fail>
</target>
<target name="echoproperties">
<echoproperties />
</target>
</project>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
<!-- Copyright (c) 2008, 2010 Jeni Tennison -->
<!-- -->
<!-- The contents of this file are subject to the MIT License (see the URI -->
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
<!-- -->
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
<!-- a copy of this software and associated documentation files (the -->
<!-- "Software"), to deal in the Software without restriction, including -->
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
<!-- permit persons to whom the Software is furnished to do so, subject to -->
<!-- the following conditions: -->
<!-- -->
<!-- The above copyright notice and this permission notice shall be -->
<!-- included in all copies or substantial portions of the Software. -->
<!-- -->
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->