-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathbuild-template.xml
80 lines (72 loc) · 3.04 KB
/
build-template.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
<!--
template Ant build file for all projects that should go into the distribution.
Fill out the properties at the beginning of the project definition.
The following things have to be set from the outside:
property name="jar" value="jar-name-without-suffix" -> the name of the resulting jar file
property name="distDir" value="dist-directory" -> the output directory for the resulting jar
path id="classpath" -> the filesets defining the classpath needed to compile the project
zipfileset id="jarfiles" -> the jar files to be merged with the project's classes
-->
<project name="template" default="all" basedir=".">
<!-- default values -->
<path id="src">
<pathelement location="src"/>
</path>
<path id="classpath"/>
<property name="target" value="target" />
<property name="libs" value="libs" />
<zipfileset id="jarfiles" dir="." excludes="**"/>
<fileset id="resourcefiles" dir="." excludes="**"/>
<!-- clean output directories, create libs directory -->
<target name="clean">
<mkdir dir="${libs}" />
<delete dir="${target}" />
</target>
<!-- init task, creates all necessary directories -->
<target name="init" depends="clean">
<mkdir dir="${target}" />
<mkdir dir="${target}/java" />
<copy failonerror="false" todir="${target}/java">
<fileset dir="src">
<include name="**/*.gwt.xml"/>
</fileset>
</copy>
</target>
<!-- compiles the java code -->
<target name="compile" depends="init">
<javac debug="on" encoding="utf-8" source="1.6" target="1.6" destdir="${target}/java" includeantruntime="false">
<src>
<path refid="src"/>
</src>
<classpath>
<path refid="classpath"/>
<fileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
</fileset>
</classpath>
<exclude name="**/gwt/jre/java/lang/System.java"/>
</javac>
</target>
<!-- create source and class jar -->
<target name="all" depends="compile">
<!-- source jar -->
<mkdir dir="${distDir}/sources" />
<!-- FIXME doesn't work for bullet, as this only takes the src/ folder -->
<jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="src"/>
<!-- class jar -->
<jar destfile="${distDir}/${jar}.jar">
<fileset dir="${target}/java"/>
<fileset refid="resourcefiles"/>
<!-- merge dependencies found in libs/ folder, exclude native, debug and android/gwt jars -->
<zipgroupfileset file="${libs}/*.jar">
<exclude name="*-debug.jar"/>
<exclude name="android-*.jar"/>
<exclude name="support-*.jar"/>
<exclude name="robovm-*.jar"/>
<exclude name="gwt*.jar"/>
</zipgroupfileset>
<!-- merge dependencies specified in parent build.xml -->
<zipfileset refid="jarfiles"/>
</jar>
</target>
</project>