-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
94 lines (85 loc) · 3.77 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
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="tic-tac-toe" default="compile">
<property name="java.dir" location="src/main/java"/>
<property name="classes.dir" location="bin"/>
<property name="test.dir" location="src/test/java"/>
<property name="lib.dir" location="lib"/>
<property name="dist.dir" location="dist"/>
<path id="lib.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- =================================
targets: compile, compile-tests
================================= -->
<target name="compile" depends="resolve">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${java.dir}" destdir="${classes.dir}" classpathref="lib.path"/>
</target>
<target name="compile-tests" depends="compile">
<javac includeantruntime="false" srcdir="${test.dir}" destdir="${classes.dir}">
<classpath refid="lib.path"/>
</javac>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean">
<delete dir="${lib.dir}"/>
<delete dir="${classes.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- =================================
target: dist
================================= -->
<target name="dist" depends="test" description="create a distribution jar">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${dist.dir}/tictactoe.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Created-By" value="Andrea Fey"/>
</manifest>
</jar>
</target>
<!-- =================================
target: run-tests
================================= -->
<target name="test" depends="compile-tests" description="run JUnit tests">
<mkdir dir="reports/junit"/>
<junit>
<classpath refid="lib.path"/>
<classpath refid="ivy.path"/>
<classpath location="${classes.dir}"/>
<formatter type="xml"/>
<batchtest todir="reports/junit">
<fileset dir="${classes.dir}" includes="**/*Test*"/>
</batchtest>
</junit>
</target>
<!-- =================================
target: run
================================= -->
<target name="run" depends="compile" description="play Tic-Tac-Toe from the Ant build">
<java classname="tictactoe.TicTacToe" classpathref="ivy.path">
<classpath location="${classes.dir}"/>
</java>
</target>
<!-- =================================
Ivy targets
================================= -->
<target name="resolve" depends="install-ivy" description="retrieve dependencies (requires ivy.jar on the classpath)">
<ivy:resolve/>
<ivy:retrieve/>
<ivy:cachepath pathid="ivy.path"/>
</target>
<target name="install-ivy" depends="download-ivy" description="add Ivy taskdefs to Ant">
<taskdef classpathref="lib.path" resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${lib.dir}"/>
</target>
<target name="check-ivy" description="checks whether ivy.jar has already been downloaded">
<available file="${lib.dir}/ivy.jar" property="skip.download"/>
</target>
<target name="download-ivy" depends="check-ivy" unless="skip.download" description="download ivy.jar">
<mkdir dir="lib"/>
<get dest="lib/ivy.jar"
src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
</target>
</project>