2 template Ant build file for all projects that should go into the distribution.
\r
3 Fill out the properties at the beginning of the project definition.
\r
5 The following things have to be set from the outside:
\r
7 property name="jar" value="jar-name-without-suffix" -> the name of the resulting jar file
\r
8 property name="distDir" value="dist-directory" -> the output directory for the resulting jar
\r
9 path id="classpath" -> the filesets defining the classpath needed to compile the project
\r
10 zipfileset id="jarfiles" -> the jar files to be merged with the project's classes
\r
12 <project name="template" default="all" basedir=".">
\r
13 <!-- default values -->
\r
15 <pathelement location="src"/>
\r
17 <path id="classpath"/>
\r
18 <property name="jni" value="jni"/>
\r
19 <property name="target" value="target" />
\r
20 <property name="libs" value="libs" />
\r
21 <zipfileset id="jarfiles" dir="." excludes="**"/>
\r
22 <fileset id="resourcefiles" dir="." excludes="**"/>
\r
24 <!-- clean output directories, create libs directory -->
\r
25 <target name="clean">
\r
26 <mkdir dir="${libs}" />
\r
27 <delete dir="${target}" />
\r
30 <!-- init task, creates all necessary directories -->
\r
31 <target name="init" depends="clean">
\r
32 <mkdir dir="${target}" />
\r
33 <mkdir dir="${target}/java" />
\r
34 <!-- need to copy jni headers for gdx-jnigen -->
\r
35 <copy failonerror="false" todir="${target}/java">
\r
37 <include name="**/*.h"/>
\r
38 <include name="**/*.template"/>
\r
41 <copy failonerror="false" todir="${target}/java">
\r
43 <include name="**/*.gwt.xml"/>
\r
48 <!-- compiles the java code -->
\r
49 <target name="compile" depends="init">
\r
50 <javac debug="on" encoding="utf-8" source="1.6" target="1.6" destdir="${target}/java" includeantruntime="false">
\r
55 <path refid="classpath"/>
\r
56 <fileset file="${libs}/*.jar">
\r
57 <exclude name="*-natives.jar"/>
\r
60 <exclude name="**/gwt/emu/java/lang/System.java"/>
\r
65 <!-- compile native code if available -->
\r
66 <target name="check-natives">
\r
67 <condition property="natives-present">
\r
69 <available file="${jni}/build.xml"/>
\r
70 <istrue value="${build-natives}"/>
\r
75 <target name="compile-natives" depends="init, check-natives" if="natives-present">
\r
76 <mkdir dir="${libs}/android32" />
\r
77 <mkdir dir="${libs}/armeabi" />
\r
78 <mkdir dir="${libs}/armeabi-v7a" />
\r
79 <mkdir dir="${libs}/x86" />
\r
80 <mkdir dir="${libs}/linux32" />
\r
81 <mkdir dir="${libs}/linux64" />
\r
82 <mkdir dir="${libs}/macosx32" />
\r
83 <mkdir dir="${libs}/windows32" />
\r
84 <mkdir dir="${libs}/windows64" />
\r
85 <mkdir dir="${libs}/ios32"/>
\r
86 <echo message="compiling natives code"/>
\r
87 <ant antfile="build.xml" target="clean" dir="${jni}"/>
\r
88 <ant antfile="build.xml" target="all" dir="${jni}"/>
\r
89 <!-- copy shared libs for android -->
\r
90 <copy failonerror="false" todir="${distDir}/armeabi">
\r
91 <fileset dir="${libs}/armeabi">
\r
92 <include name="**/*.so"/>
\r
95 <copy failonerror="false" todir="${distDir}/armeabi-v7a">
\r
96 <fileset dir="${libs}/armeabi-v7a">
\r
97 <include name="**/*.so"/>
\r
100 <copy failonerror="false" todir="${distDir}/x86">
\r
101 <fileset dir="${libs}/x86">
\r
102 <include name="**/*.so"/>
\r
107 <!-- create source and class jar -->
\r
108 <target name="all" depends="compile,compile-natives">
\r
109 <!-- source jar -->
\r
110 <mkdir dir="${distDir}/sources" />
\r
112 <!-- FIXME doesn't work for bullet, as this only takes the src/ folder -->
\r
113 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="src"/>
\r
115 <!-- copy shared libs for desktop -->
\r
116 <copy failonerror="false" todir="${distDir}">
\r
117 <fileset dir="${libs}">
\r
118 <include name="**/*-natives.jar"/>
\r
119 <exclude name="**/test-natives.jar"/>
\r
123 <!-- copy shared libs for android -->
\r
124 <copy failonerror="false" todir="${distDir}/armeabi">
\r
125 <fileset dir="${libs}/armeabi">
\r
126 <include name="**/*.so"/>
\r
129 <copy failonerror="false" todir="${distDir}/armeabi-v7a">
\r
130 <fileset dir="${libs}/armeabi-v7a">
\r
131 <include name="**/*.so"/>
\r
134 <copy failonerror="false" todir="${distDir}/x86">
\r
135 <fileset dir="${libs}/x86">
\r
136 <include name="**/*.so"/>
\r
141 <jar destfile="${distDir}/${jar}.jar">
\r
142 <fileset dir="${target}/java"/>
\r
143 <fileset refid="resourcefiles"/>
\r
144 <!-- merge dependencies found in libs/ folder, exclude native, debug and android/gwt jars -->
\r
145 <zipgroupfileset file="${libs}/*.jar">
\r
146 <exclude name="*-natives.jar"/>
\r
147 <exclude name="*-debug.jar"/>
\r
148 <exclude name="android-*.jar"/>
\r
149 <exclude name="robovm-*.jar"/>
\r
150 <exclude name="gwt*.jar"/>
\r
152 <!-- merge dependencies specified in parent build.xml -->
\r
153 <zipfileset refid="jarfiles"/>
\r