forked from libgdx/libgdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-template.xml
145 lines (132 loc) · 4.72 KB
/
build-template.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!--
template Ant build file for all projects that should go into the distribution.
Fill out the properties at the beginning of the project definition.
The following things have to be set from the outside:
property name="jar" value="jar-name-without-suffix" -> the name of the resulting jar file
property name="distDir" value="dist-directory" -> the output directory for the resulting jar
path id="classpath" -> the filesets defining the classpath needed to compile the project
zipfileset id="jarfiles" -> the jar files to be merged with the project's classes
-->
<project name="template" default="all" basedir=".">
<!-- default values -->
<path id="src">
<pathelement location="src"/>
</path>
<path id="classpath"/>
<property name="jni" value="jni"/>
<property name="target" value="target" />
<property name="libs" value="libs" />
<zipfileset id="jarfiles" dir="." excludes="**"/>
<fileset id="resourcefiles" dir="." excludes="**"/>
<!-- clean output directories, create libs directory -->
<target name="clean">
<mkdir dir="${libs}" />
<delete dir="${target}" />
</target>
<!-- init task, creates all necessary directories -->
<target name="init" depends="clean">
<mkdir dir="${target}" />
<mkdir dir="${target}/java" />
<!-- need to copy jni headers for gdx-jnigen -->
<copy failonerror="false" todir="${target}/java">
<fileset dir="src">
<include name="**/*.h"/>
<include name="**/*.template"/>
</fileset>
</copy>
<copy failonerror="false" todir="${target}/java">
<fileset dir="src">
<include name="**/*.gwt.xml"/>
</fileset>
</copy>
</target>
<!-- compiles the java code -->
<target name="compile" depends="init">
<javac debug="on" encoding="utf-8" source="1.6" target="1.6" destdir="${target}/java" includeantruntime="false">
<src>
<path refid="src"/>
</src>
<classpath>
<path refid="classpath"/>
<fileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
</fileset>
</classpath>
<exclude name="**/gwt/emu/java/lang/System.java"/>
</javac>
</target>
<!-- compile native code if available -->
<target name="check-natives">
<condition property="natives-present">
<and>
<available file="${jni}/build.xml"/>
<istrue value="${build-natives}"/>
</and>
</condition>
</target>
<target name="compile-natives" depends="init, check-natives" if="natives-present">
<mkdir dir="${libs}/android32" />
<mkdir dir="${libs}/armeabi" />
<mkdir dir="${libs}/armeabi-v7a" />
<mkdir dir="${libs}/x86" />
<mkdir dir="${libs}/linux32" />
<mkdir dir="${libs}/linux64" />
<mkdir dir="${libs}/macosx32" />
<mkdir dir="${libs}/windows32" />
<mkdir dir="${libs}/windows64" />
<mkdir dir="${libs}/ios32"/>
<echo message="compiling natives code"/>
<ant antfile="build.xml" target="clean" dir="${jni}"/>
<ant antfile="build.xml" target="all" dir="${jni}"/>
</target>
<!-- create source and class jar -->
<target name="all" depends="compile,compile-natives">
<!-- source jar -->
<mkdir dir="${distDir}/sources" />
<!-- FIXME doesn't work for bullet, as this only takes the src/ folder -->
<jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="src"/>
<!-- copy shared libs for desktop -->
<copy failonerror="false" todir="${distDir}">
<fileset dir="${libs}">
<include name="**/*-natives.jar"/>
<exclude name="**/test-natives.jar"/>
</fileset>
</copy>
<!-- copy shared libs for android & ios -->
<copy failonerror="false" todir="${distDir}/armeabi">
<fileset dir="${libs}/armeabi">
<include name="**/*.so"/>
</fileset>
</copy>
<copy failonerror="false" todir="${distDir}/armeabi-v7a">
<fileset dir="${libs}/armeabi-v7a">
<include name="**/*.so"/>
</fileset>
</copy>
<copy failonerror="false" todir="${distDir}/x86">
<fileset dir="${libs}/x86">
<include name="**/*.so"/>
</fileset>
</copy>
<copy failonerror="false" todir="${distDir}/ios">
<fileset dir="${libs}/ios32">
<include name="**/*.a"/>
</fileset>
</copy>
<!-- class jar -->
<jar destfile="${distDir}/${jar}.jar">
<fileset dir="${target}/java"/>
<fileset refid="resourcefiles"/>
<!-- merge dependencies found in libs/ folder, exclude native, debug and android/gwt jars -->
<zipgroupfileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
<exclude name="*-debug.jar"/>
<exclude name="android-*.jar"/>
<exclude name="robovm-*.jar"/>
<exclude name="gwt*.jar"/>
</zipgroupfileset>
<!-- merge dependencies specified in parent build.xml -->
<zipfileset refid="jarfiles"/>
</jar>
</target>
</project>