OSDN Git Service

[fixed] new build scripts
[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         <property environment="env" />\r
14 \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
22         \r
23         <!-- clean output directories -->       \r
24         <target name="clean">           \r
25                 <delete dir="${target}" />\r
26         </target>\r
27 \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
34         </target>\r
35 \r
36         <!-- compiles the java code -->\r
37         <target name="compile" depends="init">\r
38                 <javac debug="on" srcdir="${src}" destdir="${target}">\r
39                         <classpath>\r
40                                 <path refid="classpath"/>\r
41                                 <fileset file="${libs}/*.jar">\r
42                                         <exclude name="*-natives.jar"/>\r
43                                 </fileset>\r
44                         </classpath>\r
45                 </javac>\r
46         </target>\r
47 \r
48 \r
49         <!-- compile native code if available -->\r
50         <target name="check-natives">\r
51                 <condition property="natives-present">\r
52                         <and>\r
53                                 <available file="${jni}/build.xml"/>\r
54                                 <not><os family="windows"/></not>\r
55                         </and>\r
56                 </condition>\r
57         </target>\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
61         </target>       \r
62         \r
63         <!-- create source and class jar -->\r
64         <target name="all" depends="compile,compile-natives">\r
65                 <!-- source jar -->\r
66                 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />\r
67                 \r
68                 <!-- class jar -->\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
76                         </zipgroupfileset>\r
77                         <!-- merge dependencies specified in parent build.xml -->\r
78                         <zipfileset refid="jarfiles"/>\r
79                 </jar>\r
80                 \r
81                 <!-- optional natives jar for desktop -->\r
82                 <copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>\r
83                 \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
88                         </fileset>\r
89                 </copy>\r
90                 <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
91                         <fileset dir="${libs}/armeabi-v7a">\r
92                                 <include name="**/*.so"/>\r
93                         </fileset>\r
94                 </copy>\r
95         </target>\r
96 </project>\r