OSDN Git Service

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