-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
120 lines (97 loc) · 3.15 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="class-file-parser" default="dist" basedir=".">
<description>
Class file parser project
</description>
<!--
PROPERTIES
-->
<!-- source directories -->
<property name="src-app" location="src/main/java" />
<property name="src-test" location="src/test/java" />
<!-- jar directories -->
<property name="lib-test" location="src/test/resources/lib" />
<!-- working build directories -->
<property name="build" location="build" />
<property name="build-app" location="build/compile/classes" />
<property name="build-test" location="build/compile/test-classes" />
<property name="build-reports" location="build/reports" />
<!-- build artifacts directory -->
<property name="dist" location="dist" />
<!--
PATHS
-->
<!-- class path needed to compile the app -->
<path id="app.classpath">
<pathelement location="${build-app}" />
</path>
<!-- class path needed to compile the unit tests -->
<path id="test.classpath">
<path refid="app.classpath" />
<pathelement location="${build-test}" />
<fileset dir="${lib-test}">
<include name="**/*.jar" />
</fileset>
</path>
<!--
TARGETS
-->
<!-- clean up target -->
<target name="clean" description="-- clean up">
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
<!-- build initialization target -->
<target name="init"
depends="clean"
description="-- initialize the build">
<tstamp>
<format property="build.time" pattern="yyyyMMdd-HHmmss" />
</tstamp>
<mkdir dir="${build-app}" />
<mkdir dir="${build-test}" />
<mkdir dir="${build-reports}" />
</target>
<!-- compile app source target -->
<target name="compile"
depends="init"
description="-- compile the app source">
<javac includeantruntime="false"
srcdir="${src-app}"
destdir="${build-app}" />
</target>
<!-- compile unit test source target -->
<target name="compile-tests"
depends="init,compile"
description="-- compile the test sources">
<javac includeantruntime="false"
srcdir="${src-test}"
destdir="${build-test}">
<classpath refid="test.classpath" />
</javac>
</target>
<!-- execute unit tests target -->
<target name="unit-test"
depends="compile-tests"
description="-- execute unit tests">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath refid="test.classpath" />
<batchtest fork="no" todir="${build-reports}">
<formatter type="plain" />
<fileset dir="${src-test}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<!-- create finished distribution target -->
<target name="dist"
depends="unit-test"
description="-- generate the distribution">
<mkdir dir="${dist}/lib" />
<jar jarfile="${dist}/lib/${ant.project.name}-${build.time}.jar"
basedir="${build-app}" />
</target>
<!-- no-op target, simply to make ant -p more readable -->
<target name="z" description=" " />
</project>