OSDN Git Service

Fixed JSON parsing of a single non-object, non-array.
[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         <path id="src">\r
15                 <pathelement location="src"/>\r
16         </path>\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         \r
23         <!-- clean output directories, create libs directory -->        \r
24         <target name="clean">           \r
25                 <mkdir dir="${libs}" />\r
26                 <delete dir="${target}" />\r
27         </target>\r
28 \r
29         <!-- init task, creates all necessary directories -->\r
30         <target name="init" depends="clean">            \r
31                 <mkdir dir="${target}" />\r
32                 <mkdir dir="${target}/java" />\r
33                 <!-- need to copy the internal font to target if compiling the gdx core :/ -->\r
34                 <copy failonerror="false" tofile="${target}/java/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />\r
35                 <copy failonerror="false" tofile="${target}/java/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />\r
36                 <!-- need to copy jni headers for gdx-jnigen -->\r
37                 <copy failonerror="false" todir="${target}/java">\r
38                         <fileset dir="src">\r
39                                 <include name="**/*.h"/>\r
40                                 <include name="**/*.template"/>\r
41                         </fileset>\r
42                 </copy>\r
43                 <copy failonerror="false" todir="${target}/java">\r
44                         <fileset dir="src">\r
45                                 <include name="**/*.gwt.xml"/>\r
46                         </fileset>\r
47                 </copy>\r
48         </target>\r
49 \r
50         <!-- compiles the java code -->\r
51         <target name="compile" depends="init">\r
52                 <javac debug="on" encoding="utf-8" source="1.6" target="1.6" destdir="${target}/java" includeantruntime="false">\r
53                         <src>\r
54                                 <path refid="src"/>\r
55                         </src>\r
56                         <classpath>\r
57                                 <path refid="classpath"/>\r
58                                 <fileset file="${libs}/*.jar">\r
59                                         <exclude name="*-natives.jar"/>\r
60                                 </fileset>\r
61                         </classpath>\r
62                         <exclude name="**/gwt/emu/java/lang/System.java"/>\r
63                 </javac>\r
64         </target>\r
65 \r
66 \r
67         <!-- compile native code if available -->\r
68         <target name="check-natives">\r
69                 <condition property="natives-present">\r
70                         <and>\r
71                                 <available file="${jni}/build.xml"/>\r
72                                 <istrue value="${build-natives}"/>\r
73                         </and>\r
74                 </condition>\r
75         </target>\r
76         \r
77         <target name="compile-natives" depends="init, check-natives" if="natives-present">\r
78                 <mkdir dir="${libs}/android32" />\r
79                 <mkdir dir="${libs}/armeabi" />\r
80                 <mkdir dir="${libs}/armeabi-v7a" />\r
81                 <mkdir dir="${libs}/linux32" />\r
82                 <mkdir dir="${libs}/linux64" />\r
83                 <mkdir dir="${libs}/macosx32" />\r
84                 <mkdir dir="${libs}/windows32" />\r
85                 <mkdir dir="${libs}/windows64" />\r
86                 <mkdir dir="${libs}/ios32"/>\r
87                 <echo message="compiling natives code"/>\r
88                 <ant antfile="build.xml" target="clean" dir="${jni}"/>\r
89                 <ant antfile="build.xml" target="all" dir="${jni}"/>\r
90                 <!-- copy shared libs for android -->\r
91                 <copy failonerror="false" todir="${distDir}/armeabi">\r
92                         <fileset dir="${libs}/armeabi">\r
93                                 <include name="**/*.so"/>\r
94                         </fileset>\r
95                 </copy>\r
96                 <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
97                         <fileset dir="${libs}/armeabi-v7a">\r
98                                 <include name="**/*.so"/>\r
99                         </fileset>\r
100                 </copy>\r
101         </target>\r
102         \r
103         <!-- create source and class jar -->\r
104         <target name="all" depends="compile,compile-natives">\r
105                 <!-- source jar -->\r
106                 <mkdir dir="${distDir}/sources" />\r
107                 \r
108                 <!-- FIXME doesn't work for bullet, as this only takes the src/ folder -->\r
109                 <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="src"/>                   \r
110                 \r
111                 <!-- copy shared libs for desktop -->\r
112                 <copy failonerror="false" todir="${distDir}">\r
113                         <fileset dir="${libs}">\r
114                                 <include name="**/*-natives.jar"/>\r
115                                 <exclude name="**/test-natives.jar"/>\r
116                         </fileset>\r
117                 </copy>\r
118                 \r
119                 <!-- copy shared libs for android -->\r
120                 <copy failonerror="false" todir="${distDir}/armeabi">\r
121                         <fileset dir="${libs}/armeabi">\r
122                                 <include name="**/*.so"/>\r
123                         </fileset>\r
124                 </copy>\r
125                 <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
126                         <fileset dir="${libs}/armeabi-v7a">\r
127                                 <include name="**/*.so"/>\r
128                         </fileset>\r
129                 </copy>\r
130                 \r
131                 <!-- class jar -->\r
132                 <jar destfile="${distDir}/${jar}.jar">\r
133                         <fileset dir="${target}/java"/>\r
134                         <!-- merge dependencies found in libs/ folder, exclude native, debug and android/gwt jars -->\r
135                         <zipgroupfileset file="${libs}/*.jar">\r
136                                 <exclude name="*-natives.jar"/>\r
137                                 <exclude name="*-debug.jar"/>\r
138                                 <exclude name="android-*.jar"/>\r
139                                 <exclude name="gwt*.jar"/>\r
140                         </zipgroupfileset>\r
141                         <!-- merge dependencies specified in parent build.xml -->\r
142                         <zipfileset refid="jarfiles"/>\r
143                 </jar>\r
144         </target>\r
145 </project>\r