-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
330 lines (247 loc) · 10.7 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<!--
Ant build script to build the ABOVE program.
-->
<project name="ABOVE" default="compile" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the developer's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<property name="vendor.name" value="The ABOVE project team."/>
<property name="app.web" value="http://tgerstendoerfer.github.io/above"/>
<property name="app.title" value="${ant.project.name}"/>
<property name="app.name" value="above"/>
<property name="app.path" value="/${app.name}"/>
<property name="build.home" value="${basedir}/build"/>
<property name="dist.home" value="${basedir}/dist"/>
<property name="docs.home" value="${basedir}/doc"/>
<property name="src.home" value="${basedir}/src"/>
<property name="media.home" value="${basedir}/media"/>
<!-- ==================== Compilation Control Options ==================== -->
<!--
These properties control option settings on the Javac compiler when it
is invoked using the <javac> task.
compile.debug Should compilation include the debug option?
compile.deprecation Should compilation include the deprecation option?
compile.optimize Should compilation include the optimize option?
-->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<!-- ==================== Compilation Classpath =========================== -->
<!--
Rather than relying on the CLASSPATH environment variable, Ant includes
features that makes it easy to dynamically construct the classpath you
need for each compilation. The example below constructs the compile
classpath to include the servlet.jar file, as well as the other components
that Tomcat makes available to web applications automatically, plus anything
that you explicitly added.
-->
<path id="compile.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- ==================== All Target ====================================== -->
<!--
The "all" target is a shortcut for running the "clean" target followed
by the "compile" target, to force a complete build.
-->
<target name="all" depends="clean,zip"
description="Clean build and dist directories, then compile and zip">
</target>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="clean" description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
<delete file="${zipfile}"/>
<delete file="download.html"/>
<!-- delete old zipfiles - avoids clutter -->
<delete>
<fileset dir="." includes="${app.name}-*.zip"/>
</delete>
</target>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into object files in the appropriate location in the build directory.
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes".
-->
<target name="compile" depends="prepare" description="Compile Java sources">
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}/classes"/>
<javac srcdir="${src.home}"
destdir="${build.home}/classes"
includeantruntime="false"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/classes">
<fileset dir="${src.home}" excludes="**/*.java"/>
</copy>
</target>
<!-- ==================== Dist Target ===================================== -->
<!--
The "dist" target creates a binary distribution of your application
in a directory structure ready to be archived in a tar.gz or zip file.
Note that this target depends on two others:
* "compile" so that the entire web application (including external
dependencies) will have been assembled
* "javadoc" so that the application Javadocs will have been created
-->
<target name="dist" depends="jar,javadoc"
description="Create binary distribution">
<!-- Copy additional files to ${dist.home} as necessary -->
<copy file="Readme.txt" todir="${dist.home}"/>
</target>
<!-- ==================== Jar Target ===================================== -->
<!--
The "jar" packages the compiled class files into a nice package
representing the application.
-->
<target name="jar" depends="compile"
description="Create an application jar file">
<echo message="${app.title} ${app.version} (${distfilebase})"/>
<mkdir dir="${dist.home}"/>
<jar jarfile="${jarfile}"
basedir="${build.home}/classes">
<manifest>
<attribute name="Main-Class" value="ABOVE"/>
<attribute name="Class-Path" value="StarfireExt.jar"/>
<section name="ch/fha/ia02/above/">
<attribute name="Specification-Title" value="${app.title}"/>
<attribute name="Specification-Version" value="${app.version}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Version" value="${app.version}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</section>
</manifest>
</jar>
<copy todir="${dist.home}">
<fileset dir="${basedir}/lib"/>
</copy>
</target>
<!-- ==================== Zip Target ===================================== -->
<!--
The "zip" target takes the binary distribution as well as the source
files and zips them up into one neat package.
-->
<target name="zip" depends="dist"
description="Create a zip file for easier distribution">
<zip destfile="${zipfile}">
<zipfileset dir="${dist.home}" prefix="${app.name}"/>
<zipfileset dir="${src.home}" prefix="${app.name}/src"/>
</zip>
</target>
<!-- ==================== Javadoc Target ================================== -->
<!--
The "javadoc" target creates Javadoc API documentation for the Java
classes included in your application. Normally, this is only required
when preparing a distribution release, but is available as a separate
target in case the developer wants to create Javadocs independently.
-->
<target name="javadoc" depends="prepare"
description="Create Javadoc API documentation">
<mkdir dir="${dist.home}/docs/api"/>
<javadoc sourcepath="${src.home}"
destdir="${dist.home}/docs/api"
windowtitle="${app.title} ${app.version} API Documentation"
packagenames="ch.*">
<classpath refid="compile.classpath"/>
<doctitle><![CDATA[<h1>${app.title} ${app.version} API Documentation</h1>]]></doctitle>
<bottom><![CDATA[<i><a target="_top" href="${app.web}">${app.title} ${app.version}</a> © 2004 ${vendor.name}.</i>]]></bottom>
<link href="http://docs.oracle.com/javase/7/docs/api/"/>
<link href="http://download.java.net/media/java3d/javadoc/1.5.2/"/>
</javadoc>
<!-- Copy documentation files -->
<mkdir dir="${dist.home}/docs"/>
<copy todir="${dist.home}/docs">
<fileset dir="${docs.home}">
<include name="**/*.pdf"/>
</fileset>
</copy>
</target>
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it. If you need
to copy static files from external dependencies, you can customize the
contents of this task.
Normally, this task is executed indirectly when needed.
-->
<target name="prepare">
<tstamp>
<format property="build" pattern="ddMMyyyy.HHmm"/>
</tstamp>
<property name="app.version-nr" value="1.0"/>
<property name="app.version" value="${app.version-nr}-dev (Build: ${build})"/>
<property name="versionsuffix" value="dev"/>
<property name="distfilebase" value="${app.name}-${versionsuffix}"/>
<property name="jarfile" value="${dist.home}/${distfilebase}.jar"/>
<property name="zipfile" value="${distfilebase}.zip"/>
<!-- Create build directories as needed -->
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<!-- Copy external dependencies as required -->
<mkdir dir="${build.home}/classes/media"/>
<copy todir="${build.home}/classes/media">
<fileset dir="${media.home}">
<exclude name="**/*.tga"/>
<exclude name="**/*.psd"/>
</fileset>
</copy>
<!-- Create credits data file -->
<xslt
in="${docs.home}/credits.xml"
out="${build.home}/classes/credits.dat"
style="${docs.home}/creditsdata.xsl"
/>
</target>
<!-- ==================== Run Target ===================================== -->
<!--
The "run" target launches the application.
-->
<target name="run" depends="jar" description="Launches the application.">
<java jar="${jarfile}" fork="true"/>
</target>
<target name="viewer" depends="prepare-run" description="Launch the Vessel Viewer.">
<java classname="ch.fha.ia02.above.VesselViewer" classpathref="run.classpath" fork="true"/>
</target>
<target name="model-benchmark" depends="prepare-run" description="Benchmarks the model.">
<java classname="ch.fha.ia02.above.ModelBenchmark" classpathref="run.classpath" fork="true"/>
</target>
<target name="vector-benchmark" depends="prepare-run" description="Tests used vector methods in perfomance.">
<java classname="ch.fha.ia02.vector.PerformanceTest" classpathref="run.classpath" fork="true"/>
</target>
<target name="prepare-run" depends="jar">
<path id="run.classpath">
<fileset dir="${dist.home}">
<include name="*.jar"/>
</fileset>
</path>
</target>
</project>