-
Notifications
You must be signed in to change notification settings - Fork 514
Expand file tree
/
Copy pathbuild.xml
More file actions
188 lines (178 loc) · 7.38 KB
/
build.xml
File metadata and controls
188 lines (178 loc) · 7.38 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<project name="SpockExample"
default="test"
xmlns:groovy="antlib:org.codehaus.groovy.ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Various Paths -->
<property name="test.src.dir"
location="src/test/groovy"/>
<property name="test.resource.dir"
location="src/test/resources"/>
<property name="build.dir"
location="ant/build"/>
<property name="lib.dir"
location="ant/lib"/>
<property name="classes.dir"
location="${build.dir}/classes"/>
<!-- Ivy Properties -->
<property name="config.ivy.version"
value="2.5.3"/>
<property name="ivy.jar.dir"
location="${lib.dir}/ivy"/>
<property name="ivy.jar.filename"
value="ivy-${config.ivy.version}.jar"/>
<property name="ivy.jar.file"
location="${ivy.jar.dir}/${ivy.jar.filename}"/>
<target name="init">
<echo message="Buildfile for ${ant.project.name} (${ant.file})"
level="info"/>
<fail message="Ant 1.10.6 or newer is needed for ${ant.project.name} to build, please install it and rerun (found Ant version: '${ant.version}')">
<condition>
<not>
<antversion atleast="1.10.6"/>
</not>
</condition>
</fail>
<fail message="Java 8 or newer is needed for ${ant.project.name} to build, please install it and rerun (found Java version: '${ant.java.version}')">
<condition>
<not>
<javaversion atleast="1.8"/>
</not>
</condition>
</fail>
<fail message="The ant-optional package is needed for ${ant.project.name} to build, please install it and rerun">
<condition>
<not>
<and>
<available classname="org.apache.tools.ant.taskdefs.optional.depend.Depend"/>
<available classname="org.apache.tools.ant.taskdefs.optional.TraXLiaison"/>
</and>
</not>
</condition>
</fail>
</target>
<target name="check-ivy"
depends="init">
<available property="ivy.jar.present"
file="${ivy.jar.file}"
type="file"/>
</target>
<target name="download-ivy"
depends="init,check-ivy"
unless="ivy.jar.present">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://repo.maven.apache.org/maven2/org/apache/ivy/ivy/${config.ivy.version}/ivy-${config.ivy.version}.jar"
dest="${ivy.jar.file}"
usetimestamp="true"/>
</target>
<target name="init-ivy"
depends="init,download-ivy">
<property name="ivy.retrieve.pattern"
value="${lib.dir}/[conf]/[artifact](-[classifier]).[ext]"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
classpath="${ivy.jar.file}"
loaderref="ivy.loader"
uri="antlib:org.apache.ivy.ant"/>
</target>
<target name="retrieve"
description="retrieve the dependencies"
depends="init,init-ivy">
<ivy:retrieve sync="true"/>
<ivy:retrieve pattern="${lib.dir}/ivy/[artifact]-[revision].[ext]"
organisation="org.apache.ivy"
module="ivy"
revision="${config.ivy.version}"
conf="default"
inline="true"/>
</target>
<target name="clean"
depends="init"
description="clean up intermediate files">
<delete includeemptydirs="true"
failonerror="false">
<fileset dir="${classes.dir}"
defaultexcludes="false"/>
</delete>
</target>
<target name="clean-all"
depends="init"
description="clean up lib.dir, classes.dir, and build.dir completely">
<delete includeemptydirs="true"
failonerror="false">
<fileset dir="${lib.dir}"
defaultexcludes="false"/>
<fileset dir="${classes.dir}"
defaultexcludes="false"/>
<fileset dir="${build.dir}"
defaultexcludes="false"/>
</delete>
</target>
<target name="compile-test"
depends="init,retrieve">
<mkdir dir="${classes.dir}/test"/>
<depend srcDir="${test.src.dir}"
destDir="${classes.dir}/test"
cache="${classes.dir}"/>
<dependset>
<srcfilelist files="build.xml"/>
<srcfilelist files="ivy.xml"/>
<srcfilelist files="ivysettings.xml"/>
<targetfileset dir="${classes.dir}/test"/>
</dependset>
<taskdef resource="org/codehaus/groovy/antlib.xml"
uri="antlib:org.codehaus.groovy.ant">
<classpath>
<fileset dir="${lib.dir}/groovy-ant"
includes="*.jar"/>
</classpath>
</taskdef>
<groovy:groovyc srcdir="${test.src.dir}"
destdir="${classes.dir}/test"
encoding="UTF-8"
includeAntRuntime="false"
fork="true">
<groovy:classpath id="classpath.test">
<fileset dir="${lib.dir}/test"
includes="*.jar"/>
</groovy:classpath>
</groovy:groovyc>
</target>
<target name="test"
depends="init,retrieve,compile-test"
description="run unit tests">
<delete dir="${build.dir}/test/raw-reports"/>
<mkdir dir="${build.dir}/test/raw-reports"/>
<junitlauncher printsummary="true"
failureproperty="tests.failed">
<classpath refid="classpath.test"/>
<classpath location="§{test.resource.dir}"/>
<classpath location="${classes.dir}/test"/>
<classpath location="${ant.library.dir}/ant.jar"/>
<classpath location="${ant.library.dir}/ant-junitlauncher.jar"/>
<listener type="legacy-xml"
outputDir="${build.dir}/test/raw-reports"/>
<testclasses>
<fork includeJUnitPlatformLibraries="false"
includeAntRuntimeLibraries="false"/>
<fileset dir="${classes.dir}/test">
<scriptselector language="groovy">
<classpath>
<fileset dir="${lib.dir}/groovy-script"
includes="*.jar"/>
</classpath>
<![CDATA[
import org.spockframework.buildsupport.SpecClassFileFinder
self.selected = new SpecClassFileFinder().isRunnableSpec(file)
]]>
</scriptselector>
</fileset>
</testclasses>
</junitlauncher>
<mkdir dir="${build.dir}/test/merged-reports"/>
<junitreport todir="${build.dir}/test/merged-reports">
<fileset dir="${build.dir}/test/raw-reports"/>
<report todir="${build.dir}/test/reports"/>
</junitreport>
<fail message="Unit test(s) failed! See reports at ${build.dir}/test/reports/index.html"
if="tests.failed"/>
</target>
</project>