mobile-impl.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--mobile-impl.xml v0.18-->
  3. <project name="mobile-impl" basedir="..">
  4. <condition property="android-adb-name" value="${file.separator}platform-tools${file.separator}adb.exe" else="${file.separator}platform-tools${file.separator}adb">
  5. <os family="windows" />
  6. </condition>
  7. <target name="run-android" depends="-flag-no-android, jar, -test-android-enabled, -copy-android-libs" if="is.android.enabled">
  8. <echo>Building debug android application version.</echo>
  9. <ant dir="mobile" target="debug" inheritall="false"/>
  10. <antcall target="-start-android-device"/>
  11. <ant dir="mobile" target="installd" inheritall="false"/>
  12. <antcall target="-run-android-device"/>
  13. </target>
  14. <target name="clean-android">
  15. <ant dir="mobile" target="clean" inheritall="false"/>
  16. </target>
  17. <target name="-mobile-deployment" depends="-test-android-enabled, -copy-android-libs" if="is.android.enabled" unless="no.android.build">
  18. <ant dir="mobile" target="release" inheritall="false"/>
  19. <copy todir="dist" verbose="false" flatten="true">
  20. <fileset dir="mobile/bin/">
  21. <include name="**/*.apk"/>
  22. </fileset>
  23. </copy>
  24. </target>
  25. <target name="-copy-android-libs" if="is.android.enabled">
  26. <echo>Copying application libraries to android project.</echo>
  27. <delete dir="mobile/libs" failonerror="false"/>
  28. <mkdir dir="mobile/libs"/>
  29. <copy todir="mobile/libs" verbose="false" flatten="true">
  30. <fileset dir="dist/lib/">
  31. <exclude name="${assets.jar.name}"/>
  32. <exclude name="jME3-desktop.jar"/>
  33. <exclude name="jME3-blender.jar"/>
  34. <exclude name="jME3-lwjgl.jar"/>
  35. <exclude name="jME3-lwjgl-natives.jar"/>
  36. <exclude name="jME3-bullet-natives.jar"/>
  37. <exclude name="jME3-jbullet.jar"/>
  38. <exclude name="jME3-bullet.jar"/>
  39. <exclude name="jbullet.jar"/>
  40. <exclude name="stack-alloc.jar"/>
  41. <exclude name="vecmath.jar"/>
  42. <exclude name="lwjgl.jar"/>
  43. <exclude name="jinput.jar"/>
  44. </fileset>
  45. </copy>
  46. <antcall target="-add-android-lib"/>
  47. <antcall target="-unzip-bullet-libs"/>
  48. <antcall target="-unzip-assets"/>
  49. <copy file="${dist.jar}" todir="mobile/libs/" verbose="false"/>
  50. </target>
  51. <target name="-add-android-lib">
  52. <echo>Adding libraries for android.</echo>
  53. <copy todir="mobile/libs" flatten="true">
  54. <path>
  55. <pathelement path="${libs.android-base.classpath}"/>
  56. </path>
  57. </copy>
  58. </target>
  59. <target name="-unzip-bullet-libs" depends="-delete-bullet-libs" if="bulletIsIncluded">
  60. <echo>Replacing bullet library with android native version.</echo>
  61. <unzip src="mobile/libs/jME3-bullet-natives-android.jar" dest="mobile/libs"/>
  62. <delete file="mobile/libs/jME3-bullet-natives-android.jar"/>
  63. <delete dir="mobile/libs/x86"/>
  64. </target>
  65. <target name="-delete-bullet-libs" depends="-test-bullet-included" unless="bulletIsIncluded">
  66. <delete file="mobile/libs/jME3-bullet.jar"/>
  67. <delete file="mobile/libs/jME3-bullet-natives-android.jar"/>
  68. </target>
  69. <target name="-unzip-assets">
  70. <echo>Unzipping Assets to Android Directories</echo>
  71. <delete dir="mobile/assets" failonerror="false"/>
  72. <mkdir dir="mobile/assets"/>
  73. <unzip src="dist/lib/${assets.jar.name}" dest="mobile/assets"/>
  74. <delete file="mobile/libs/${assets.jar.name}" failonerror="true"/>
  75. </target>
  76. <target name="-test-bullet-included">
  77. <condition property="bulletIsIncluded">
  78. <contains string="${javac.classpath}" substring="bullet.jar"/>
  79. </condition>
  80. </target>
  81. <target name="-start-android-device">
  82. <property file="mobile/local.properties"/>
  83. <exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
  84. <arg value="start-server"/>
  85. </exec>
  86. <echo>Waiting for device to be ready.. Connect your device now if its not connected yet.</echo>
  87. <exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
  88. <arg value="wait-for-device"/>
  89. </exec>
  90. </target>
  91. <target name="-run-android-device">
  92. <property file="mobile/local.properties"/>
  93. <exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
  94. <arg value="logcat"/>
  95. <arg value="-c"/>
  96. </exec>
  97. <exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
  98. <arg value="shell"/>
  99. <arg value="am start -n ${mobile.android.package}/.MainActivity"/>
  100. </exec>
  101. <echo>Logging android device output, cancel build or disconnect device to stop logging.</echo>
  102. <exec executable="${sdk.dir}${android-adb-name}" failonerror="true">
  103. <arg value="logcat"/>
  104. <arg value="AndroidRuntime:E"/>
  105. <arg value="System.out:I"/>
  106. <arg value="System.err:W"/>
  107. <arg value="NSLog:*"/>
  108. </exec>
  109. </target>
  110. <target name="-test-android-enabled">
  111. <condition property="is.android.enabled">
  112. <istrue value="${mobile.android.enabled}"/>
  113. </condition>
  114. </target>
  115. <target name="-flag-no-android">
  116. <property name="no.android.build" value="true"/>
  117. </target>
  118. </project>