2011-11-30 16:06:48 +00:00
|
|
|
<condition property="android-adb-name" value="${file.separator}platform-tools${file.separator}adb.exe" else="${file.separator}platform-tools${file.separator}adb">
|
|
|
|
<os family="windows" />
|
|
|
|
</condition>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2012-08-26 12:54:35 +00:00
|
|
|
<target name="run-android" depends="-flag-no-android, jar, -test-android-enabled, -copy-android-libs" if="is.android.enabled">
|
2011-11-30 16:06:48 +00:00
|
|
|
<echo>Building debug android application version.</echo>
|
2012-08-26 12:54:35 +00:00
|
|
|
<ant dir="mobile" target="debug" inheritall="false"/>
|
2011-11-30 16:06:48 +00:00
|
|
|
<antcall target="-start-android-device"/>
|
2012-08-26 12:54:35 +00:00
|
|
|
<ant dir="mobile" target="installd" inheritall="false"/>
|
2011-11-30 16:06:48 +00:00
|
|
|
<antcall target="-run-android-device"/>
|
2011-09-05 15:08:12 +00:00
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-09-06 10:03:23 +00:00
|
|
|
<target name="clean-android">
|
2012-08-26 12:54:35 +00:00
|
|
|
<ant dir="mobile" target="clean" inheritall="false"/>
|
2011-09-05 15:08:12 +00:00
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-09-08 00:44:10 +00:00
|
|
|
<target name="-mobile-deployment" depends="-test-android-enabled, -copy-android-libs" if="is.android.enabled" unless="no.android.build">
|
2012-08-26 12:54:35 +00:00
|
|
|
<ant dir="mobile" target="release" inheritall="false"/>
|
2011-09-05 15:08:12 +00:00
|
|
|
<copy todir="dist" verbose="false" flatten="true">
|
|
|
|
<fileset dir="mobile/bin/">
|
|
|
|
<include name="**/*.apk"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</target>
|
2012-08-26 12:13:08 +00:00
|
|
|
|
2011-09-05 15:08:12 +00:00
|
|
|
<target name="-copy-android-libs" if="is.android.enabled">
|
2011-11-26 23:04:45 +00:00
|
|
|
<echo>Copying application libraries to android project.</echo>
|
2011-11-13 20:24:19 +00:00
|
|
|
<delete dir="mobile/libs" failonerror="false"/>
|
|
|
|
<mkdir dir="mobile/libs"/>
|
2013-04-16 02:03:58 +00:00
|
|
|
<antcall target="-copy-project-libs"/>
|
2013-02-10 16:33:57 +00:00
|
|
|
<antcall target="-add-android-lib"/>
|
|
|
|
<antcall target="-unzip-bullet-libs"/>
|
|
|
|
<antcall target="-unzip-assets"/>
|
2013-04-16 02:03:58 +00:00
|
|
|
<copy file="${dist.jar}" todir="mobile/libs/" verbose="false" preservelastmodified="true"/>
|
2013-05-17 23:27:25 +00:00
|
|
|
<antcall target="-unzip-openal-soft-libs"/>
|
2013-04-16 02:03:58 +00:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target description="create mobile/libs directory and copy project libraries" name="-copy-project-libs">
|
2013-04-16 12:07:46 +00:00
|
|
|
<copy todir="mobile/libs" flatten="true" verbose="false" preservelastmodified="true">
|
2013-04-16 02:03:58 +00:00
|
|
|
<path>
|
|
|
|
<pathelement path="${run.classpath.without.build.classes.dir}"/>
|
|
|
|
</path>
|
|
|
|
</copy>
|
|
|
|
<delete file="mobile/libs/${assets.jar.name}"/>
|
|
|
|
<delete file="mobile/libs/jME3-desktop.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-blender.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-lwjgl.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-lwjgl-natives.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-bullet-natives.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-jbullet.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-bullet.jar"/>
|
|
|
|
<delete file="mobile/libs/jbullet.jar"/>
|
|
|
|
<delete file="mobile/libs/stack-alloc.jar"/>
|
|
|
|
<delete file="mobile/libs/vecmath.jar"/>
|
|
|
|
<delete file="mobile/libs/lwjgl.jar"/>
|
|
|
|
<delete file="mobile/libs/jinput.jar"/>
|
2013-02-10 16:33:57 +00:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="-add-android-lib">
|
2011-12-03 04:38:08 +00:00
|
|
|
<echo>Adding libraries for android.</echo>
|
2013-04-16 02:03:58 +00:00
|
|
|
<copy todir="mobile/libs" flatten="true" preservelastmodified="true">
|
2011-11-26 15:57:59 +00:00
|
|
|
<path>
|
2012-02-26 14:20:13 +00:00
|
|
|
<pathelement path="${libs.android-base.classpath}"/>
|
2011-11-26 15:57:59 +00:00
|
|
|
</path>
|
|
|
|
</copy>
|
2011-09-08 00:44:10 +00:00
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-11-26 23:04:45 +00:00
|
|
|
<target name="-unzip-bullet-libs" depends="-delete-bullet-libs" if="bulletIsIncluded">
|
|
|
|
<echo>Replacing bullet library with android native version.</echo>
|
2013-04-16 02:03:58 +00:00
|
|
|
|
|
|
|
<!-- use copy with zipfileset to enable preserving the last modified date to avoid pre-dexing -->
|
|
|
|
<copy todir="mobile/libs" preservelastmodified="true">
|
|
|
|
<zipfileset src="mobile/libs/jME3-bullet-natives-android.jar">
|
|
|
|
</zipfileset>
|
|
|
|
</copy>
|
|
|
|
|
2011-11-26 23:04:45 +00:00
|
|
|
<delete file="mobile/libs/jME3-bullet-natives-android.jar"/>
|
|
|
|
<delete dir="mobile/libs/x86"/>
|
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-11-30 23:14:40 +00:00
|
|
|
<target name="-delete-bullet-libs" depends="-test-bullet-included" unless="bulletIsIncluded">
|
|
|
|
<delete file="mobile/libs/jME3-bullet.jar"/>
|
|
|
|
<delete file="mobile/libs/jME3-bullet-natives-android.jar"/>
|
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
|
|
|
<target name="-unzip-assets">
|
|
|
|
<echo>Unzipping Assets to Android Directories</echo>
|
|
|
|
<delete dir="mobile/assets" failonerror="false"/>
|
|
|
|
<mkdir dir="mobile/assets"/>
|
|
|
|
<unzip src="dist/lib/${assets.jar.name}" dest="mobile/assets"/>
|
|
|
|
<delete file="mobile/libs/${assets.jar.name}" failonerror="true"/>
|
|
|
|
</target>
|
|
|
|
|
2013-05-17 23:27:25 +00:00
|
|
|
<target name="-unzip-openal-soft-libs" depends="-test-openalsoft-included" if="openalsoftIsIncluded">
|
|
|
|
<echo>Adding OpenAL Soft</echo>
|
|
|
|
<!-- use copy with zipfileset to enable preserving the last modified date to avoid pre-dexing -->
|
|
|
|
<copy todir="mobile/libs" preservelastmodified="true">
|
|
|
|
<zipfileset src="mobile/libs/jME3-openal-soft-natives-android.jar">
|
|
|
|
</zipfileset>
|
|
|
|
</copy>
|
|
|
|
<delete file="mobile/libs/jME3-openal-soft-natives-android.jar"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="-test-openalsoft-included">
|
|
|
|
<condition property="openalsoftIsIncluded">
|
|
|
|
<contains string="${javac.classpath}" substring="jME3-openal-soft-natives-android.jar"/>
|
|
|
|
</condition>
|
|
|
|
</target>
|
|
|
|
|
2011-11-26 15:57:59 +00:00
|
|
|
<target name="-test-bullet-included">
|
|
|
|
<condition property="bulletIsIncluded">
|
|
|
|
<contains string="${javac.classpath}" substring="bullet.jar"/>
|
|
|
|
</condition>
|
|
|
|
</target>
|
2011-09-08 00:44:10 +00:00
|
|
|
|
2011-11-30 16:06:48 +00:00
|
|
|
<target name="-start-android-device">
|
|
|
|
<property file="mobile/local.properties"/>
|
|
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
|
|
<arg value="start-server"/>
|
|
|
|
</exec>
|
2011-11-30 23:14:40 +00:00
|
|
|
<echo>Waiting for device to be ready.. Connect your device now if its not connected yet.</echo>
|
2011-11-30 16:06:48 +00:00
|
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
|
|
<arg value="wait-for-device"/>
|
|
|
|
</exec>
|
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-11-30 16:06:48 +00:00
|
|
|
<target name="-run-android-device">
|
|
|
|
<property file="mobile/local.properties"/>
|
|
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
|
|
<arg value="logcat"/>
|
|
|
|
<arg value="-c"/>
|
|
|
|
</exec>
|
|
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
|
|
<arg value="shell"/>
|
|
|
|
<arg value="am start -n ${mobile.android.package}/.MainActivity"/>
|
|
|
|
</exec>
|
2011-11-30 23:14:40 +00:00
|
|
|
<echo>Logging android device output, cancel build or disconnect device to stop logging.</echo>
|
2011-11-30 16:06:48 +00:00
|
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
|
|
<arg value="logcat"/>
|
|
|
|
<arg value="AndroidRuntime:E"/>
|
|
|
|
<arg value="System.out:I"/>
|
|
|
|
<arg value="System.err:W"/>
|
|
|
|
<arg value="NSLog:*"/>
|
|
|
|
</exec>
|
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-11-30 16:06:48 +00:00
|
|
|
<target name="-test-android-enabled">
|
|
|
|
<condition property="is.android.enabled">
|
|
|
|
<istrue value="${mobile.android.enabled}"/>
|
|
|
|
</condition>
|
|
|
|
</target>
|
2012-10-16 03:23:52 +00:00
|
|
|
|
2011-09-08 00:44:10 +00:00
|
|
|
<target name="-flag-no-android">
|
|
|
|
<property name="no.android.build" value="true"/>
|
2012-10-16 03:23:52 +00:00
|
|
|
</target>
|