OSDN Git Service

fixed build...
[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="${libs}/android32" />\r
29                 <mkdir dir="${libs}/armeabi" />\r
30                 <mkdir dir="${libs}/armeabi-v7a" />\r
31                 <mkdir dir="${libs}/linux32" />\r
32                 <mkdir dir="${libs}/linux64" />\r
33                 <mkdir dir="${libs}/macosx32" />\r
34                 <mkdir dir="${libs}/windows32" />\r
35                 <mkdir dir="${libs}/windows64" />\r
36                 <mkdir dir="${libs}/ios32"/>\r
37                 \r
38                 <mkdir dir="${target}" />\r
39                 <mkdir dir="${target}/java" />\r
40                 <!-- need to copy the internal font to target if compiling the gdx core :/ -->\r
41                 <copy failonerror="false" tofile="${target}/java/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />\r
42                 <copy failonerror="false" tofile="${target}/java/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />\r
43                 <!-- need to copy jni headers for gdx-jnigen -->\r
44                 <copy failonerror="false" todir="${target}/java">\r
45                         <fileset dir="src">\r
46                                 <include name="**/*.h"/>\r
47                                 <include name="**/*.template"/>\r
48                         </fileset>\r
49                 </copy>\r
50                 <copy failonerror="false" todir="${target}/java">\r
51                         <fileset dir="src">\r
52                                 <include name="**/*.gwt.xml"/>\r
53                         </fileset>\r
54                 </copy>\r
55         </target>\r
56 \r
57         <!-- compiles the java code -->\r
58         <target name="compile" depends="init">\r
59                 <javac debug="on" encoding="utf-8" source="1.6" target="1.6" srcdir="${src}" destdir="${target}/java">\r
60                         <classpath>\r
61                                 <path refid="classpath"/>\r
62                                 <fileset file="${libs}/*.jar">\r
63                                         <exclude name="*-natives.jar"/>\r
64                                 </fileset>\r
65                         </classpath>\r
66                         <exclude name="**/gwt/emu/java/lang/System.java"/>\r
67                 </javac>\r
68         </target>\r
69 \r
70 \r
71         <!-- compile native code if available -->\r
72         <target name="check-natives">\r
73                 <condition property="natives-present">\r
74                         <and>\r
75                                 <available file="${jni}/build.xml"/>\r
76                                 <istrue value="${build-natives}"/>\r
77                         </and>\r
78                 </condition>\r
79         </target>\r
80         <target name="compile-natives" depends="init, check-natives" if="natives-present">\r
81                 <echo message="compiling natives code"/>\r
82                 <ant antfile="build.xml" target="clean" dir="${jni}"/>\r
83                 <ant antfile="build.xml" target="all" dir="${jni}"/>\r
84                 <!-- copy shared libs 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         \r
97         <!-- create source and class jar -->\r
98         <target name="all" depends="compile,compile-natives">\r
99                 <!-- source jar -->\r
100                 <mkdir dir="${distDir}/sources" />\r
101                 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />\r
102                 \r
103                 <!-- copy shared libs for desktop -->\r
104                 <copy failonerror="false" todir="${distDir}">\r
105                         <fileset dir="${libs}">\r
106                                 <include name="**/*-natives.jar"/>\r
107                                 <exclude name="**/test-natives.jar"/>\r
108                         </fileset>\r
109                 </copy>\r
110                 \r
111                 <!-- copy shared libs for android -->\r
112                 <copy failonerror="false" todir="${distDir}/armeabi">\r
113                         <fileset dir="${libs}/armeabi">\r
114                                 <include name="**/*.so"/>\r
115                         </fileset>\r
116                 </copy>\r
117                 <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
118                         <fileset dir="${libs}/armeabi-v7a">\r
119                                 <include name="**/*.so"/>\r
120                         </fileset>\r
121                 </copy>\r
122                 \r
123                 <!-- class jar -->\r
124                 <jar destfile="${distDir}/${jar}.jar">\r
125                         <fileset dir="${target}/java"/>\r
126                         <!-- merge dependencies found in libs/ folder, exclude native, debug and android/gwt jars -->\r
127                         <zipgroupfileset file="${libs}/*.jar">\r
128                                 <exclude name="*-natives.jar"/>\r
129                                 <exclude name="*-debug.jar"/>\r
130                                 <exclude name="android-*.jar"/>\r
131                                 <exclude name="gwt*.jar"/>\r
132                         </zipgroupfileset>\r
133                         <!-- merge dependencies specified in parent build.xml -->\r
134                         <zipfileset refid="jarfiles"/>\r
135                 </jar>\r
136         </target>\r
137 </project>\r