forked from spockframework/spock-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
112 lines (102 loc) · 3.91 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
<project name="SpockExample" basedir="." default="test" xmlns:artifact="urn:maven-artifact-ant">
<property name="src.dir" location="src/test/groovy" />
<property name="resource.dir" location="src/test/resources" />
<property name="build.dir" location="ant/build" />
<property name="lib.dir" location="ant/lib" />
<property name="maven.ant.tasks.url" value="http://central.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" />
<property name="maven.ant.tasks.jar" value="${lib.dir}${file.separator}maven-ant-tasks-2.1.3.jar" />
<available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}" />
<target name="bootstrap.maven.tasks" unless="maven.ant.tasks.jar.exists">
<mkdir dir="${lib.dir}" />
<get
src="${maven.ant.tasks.url}"
dest="${maven.ant.tasks.jar}" />
</target>
<target name="init.maven.tasks" depends="bootstrap.maven.tasks">
<typedef
resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant"
classpath="${maven.ant.tasks.jar}" />
</target>
<target name="resolve.dependencies" depends="init.maven.tasks">
<artifact:dependencies pathId="classpath.spock">
<!-- Mandatory dependencies for using Spock -->
<dependency
groupId="org.spockframework"
artifactId="spock-core"
version="1.1-groovy-2.4" />
<!-- Optional dependencies for using Spock -->
<!-- enables mocking of classes (in addition to interfaces) -->
<dependency
groupId="net.bytebuddy"
artifactId="byte-buddy"
version="1.6.5" />
<!-- enables mocking of classes without parameterless constructor (together with CGLIB) -->
<dependency
groupId="org.objenesis"
artifactId="objenesis"
version="2.5.1" />
<!-- only required if Spock's Ant selector is used, which finds spec classes regardless of their name -->
<dependency
groupId="org.ow2.asm"
artifactId="asm"
version="5.0.3" />
<!-- only required if Hamcrest matchers are used -->
<dependency
groupId="org.hamcrest"
artifactId="hamcrest-core"
version="1.3" />
<!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency
groupId="com.h2database"
artifactId="h2"
version="1.4.182" />
<remoteRepository
id="maven-central"
url="https://repo1.maven.org/maven2/" />
<!-- Only required if a snapshot version of Spock is used -->
<remoteRepository
id="spock-snapshots"
url="https://oss.sonatype.org/content/repositories/snapshots/" />
</artifact:dependencies>
</target>
<target name="init.groovy.tasks" depends="resolve.dependencies">
<!-- Using the Groovy compiler from classpath.spock is a simple and safe setup -->
<taskdef
name="groovyc"
classname="org.codehaus.groovy.ant.Groovyc"
classpathref="classpath.spock" />
</target>
<target name="init" depends="init.groovy.tasks">
<tstamp />
<mkdir dir="${build.dir}" />
</target>
<target name="copy.resources" depends="init">
<copy todir="${build.dir}">
<fileset dir="${resource.dir}" />
</copy>
</target>
<target name="compile" depends="copy.resources">
<groovyc
srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="classpath.spock" />
</target>
<target name="test" depends="compile">
<junit fork="true" forkmode="once">
<classpath path="${build.dir}" />
<classpath refid="classpath.spock" />
<batchtest>
<fileset dir="${build.dir}">
<custom
classname="org.spockframework.buildsupport.ant.SpecClassFileSelector"
classpathref="classpath.spock" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>