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 <property environment="env" />
\r
15 <!-- default values -->
\r
16 <property name="src" value="src"/>
\r
17 <property name="jni" value="jni"/>
\r
18 <property name="target" value="target" />
\r
19 <property name="libs" value="libs" />
\r
20 <path id="classpath"/>
\r
21 <zipfileset id="jarfiles" dir="." excludes="**"/>
\r
23 <!-- clean output directories -->
\r
24 <target name="clean">
\r
25 <delete dir="${target}" />
\r
28 <!-- init task, creates all necessary directories -->
\r
29 <target name="init" depends="clean">
\r
30 <mkdir dir="${target}" />
\r
31 <!-- need to copy the internal font to target if compiling the gdx core :/ -->
\r
32 <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />
\r
33 <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />
\r
36 <!-- compiles the java code -->
\r
37 <target name="compile" depends="init">
\r
38 <javac debug="on" srcdir="${src}" destdir="${target}">
\r
40 <path refid="classpath"/>
\r
41 <fileset file="${libs}/*.jar">
\r
42 <exclude name="*-natives.jar"/>
\r
49 <!-- compile native code if available -->
\r
50 <target name="check-natives">
\r
51 <condition property="natives-present">
\r
53 <available file="${jni}/build.xml"/>
\r
54 <not><os family="windows"/></not>
\r
58 <target name="compile-natives" depends="init, check-natives" if="natives-present">
\r
59 <ant antfile="build.xml" target="clean" dir="${jni}"/>
\r
60 <ant antfile="build.xml" target="all" dir="${jni}"/>
\r
63 <!-- create source and class jar -->
\r
64 <target name="all" depends="compile,compile-natives">
\r
66 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />
\r
69 <jar destfile="${distDir}/${jar}.jar">
\r
70 <fileset dir="${target}" />
\r
71 <!-- merge dependencies found in libs/ folder, exclude native, debug and android jars -->
\r
72 <zipgroupfileset file="${libs}/*.jar">
\r
73 <exclude name="*-natives.jar"/>
\r
74 <exclude name="*-debug.jar"/>
\r
75 <exclude name="android-*.jar"/>
\r
77 <!-- merge dependencies specified in parent build.xml -->
\r
78 <zipfileset refid="jarfiles"/>
\r
81 <!-- optional natives jar for desktop -->
\r
82 <copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>
\r
84 <!-- optional shared libraries for android -->
\r
85 <copy failonerror="false" todir="${distDir}/armeabi">
\r
86 <fileset dir="${libs}/armeabi">
\r
87 <include name="**/*.so"/>
\r
90 <copy failonerror="false" todir="${distDir}/armeabi-v7a">
\r
91 <fileset dir="${libs}/armeabi-v7a">
\r
92 <include name="**/*.so"/>
\r