/
build.xml
executable file
·210 lines (182 loc) · 8.6 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!--
Apache Ant build script for The Football Statistics Applet. Version 1.7.1 or later
of Ant is required (you can download it from http://ant.apache.org/).
Author: Daniel Dyer
-->
<project name="fsa"
default="dist"
xmlns:uncommons="antlib:org.uncommons.antlib"
basedir=".">
<!-- Define build properties. -->
<property name="lib.dir" value="lib" />
<property name="lib.compiletime" value="${lib.dir}/compiletime" />
<property name="lib.runtime" value="${lib.dir}/runtime" />
<property name="temp.dir" value="./temp"/>
<property name="dist.dir" value="./dist"/>
<property name="release.dir" value="./release"/>
<property name="docs.dir" value="./docs"/>
<property name="coverage.dir" location="${docs.dir}/coverage" />
<property name="test-results.dir" location="${docs.dir}/test-results" />
<property name="project.jar" value="${ant.project.name}.jar"/>
<property name="release.zip" value="${ant.project.name}.zip"/>
<!-- Standard classes are in a non-standard location on Macs. -->
<condition property="jdk.libs"
value="${java.home}/../Classes/classes.jar;${java.home}/../Classes/ui.jar"
else="${java.home}/lib/rt.jar">
<os name="Mac OS X"/>
</condition>
<path id="base.path">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<taskdef uri="antlib:org.uncommons.antlib"
resource="org/uncommons/antlib/antlib.xml"
classpathref="base.path"/>
<!-- Removes all files created by this build process. -->
<target name="clean" description="Deletes all files created by the build process.">
<delete dir="${build.dir}"/>
<delete dir="${temp.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${release.dir}"/>
<delete dir="${docs.dir}"/>
<uncommons:clean module="core" />
<uncommons:clean module="swing" />
<uncommons:clean module="applet" />
</target>
<target name="core" description="Builds the model and data processing classes.">
<uncommons:compile module="core" />
<uncommons:jar module="core" />
</target>
<target name="swing" depends="core" description="Builds the user interface classes.">
<uncommons:compile module="swing" />
<uncommons:jar module="swing">
<additionalcontents>
<fileset dir="swing/${src.dir}/java/main" includes="net/footballpredictions/footballstats/messages/**/*" />
</additionalcontents>
</uncommons:jar>
</target>
<target name="applet.build" depends="core, swing" description="Builds the Swing applet.">
<uncommons:compile module="applet" />
<uncommons:jar module="applet" />
</target>
<target name="applet.shrink" depends="applet.build" description="Packs the applet and all dependencies into a single, obfuscated JAR.">
<!-- Make the applet as small as possible. -->
<taskdef resource="proguard/ant/task.properties" classpath="${lib.compiletime}/proguard/proguard.jar" />
<proguard shrink="true"
obfuscate="true"
optimize="true"
usemixedcaseclassnames="true"
allowaccessmodification="true"
overloadaggressively="true"
defaultpackage=""
printseeds="true">
<libraryjar path="${jdk.libs}" />
<libraryjar path="swing/${lib.dir}/compiletime/jfreechart/servlet.jar" />
<injar location="applet/build/applet.jar" />
<injar location="swing/build/swing.jar" filter="!META-INF/MANIFEST.MF" />
<injar location="core/build/core.jar" filter="!META-INF/MANIFEST.MF" />
<injar location="swing/${lib.dir}/runtime/jfreechart/jfreechart-1.0.0.jar"
filter="!META-INF/MANIFEST.MF,!**/*.jpg,!org/jfree/chart/editor/**,!org/jfree/chart/encoders/**,!org/jfree/data/resources/**" />
<injar location="swing/${lib.dir}/runtime/jfreechart/jcommon-1.0.0.jar"
filter="!META-INF/MANIFEST.MF,!org/jfree/ui/about/resources/**,!org/jfree/ui/*.properties" />
<outjar name="applet/${build.dir}/${project.jar}" />
<keep name="net.footballpredictions.footballstats.applet.FootballStatsApplet" />
<keepnames name="org.jfree.chart.JFreeChart" />
<keep extends="java.lang.Enum">
<method name="values" />
</keep>
<keep access="public" name="*" extends="java.util.ListResourceBundle" />
</proguard>
</target>
<!-- Packages and deploys all distributable files. -->
<target name="dist" depends="applet.shrink" description="Builds JAR file and deploys all files.">
<mkdir dir="${dist.dir}"/>
<copy todir="${dist.dir}">
<fileset dir="." includes="*.txt"/>
<fileset dir="." includes="data/**/*" />
<fileset file="applet/${build.dir}/${project.jar}" />
<fileset dir="applet/${src.dir}/conf" includes="*" />
<fileset dir="applet/${src.dir}/html" includes="*" />
</copy>
<!-- Compress each individual data file (standard Ant GZip task does not work with Filesets). -->
<uncommons:gzip>
<fileset dir="${dist.dir}/data" includes="**/*.rlt" />
</uncommons:gzip>
</target>
<target name="release" depends="clean, test, dist" description="Zips files ready for release.">
<mkdir dir="${release.dir}" />
<zip destfile="${release.dir}/${release.zip}">
<fileset dir="${dist.dir}" includes="**/*"/>
</zip>
</target>
<!-- Runs unit tests for all modules. -->
<target name="test"
depends="core, swing, applet.build"
description="Run the unit test suite.">
<mkdir dir="${temp.dir}" />
<path id="test.path">
<dirset dir=".">
<include name="**/${classes.dir}/test" />
</dirset>
<fileset dir="${temp.dir}" includes="*.jar"/>
<fileset dir="." includes="**/${lib.dir}/**/*.jar"/>
<path refid="base.path" />
</path>
<!-- Bytecode instrumentation to enable collection of test coverage data. -->
<taskdef resource="tasks.properties" classpathref="test.path" />
<cobertura-instrument todir="${temp.dir}"
datafile="${temp.dir}/cobertura.ser">
<fileset dir="core/build" includes="core.jar"/>
<fileset dir="swing/build" includes="swing.jar"/>
<fileset dir="applet/build" includes="applet.jar"/>
</cobertura-instrument>
<!-- Run the unit tests on the instrumented classes. -->
<taskdef resource="testngtasks" classpathref="test.path"/>
<mkdir dir="${test-results.dir}" />
<testng classpathref="test.path"
outputdir="${test-results.dir}"
haltonfailure="false"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="./etc" includes="testng.xml"/>
<sysproperty key="net.sourceforge.cobertura.datafile"
file="${temp.dir}/cobertura.ser" />
<sysproperty key="org.uncommons.reportng.title"
value="Football Statistics Applet Unit Test Report" />
<sysproperty key="org.uncommons.reportng.coverage-report"
value="../../coverage/index.html" />
</testng>
<!-- Generate the HTML coverage report. -->
<mkdir dir="${coverage.dir}" />
<cobertura-report format="html"
destdir="${coverage.dir}"
datafile="${temp.dir}/cobertura.ser">
<fileset dir="core/${src.dir}/java/main" includes="**/*.java" />
<fileset dir="swing/${src.dir}/java/main" includes="**/*.java" />
<fileset dir="applet/${src.dir}/java/main" includes="**/*.java" />
</cobertura-report>
<!-- Generate an XML coverage report so that Hudson can graph trends. -->
<cobertura-report format="xml"
destdir="${coverage.dir}"
datafile="${temp.dir}/cobertura.ser">
<fileset dir="core/${src.dir}/java/main" includes="**/*.java" />
<fileset dir="swing/${src.dir}/java/main" includes="**/*.java" />
<fileset dir="applet/${src.dir}/java/main" includes="**/*.java" />
</cobertura-report>
</target>
<!-- Build Javadoc API documentation for the project. Links to the J2SE API documenation on
Sun's Java site. This is an optional target and must be invoked explicitly. -->
<target name="docs" description="Builds API documentation.">
<delete dir="${docs.dir}"/>
<mkdir dir="${docs.dir}"/>
<javadoc sourcepath="${src.dir}/java"
destdir="${docs.dir}/api"
packagenames="net.footballpredictions.*"
author="true"
version="true"
source="1.5"
windowtitle="Football Statistics Applet"
doctitle="Football Statistics Applet">
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
</target>
</project>