OSDN Git Service

(no commit message)
[mikumikustudio/libgdx-mikumikustudio.git] / build-template.xml
1 <!-- \r
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
4 \r
5 The following things have to be set from the outside:\r
6 \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
11 -->\r
12 <project name="template" default="all" basedir=".">\r
13         <!-- default values -->\r
14         <property name="src" value="src"/>\r
15         <property name="jni" value="jni"/>\r
16         <property name="target" value="target" />\r
17         <property name="libs" value="libs" />\r
18         <path id="classpath"/>\r
19         <zipfileset id="jarfiles" dir="." excludes="**"/>\r
20         \r
21         <!-- clean output directories -->       \r
22         <target name="clean">           \r
23                 <delete dir="${target}" />\r
24         </target>\r
25 \r
26         <!-- init task, creates all necessary directories -->\r
27         <target name="init" depends="clean">\r
28                 <mkdir dir="${target}" />\r
29                 <!-- need to copy the internal font to target if compiling the gdx core :/ -->\r
30                 <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />\r
31                 <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />\r
32         </target>\r
33 \r
34         <!-- compiles the java code -->\r
35         <target name="compile" depends="init">\r
36                 <javac debug="on" srcdir="${src}" destdir="${target}">\r
37                         <classpath>\r
38                                 <path refid="classpath"/>\r
39                                 <fileset file="${libs}/*.jar">\r
40                                         <exclude name="*-natives.jar"/>\r
41                                 </fileset>\r
42                         </classpath>\r
43                 </javac>\r
44         </target>\r
45 \r
46 \r
47         <!-- compile native code if available -->\r
48         <target name="check-natives">\r
49                 <condition property="natives-present">\r
50                         <and>\r
51                                 <available file="${jni}/build.xml"/>\r
52                                 <istrue value="${build-natives}"/>\r
53                         </and>\r
54                 </condition>\r
55         </target>\r
56         <target name="compile-natives" depends="init, check-natives" if="natives-present">\r
57                 <ant antfile="build.xml" target="clean" dir="${jni}"/>\r
58                 <ant antfile="build.xml" target="all" dir="${jni}"/>\r
59                 <!-- copy shared libs for desktop -->\r
60                 <copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>\r
61                 <!-- copy shared libs for android -->\r
62                 <copy failonerror="false" todir="${distDir}/armeabi">\r
63                         <fileset dir="${libs}/armeabi">\r
64                                 <include name="**/*.so"/>\r
65                         </fileset>\r
66                 </copy>\r
67                 <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
68                         <fileset dir="${libs}/armeabi-v7a">\r
69                                 <include name="**/*.so"/>\r
70                         </fileset>\r
71                 </copy>\r
72         </target>\r
73         \r
74         <!-- create source and class jar -->\r
75         <target name="all" depends="compile,compile-natives">\r
76                 <!-- source jar -->\r
77                 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />\r
78                 \r
79                 <!-- class jar -->\r
80                 <jar destfile="${distDir}/${jar}.jar">\r
81                         <fileset dir="${target}" />\r
82                         <!-- merge dependencies found in libs/ folder, exclude native, debug and android jars -->\r
83                         <zipgroupfileset file="${libs}/*.jar">\r
84                                 <exclude name="*-natives.jar"/>\r
85                                 <exclude name="*-debug.jar"/>\r
86                                 <exclude name="android-*.jar"/>\r
87                         </zipgroupfileset>\r
88                         <!-- merge dependencies specified in parent build.xml -->\r
89                         <zipfileset refid="jarfiles"/>\r
90                 </jar>\r
91         </target>\r
92 </project>\r