OSDN Git Service

[added] new build files.
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 27 Dec 2011 01:03:25 +0000 (01:03 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 27 Dec 2011 01:03:25 +0000 (01:03 +0000)
build-new.xml [new file with mode: 0644]
build-template.xml [new file with mode: 0644]

diff --git a/build-new.xml b/build-new.xml
new file mode 100644 (file)
index 0000000..4176616
--- /dev/null
@@ -0,0 +1,71 @@
+<project name="gdx" default="all" basedir=".">\r
+       <description>libgdx distribution build file</description>\r
+       <property environment="env" />\r
+       \r
+       <!-- define distribution/output directory -->\r
+       <property name="distDir" value="${basedir}/dist"/>\r
+       \r
+       <!-- clean distribution/output directory -->\r
+       <target name="clean">\r
+               <delete dir="${distDir}"/>\r
+       </target>\r
+       \r
+       <!-- gdx core -->\r
+       <target name="gdx-core">\r
+               <ant antfile="../build-template.xml" dir="gdx">\r
+                       <property name="jar" value="gdx"/>\r
+               </ant>\r
+       </target>\r
+       \r
+       <!-- gdx openal, for all desktop backends -->\r
+       <target name="gdx-openal" depends="gdx-core">\r
+               <path id="classpath">\r
+                       <pathelement location="${distDir}/gdx.jar"/>\r
+               </path>\r
+               <ant antfile="../../build-template.xml" dir="backends/gdx-openal">\r
+                       <property name="jar" value="gdx-openal"/>\r
+                       <reference refid="classpath"/>\r
+               </ant>\r
+       </target>\r
+       \r
+       <!-- gdx jogl backend -->\r
+       <target name="gdx-backend-jogl" depends="gdx-core,gdx-openal">\r
+               <path id="classpath">\r
+                       <pathelement location="${distDir}/gdx.jar"/>\r
+                       <pathelement location="${distDir}/gdx-openal.jar"/>\r
+               </path>\r
+               <zipfileset id="jarfiles" src="${distDir}/gdx-openal.jar"/>\r
+               <ant antfile="../../build-template.xml" dir="backends/gdx-backend-jogl">\r
+                       <property name="jar" value="gdx-backend-jogl"/>\r
+                       <reference refid="classpath"/>\r
+                       <reference refid="jarfiles"/>\r
+               </ant>\r
+       </target>\r
+       \r
+       <!-- gdx lwjgl backend -->\r
+       <target name="gdx-backend-lwjgl" depends="gdx-core,gdx-openal">\r
+               <path id="classpath">\r
+                       <pathelement location="${distDir}/gdx.jar"/>\r
+                       <pathelement location="${distDir}/gdx-openal.jar"/>\r
+               </path>\r
+               <zipfileset id="jarfiles" src="${distDir}/gdx-openal.jar"/>\r
+               <ant antfile="../../build-template.xml" dir="backends/gdx-backend-lwjgl">\r
+                       <property name="jar" value="gdx-backend-lwjgl"/>\r
+                       <reference refid="classpath"/>\r
+                       <reference refid="jarfiles"/>\r
+               </ant>\r
+       </target>\r
+       \r
+       <!-- gdx android backend -->\r
+       <target name="gdx-backend-android" depends="gdx-core">\r
+               <path id="classpath">\r
+                       <pathelement location="${distDir}/gdx.jar"/>\r
+               </path>\r
+               <ant antfile="../../build-template.xml" dir="backends/gdx-backend-android">\r
+                       <property name="jar" value="gdx-backend-android"/>\r
+                       <reference refid="classpath"/>\r
+               </ant>\r
+       </target>\r
+       \r
+       <target name="all" depends="clean,gdx-core,gdx-openal,gdx-backend-jogl,gdx-backend-lwjgl,gdx-backend-android"/>\r
+</project>
\ No newline at end of file
diff --git a/build-template.xml b/build-template.xml
new file mode 100644 (file)
index 0000000..5b23a9f
--- /dev/null
@@ -0,0 +1,91 @@
+<!-- \r
+template Ant build file for all projects that should go into the distribution. \r
+Fill out the properties at the beginning of the project definition.\r
+\r
+The following things have to be set from the outside:\r
+\r
+property name="jar" value="jar-name-without-suffix" -> the name of the resulting jar file\r
+property name="distDir" value="dist-directory" -> the output directory for the resulting jar\r
+path id="classpath" -> the filesets defining the classpath needed to compile the project\r
+zipfileset id="jarfiles" -> the jar files to be merged with the project's classes\r
+-->\r
+<project name="template" default="all" basedir=".">\r
+       <property environment="env" />\r
+\r
+       <!-- default values -->\r
+       <property name="src" value="src"/>\r
+       <property name="jni" value="jni"/>\r
+       <property name="target" value="target" />\r
+       <property name="libs" value="libs" />\r
+       <path id="classpath"/>\r
+       <zipfileset id="jarfiles" dir="." excludes="**"/>\r
+       \r
+       <!-- clean output directories -->       \r
+       <target name="clean">           \r
+               <delete dir="${target}" />\r
+       </target>\r
+\r
+       <!-- init task, creates all necessary directories -->\r
+       <target name="init" depends="clean">\r
+               <mkdir dir="${target}" />\r
+               <!-- need to copy the internal font to target if compiling the gdx core :/ -->\r
+               <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />\r
+               <copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />\r
+       </target>\r
+\r
+       <!-- compiles the java code -->\r
+       <target name="compile" depends="init">\r
+               <javac debug="on" srcdir="${src}" destdir="${target}">\r
+                       <classpath>\r
+                               <path refid="classpath"/>\r
+                               <fileset file="${libs}/*.jar">\r
+                                       <exclude name="*-natives.jar"/>\r
+                               </fileset>\r
+                       </classpath>\r
+               </javac>\r
+       </target>\r
+\r
+\r
+       <!-- compile native code if available -->\r
+       <target name="check-natives">\r
+               <available file="${jni}/build.xml" property="natives-present"/>\r
+       </target>\r
+       <target name="compile-natives" depends="init, check-natives" if="natives-present">\r
+               <ant antfile="build.xml" target="clean" dir="${jni}"/>\r
+               <ant antfile="build.xml" target="all" dir="${jni}"/>\r
+       </target>       \r
+       \r
+       <!-- create source and class jar -->\r
+       <target name="all" depends="compile,compile-natives">\r
+               <!-- source jar -->\r
+               <jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />\r
+               \r
+               <!-- class jar -->\r
+               <jar destfile="${distDir}/${jar}.jar">\r
+                       <fileset dir="${target}" />\r
+                       <!-- merge dependencies found in libs/ folder, exclude native, debug and android jars -->\r
+                       <zipgroupfileset file="${libs}/*.jar">\r
+                               <exclude name="*-natives.jar"/>\r
+                               <exclude name="*-debug.jar"/>\r
+                               <exclude name="android-*.jar"/>\r
+                       </zipgroupfileset>\r
+                       <!-- merge dependencies specified in parent build.xml -->\r
+                       <zipfileset refid="jarfiles"/>\r
+               </jar>\r
+               \r
+               <!-- optional natives jar for desktop -->\r
+               <copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>\r
+               \r
+               <!-- optional shared libraries for android -->\r
+               <copy failonerror="false" todir="${distDir}/armeabi">\r
+                       <fileset dir="${libs}/armeabi">\r
+                               <include name="**/*.so"/>\r
+                       </fileset>\r
+               </copy>\r
+               <copy failonerror="false" todir="${distDir}/armeabi-v7a">\r
+                       <fileset dir="${libs}/armeabi-v7a">\r
+                               <include name="**/*.so"/>\r
+                       </fileset>\r
+               </copy>\r
+       </target>\r
+</project>\r