forked from libgdx/libgdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-template.xml
100 lines (91 loc) · 3.63 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
<!--
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 -->
<property name="src" value="src"/>
<property name="jni" value="jni"/>
<property name="target" value="target" />
<property name="libs" value="libs" />
<path id="classpath"/>
<zipfileset id="jarfiles" dir="." excludes="**"/>
<!-- clean output directories -->
<target name="clean">
<delete dir="${target}" />
</target>
<!-- init task, creates all necessary directories -->
<target name="init" depends="clean">
<mkdir dir="${target}" />
<!-- need to copy the internal font to target if compiling the gdx core :/ -->
<copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />
<copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />
<!-- need to copy jni headers for gdx-jnigen -->
<copy failonerror="false" todir="${target}">
<fileset dir="src">
<include name="**/*.h"/>
<include name="**/*.template"/>
</fileset>
</copy>
</target>
<!-- compiles the java code -->
<target name="compile" depends="init">
<javac debug="on" srcdir="${src}" destdir="${target}">
<classpath>
<path refid="classpath"/>
<fileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
</fileset>
</classpath>
</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">
<echo message="compiling natives code"/>
<ant antfile="build.xml" target="clean" dir="${jni}"/>
<ant antfile="build.xml" target="all" dir="${jni}"/>
<!-- copy shared libs for desktop -->
<copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>
<!-- copy shared libs for android -->
<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>
</target>
<!-- create source and class jar -->
<target name="all" depends="compile,compile-natives">
<!-- source jar -->
<jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />
<!-- class jar -->
<jar destfile="${distDir}/${jar}.jar">
<fileset dir="${target}" />
<!-- merge dependencies found in libs/ folder, exclude native, debug and android jars -->
<zipgroupfileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
<exclude name="*-debug.jar"/>
<exclude name="android-*.jar"/>
</zipgroupfileset>
<!-- merge dependencies specified in parent build.xml -->
<zipfileset refid="jarfiles"/>
</jar>
</target>
</project>