You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
5.9 KiB
139 lines
5.9 KiB
<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>
|
|
|
|
<target name="run-android" depends="-flag-no-android, jar, -test-android-enabled, -copy-android-libs" if="is.android.enabled">
|
|
<echo>Building debug android application version.</echo>
|
|
<ant dir="mobile" target="debug" inheritall="false"/>
|
|
<antcall target="-start-android-device"/>
|
|
<ant dir="mobile" target="installd" inheritall="false"/>
|
|
<antcall target="-run-android-device"/>
|
|
</target>
|
|
|
|
<target name="clean-android">
|
|
<ant dir="mobile" target="clean" inheritall="false"/>
|
|
</target>
|
|
|
|
<target name="-mobile-deployment" depends="-test-android-enabled, -copy-android-libs" if="is.android.enabled" unless="no.android.build">
|
|
<ant dir="mobile" target="release" inheritall="false"/>
|
|
<copy todir="dist" verbose="false" flatten="true">
|
|
<fileset dir="mobile/bin/">
|
|
<include name="**/*.apk"/>
|
|
</fileset>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="-copy-android-libs" if="is.android.enabled">
|
|
<echo>Copying application libraries to android project.</echo>
|
|
<delete dir="mobile/libs" failonerror="false"/>
|
|
<mkdir dir="mobile/libs"/>
|
|
<antcall target="-copy-project-libs"/>
|
|
<antcall target="-add-android-lib"/>
|
|
<antcall target="-add-bullet-libs"/>
|
|
<antcall target="-unzip-assets"/>
|
|
<copy file="${dist.jar}" todir="mobile/libs/" verbose="false" preservelastmodified="true"/>
|
|
</target>
|
|
|
|
<target name="-copy-project-libs" description="create mobile/libs directory and copy project libraries">
|
|
<copy todir="mobile/libs" flatten="true" verbose="false" preservelastmodified="true">
|
|
<path>
|
|
<pathelement path="${run.classpath.without.build.classes.dir}"/>
|
|
</path>
|
|
</copy>
|
|
<delete>
|
|
<fileset dir="mobile/libs">
|
|
<include name="${assets.jar.name}"/>
|
|
<include name="android.jar"/>
|
|
<include name="jme3-desktop*.jar"/>
|
|
<include name="jme3-blender*.jar"/>
|
|
<include name="jme3-bullet*.jar"/>
|
|
<include name="jme3-jbullet*.jar"/>
|
|
<include name="jbullet*.jar"/>
|
|
<include name="*stack-alloc*.jar"/>
|
|
<include name="*vecmath*.jar"/>
|
|
<include name="jme3-ios*.jar"/>
|
|
<include name="*jinput*.jar"/>
|
|
<include name="*lwjgl*.jar"/>
|
|
<include name="*jutils*.jar"/>
|
|
<include name="xpp3*.jar"/>
|
|
</fileset>
|
|
</delete>
|
|
</target>
|
|
|
|
<target name="-add-android-lib">
|
|
<echo>Adding libraries for android.</echo>
|
|
<copy todir="mobile/libs" flatten="true" preservelastmodified="true">
|
|
<path>
|
|
<pathelement path="${libs.jme3-android.classpath}"/>
|
|
<pathelement path="${libs.jme3-android-native.classpath}"/>
|
|
</path>
|
|
</copy>
|
|
<!-- TODO: need to remove android.jar from jme3-android.jar during build instead of doing this -->
|
|
<delete file="mobile/libs/android.jar" failonerror="false"/>
|
|
</target>
|
|
|
|
<target name="-add-bullet-libs" depends="-test-bullet-included" if="bulletIsIncluded">
|
|
<echo>Replacing bullet library with android native bullet version.</echo>
|
|
<copy todir="mobile/libs" flatten="true" preservelastmodified="true">
|
|
<path>
|
|
<pathelement path="${libs.jme3-bullet.classpath}"/>
|
|
<pathelement path="${libs.jme3-bullet-native-android.classpath}"/>
|
|
</path>
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
<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>
|
|
|
|
<target name="-test-bullet-included">
|
|
<condition property="bulletIsIncluded">
|
|
<contains string="${javac.classpath}" substring="bullet"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<target name="-start-android-device">
|
|
<property file="mobile/local.properties"/>
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
<arg value="start-server"/>
|
|
</exec>
|
|
<echo>Waiting for device to be ready.. Connect your device now if its not connected yet.</echo>
|
|
<exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
|
|
<arg value="wait-for-device"/>
|
|
</exec>
|
|
</target>
|
|
|
|
<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>
|
|
<echo>Logging android device output, cancel build or disconnect device to stop logging.</echo>
|
|
<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>
|
|
|
|
<target name="-test-android-enabled">
|
|
<condition property="is.android.enabled">
|
|
<istrue value="${mobile.android.enabled}"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<target name="-flag-no-android">
|
|
<property name="no.android.build" value="true"/>
|
|
</target>
|
|
|