-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
193 lines (154 loc) · 7.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
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
189
190
191
192
193
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="ucidy" basedir="." default="test">
<!-- ##################################################################### -->
<!-- # PROPERTIES -->
<!-- ##################################################################### -->
<property name="version" value="1.3" />
<property name="main.src.dir" value="src" />
<property name="main.lib.dir" value="lib" /> <!-- OPTIONAL -->
<property name="main.res.dir" value="resources" /> <!-- OPTIONAL -->
<property name="main.build.dir" value="main-build" />
<property name="main.runnable.class" value="ari.ucidy.UCDParser" />
<available file="test" property="test.src.dir" value="test" /> <!-- OPTIONAL -->
<available file="test-lib" property="test.lib.dir" value="test-lib" /> <!-- OPTIONAL -->
<property name="test.build.dir" value="test-build" /> <!-- OPTIONAL -->
<property name="test.report.dir" value="test-report" /> <!-- OPTIONAL -->
<property name="javadoc.dir" value="docs" /> <!-- OPTIONAL -->
<!-- ##################################################################### -->
<!-- # CLASSPATHS -->
<!-- ##################################################################### -->
<path id="main.classpath">
<fileset dir="${main.lib.dir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${main.res.dir}" />
</path>
<path id="test.classpath">
<fileset dir="${test.lib.dir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${main.build.dir}"/>
<path refid="main.classpath" />
</path>
<!-- ##################################################################### -->
<!-- # CLEANING (rm build/ junit-report/) -->
<!-- ##################################################################### -->
<target name="clean"
description="Remove all builds and test reports files and directories.">
<delete dir="${main.build.dir}" failonerror="false" />
<delete dir="${test.build.dir}" failonerror="false" />
<delete dir="${test.report.dir}" failonerror="false" />
</target>
<target name="clean-build"
description="Delete all build files only.">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${main.build.dir}" includes="**/*"/>
<fileset dir="${test.build.dir}" includes="**/*"/>
</delete>
</target>
<!-- ##################################################################### -->
<!-- # BUILD (.class) -->
<!-- ##################################################################### -->
<target name="build" depends="clean-build"
description="Compile all classes of this project.">
<mkdir dir="${main.build.dir}" />
<javac srcdir="${main.src.dir}" destdir="${main.build.dir}"
includeantruntime="false" encoding="utf8" debug="true">
<classpath refid="main.classpath"/>
</javac>
</target>
<!-- ##################################################################### -->
<!-- # TEST (junit) -->
<!-- ##################################################################### -->
<target name="test" depends="run-test, clean" if="test.src.dir"
description="Compile and test (JUnit) this project (ONLY IF a test directory exists). When finished, all generated files are deleted." />
<target name="build-test" depends="build" if="test.src.dir"
description="Compile all project and test classes (ONLY IF a test directory exists).">
<mkdir dir="${test.build.dir}" />
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}"
includeantruntime="false" encoding="utf8" debug="true">
<classpath refid="test.classpath"/>
</javac>
</target>
<target name="run-test" depends="build-test" if="test.src.dir"
description="Run all tests (JUnit) of this project (ONLY IF a test directory exists).">
<mkdir dir="${test.report.dir}"/>
<junit printsummary="on" fork="on"
errorproperty="testsFailure" failureproperty="testsFailure">
<classpath>
<path refid="test.classpath" />
<pathelement location="${test.build.dir}" />
</classpath>
<formatter type="brief" usefile="yes" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.src.dir}" includes="**/Test*.java" />
</batchtest>
</junit>
<fail if="${testsFailure}"
message="Failed JUnit validation! See ${test.report.dir} for individual class reports." />
</target>
<!-- ##################################################################### -->
<!-- # DOCUMENTATION (javadoc) -->
<!-- ##################################################################### -->
<target name="docs" depends="clean-docs, javadoc" if="javadoc.dir"
description="Generate all the documentation (Javadoc) of this project." />
<target name="clean-docs"
description="Delete all documentation files only.">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${javadoc.dir}" includes="**/*"/>
</delete>
</target>
<target name="javadoc" if="javadoc.dir"
description="Generate the Javadoc of all classes of this project.">
<mkdir dir="${javadoc.dir}" />
<javadoc destdir="${javadoc.dir}"
encoding="utf-8" charset="utf-8" docencoding="utf-8"
access="protected"
author="true"
nodeprecated="true" nodeprecatedlist="true"
noindex="false" nonavbar="false" notree="false"
source="1.8"
splitindex="true"
use="true"
version="true">
<packageset dir="${main.src.dir}" />
</javadoc>
</target>
<!-- ##################################################################### -->
<!-- # PUBLICATION (jar, src.jar, docs.jar) -->
<!-- ##################################################################### -->
<target name="publish" depends="publish-lib, publish-sources, publish-docs, clean"
description="Generate the compiled library (with runnable option), the JAR gathering all the sources and the one for the Javadoc."/>
<target name="publish-lib" depends="build,run-test"
description="Generate the compiled and runnable library.">
<echo>Generate the runnable library:</echo>
<jar destfile="${ant.project.name}-${version}.jar"
basedir="${main.build.dir}"
compress="true"
filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="${main.runnable.class}"/>
</manifest>
<fileset dir="${main.res.dir}" />
<fileset dir="." includes="LICENSE*,COPYING*" casesensitive="false" />
</jar>
</target>
<target name="publish-sources"
description="Gather all sources of this project in a single JAR file.">
<echo>Gather all sources in a single JAR file:</echo>
<jar destfile="${ant.project.name}-${version}_src.jar"
compress="false">
<zipfileset dir="${main.src.dir}" prefix="${main.src.dir}" />
<zipfileset dir="${main.res.dir}" prefix="${main.res.dir}" />
<fileset dir="." includes="LICENSE*,COPYING*" casesensitive="false" />
</jar>
</target>
<target name="publish-docs" depends="docs" if="javadoc.dir"
description="Create a JAR file containing all the Javadoc.">
<echo>Generate the Javadoc JAR:</echo>
<jar destfile="${ant.project.name}-${version}_javadoc.jar"
basedir="${javadoc.dir}"
compress="false" />
</target>
</project>