desktop-deployment-targets.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <target name="-desktop-deployment" depends="-extract-native-binaries, -create-launcher-jvmargs, -test-platforms-enabled, -windows-x86-app, -windows-x64-app, -linux-x86-app, -linux-x64-app, -macosx-x64-app"/>
  2. <target name="-windows-x86-app" if="is.windows-x86.app.enabled">
  3. <echo>Windows 32bit Application Creation</echo>
  4. <copy file="resources/desktop-deployment/windows-x86/package.cfg" tofile="resources/desktop-deployment/windows-x86/_package.cfg">
  5. <filterchain>
  6. <replacestring from="$${main.class}" to="${main.class.launcher}"/>
  7. <replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
  8. <replacestring from="$${application.title}" to="${application.title}"/>
  9. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  10. </filterchain>
  11. </copy>
  12. <zip destfile="${dist.dir}/${application.title}-Windows-x86.zip">
  13. <zipfileset file="resources/desktop-deployment/windows-x86/stub.exe" filemode="755" fullpath="${application.title}/${application.title}.exe"/>
  14. <zipfileset file="resources/desktop-deployment/windows-x86/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
  15. <zipfileset file="resources/desktop-deployment/windows-x86/icon.ico" fullpath="${application.title}/${application.title}.ico"/>
  16. <zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
  17. <zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
  18. <zipfileset dir="${build.dir}/natives/windows-x86" prefix="${application.title}/app" erroronmissingdir="false"/>
  19. </zip>
  20. <delete file="resources/desktop-deployment/windows-x86/_package.cfg"/>
  21. <antcall target="-package-windows-x86-jre"/>
  22. </target>
  23. <target name="-package-windows-x86-jre" if="is.bundle.jre.enabled">
  24. <untar src="resources/desktop-deployment/jre-windows-x86.tar.gz" dest="build/jre" compression="gzip"/>
  25. <dirset dir="build/jre" id="dirId-windows-x86">
  26. <include name="jre*"/>
  27. </dirset>
  28. <property name= "dirName-windows-x86" refid= "dirId-windows-x86"/>
  29. <zip destfile="${dist.dir}/${application.title}-Windows-x86.zip" update="true">
  30. <zipfileset dir="build/jre/${dirName-windows-x86}" prefix="${application.title}/runtime/jre"/>
  31. </zip>
  32. <delete dir="build/jre"/>
  33. </target>
  34. <target name="-windows-x64-app" if="is.windows-x64.app.enabled">
  35. <echo>Windows 64bit Application Creation</echo>
  36. <copy file="resources/desktop-deployment/windows-x64/package.cfg" tofile="resources/desktop-deployment/windows-x64/_package.cfg">
  37. <filterchain>
  38. <replacestring from="$${main.class}" to="${main.class.launcher}"/>
  39. <replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
  40. <replacestring from="$${application.title}" to="${application.title}"/>
  41. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  42. </filterchain>
  43. </copy>
  44. <zip destfile="${dist.dir}/${application.title}-Windows-x64.zip">
  45. <zipfileset file="resources/desktop-deployment/windows-x64/stub.exe" filemode="755" fullpath="${application.title}/${application.title}.exe"/>
  46. <zipfileset file="resources/desktop-deployment/windows-x64/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
  47. <zipfileset file="resources/desktop-deployment/windows-x64/icon.ico" fullpath="${application.title}/${application.title}.ico"/>
  48. <zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
  49. <zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
  50. <zipfileset dir="${build.dir}/natives/windows-x64" prefix="${application.title}/app" erroronmissingdir="false"/>
  51. </zip>
  52. <delete file="resources/desktop-deployment/windows-x64/_package.cfg"/>
  53. <antcall target="-package-windows-x64-jre"/>
  54. </target>
  55. <target name="-package-windows-x64-jre" if="is.bundle.jre.enabled">
  56. <untar src="resources/desktop-deployment/jre-windows-x64.tar.gz" dest="build/jre" compression="gzip"/>
  57. <dirset dir="build/jre" id="dirId-windows-x64">
  58. <include name="jre*"/>
  59. </dirset>
  60. <property name= "dirName-windows-x64" refid= "dirId-windows-x64"/>
  61. <zip destfile="${dist.dir}/${application.title}-Windows-x64.zip" update="true">
  62. <zipfileset dir="build/jre/${dirName-windows-x64}" prefix="${application.title}/runtime/jre"/>
  63. </zip>
  64. <delete dir="build/jre"/>
  65. </target>
  66. <target name="-linux-x86-app" if="is.linux-x86.app.enabled">
  67. <echo>Linux 32bit Application Creation</echo>
  68. <copy file="resources/desktop-deployment/linux-x86/package.cfg" tofile="resources/desktop-deployment/linux-x86/_package.cfg">
  69. <filterchain>
  70. <replacestring from="$${main.class}" to="${main.class.launcher}"/>
  71. <replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
  72. <replacestring from="$${application.title}" to="${application.title}"/>
  73. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  74. </filterchain>
  75. </copy>
  76. <zip destfile="${dist.dir}/${application.title}-Linux-x86.zip">
  77. <zipfileset file="resources/desktop-deployment/linux-x86/stub" filemode="755" fullpath="${application.title}/${application.title}"/>
  78. <zipfileset file="resources/desktop-deployment/linux-x86/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
  79. <zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
  80. <zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
  81. <zipfileset dir="${build.dir}/natives/linux-x86" prefix="${application.title}/app" erroronmissingdir="false"/>
  82. </zip>
  83. <delete file="resources/desktop-deployment/linux-x86/_package.cfg"/>
  84. <antcall target="-package-linux-x86-jre"/>
  85. </target>
  86. <target name="-package-linux-x86-jre" if="is.bundle.jre.enabled">
  87. <untar src="resources/desktop-deployment/jre-linux-x86.tar.gz" dest="build/jre" compression="gzip"/>
  88. <dirset dir="build/jre" id="dirId-linux-x86">
  89. <include name="jre*"/>
  90. </dirset>
  91. <property name= "dirName-linux-x86" refid= "dirId-linux-x86"/>
  92. <zip destfile="${dist.dir}/${application.title}-Linux-x86.zip" update="true">
  93. <zipfileset dir="build/jre/${dirName-linux-x86}" excludes ="bin/*" prefix="${application.title}/runtime/jre"/>
  94. <zipfileset dir="build/jre/${dirName-linux-x86}" includes ="bin/*" filemode="755" prefix="${application.title}/runtime/jre"/>
  95. </zip>
  96. <delete dir="build/jre"/>
  97. </target>
  98. <target name="-linux-x64-app" if="is.linux-x64.app.enabled">
  99. <echo>Linux 64bit Application Creation</echo>
  100. <copy file="resources/desktop-deployment/linux-x64/package.cfg" tofile="resources/desktop-deployment/linux-x64/_package.cfg">
  101. <filterchain>
  102. <replacestring from="$${main.class}" to="${main.class.launcher}"/>
  103. <replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
  104. <replacestring from="$${application.title}" to="${application.title}"/>
  105. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  106. </filterchain>
  107. </copy>
  108. <zip destfile="${dist.dir}/${application.title}-Linux-x64.zip">
  109. <zipfileset file="resources/desktop-deployment/linux-x64/stub" filemode="755" fullpath="${application.title}/${application.title}"/>
  110. <zipfileset file="resources/desktop-deployment/linux-x64/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
  111. <zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
  112. <zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
  113. <zipfileset dir="${build.dir}/natives/linux-x64" prefix="${application.title}/app" erroronmissingdir="false"/>
  114. </zip>
  115. <delete file="resources/desktop-deployment/linux-x64/_package.cfg"/>
  116. <antcall target="-package-linux-x64-jre"/>
  117. </target>
  118. <target name="-package-linux-x64-jre" if="is.bundle.jre.enabled">
  119. <untar src="resources/desktop-deployment/jre-linux-x64.tar.gz" dest="build/jre" compression="gzip"/>
  120. <dirset dir="build/jre" id="dirId-linux-x64">
  121. <include name="jre*"/>
  122. </dirset>
  123. <property name= "dirName-linux-x64" refid= "dirId-linux-x64"/>
  124. <zip destfile="${dist.dir}/${application.title}-Linux-x64.zip" update="true">
  125. <zipfileset dir="build/jre/${dirName-linux-x64}" excludes ="bin/*" prefix="${application.title}/runtime/jre"/>
  126. <zipfileset dir="build/jre/${dirName-linux-x64}" includes ="bin/*" filemode="755" prefix="${application.title}/runtime/jre"/>
  127. </zip>
  128. <delete dir="build/jre"/>
  129. </target>
  130. <target name="-macosx-x64-app" if="is.macosx-x64.app.enabled">
  131. <echo>MacOSX Application Creation</echo>
  132. <loadresource property="jfxdeploy.jvmargs">
  133. <propertyresource name="run.jvmargs"/>
  134. <filterchain>
  135. <tokenfilter>
  136. <filetokenizer/>
  137. <replacestring from=" " to="&lt;/string&gt;&lt;string&gt;"/>
  138. </tokenfilter>
  139. </filterchain>
  140. </loadresource>
  141. <antcall target="-update-macosx-x64-plist-with-runtime"/>
  142. <antcall target="-update-macosx-x64-plist-without-runtime"/>
  143. <zip destfile="${dist.dir}/${application.title}-MacOSX.zip">
  144. <zipfileset file="resources/desktop-deployment/macosx-x64/stub" filemode="755" fullpath="${application.title}.app/Contents/MacOS/JavaAppLauncher"/>
  145. <zipfileset file="resources/desktop-deployment/macosx-x64/_Info.plist" fullpath="${application.title}.app/Contents/Info.plist"/>
  146. <zipfileset file="resources/desktop-deployment/macosx-x64/icon.icns" fullpath="${application.title}.app/Contents/Resources/GenericApp.icns"/>
  147. <zipfileset file="${dist.jar}" prefix="${application.title}.app/Contents/Java"/>
  148. <zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}.app/Contents/Java/lib"/>
  149. <zipfileset dir="${build.dir}/natives/macosx-x64" prefix="${application.title}.app/Contents/Java" erroronmissingdir="false"/>
  150. </zip>
  151. <delete file="resources/desktop-deployment/macosx-x64/_Info.plist"/>
  152. <antcall target="-package-macosx-x64-jre"/>
  153. </target>
  154. <target name="-update-macosx-x64-plist-with-runtime" if="is.bundle.jre.enabled">
  155. <!--key>JVMRuntime</key>
  156. <string>jdk1.8.0_31.jdk</string-->
  157. <copy file="resources/desktop-deployment/macosx-x64/Info.plist" tofile="resources/desktop-deployment/macosx-x64/_Info.plist">
  158. <filterchain>
  159. <replacestring from="$${main.class}" to="${main.class}"/>
  160. <replacestring from="$${run.jvmargs}" to="${jfxdeploy.jvmargs}"/>
  161. <replacestring from="$${application.title}" to="${application.title}"/>
  162. <replacestring from="$${jfxdeploy.jvmargs}" to="-Xnoagent"/>
  163. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  164. <replacestring from="&lt;!--jvmruntime--&gt;" to="&lt;key&gt;JVMRuntime&lt;/key&gt;&#13; &lt;string&gt;jre.jre&lt;/string&gt;"/>
  165. </filterchain>
  166. </copy>
  167. </target>
  168. <target name="-update-macosx-x64-plist-without-runtime" unless="is.bundle.jre.enabled">
  169. <copy file="resources/desktop-deployment/macosx-x64/Info.plist" tofile="resources/desktop-deployment/macosx-x64/_Info.plist">
  170. <filterchain>
  171. <replacestring from="$${main.class}" to="${main.class}"/>
  172. <replacestring from="$${run.jvmargs}" to="${jfxdeploy.jvmargs}"/>
  173. <replacestring from="$${application.title}" to="${application.title}"/>
  174. <replacestring from="$${jfxdeploy.jvmargs}" to="-Xnoagent"/>
  175. <replacestring from="$${jar.name}" to="${application.title}.jar"/>
  176. </filterchain>
  177. </copy>
  178. </target>
  179. <target name="-package-macosx-x64-jre" if="is.bundle.jre.enabled">
  180. <untar src="resources/desktop-deployment/jre-macosx-x64.tar.gz" dest="build/jre" compression="gzip"/>
  181. <dirset dir="build/jre" id="dirId-macosx-x64">
  182. <include name="jre*"/>
  183. </dirset>
  184. <property name= "dirName-macosx-x64" refid= "dirId-macosx-x64"/>
  185. <zip destfile="${dist.dir}/${application.title}-MacOSX.zip" update="true">
  186. <zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/Home" excludes ="bin/*" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Home/jre"/>
  187. <zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/Home" includes ="bin/*" filemode="755" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Home/jre"/>
  188. <zipfileset file="build/jre/${dirName-macosx-x64}/Contents/Info.plist" fullpath="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Info.plist"/>
  189. <zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/MacOS" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/MacOS"/>
  190. </zip>
  191. <delete dir="build/jre"/>
  192. </target>
  193. <target name="-test-platforms-enabled">
  194. <condition property="is.windows-x86.app.enabled">
  195. <istrue value="${windows-x86.app.enabled}"/>
  196. </condition>
  197. <condition property="is.windows-x64.app.enabled">
  198. <istrue value="${windows-x64.app.enabled}"/>
  199. </condition>
  200. <condition property="is.linux-x86.app.enabled">
  201. <istrue value="${linux-x86.app.enabled}"/>
  202. </condition>
  203. <condition property="is.linux-x64.app.enabled">
  204. <istrue value="${linux-x64.app.enabled}"/>
  205. </condition>
  206. <condition property="is.macosx-x64.app.enabled">
  207. <istrue value="${macosx-x64.app.enabled}"/>
  208. </condition>
  209. <condition property="is.bundle.jre.enabled">
  210. <istrue value="${bundle.jre.enabled}"/>
  211. </condition>
  212. </target>
  213. <target name="-create-launcher-jvmargs">
  214. <script language="javascript">
  215. <![CDATA[
  216. var args = project.getProperty("run.jvmargs");
  217. var res = args.split(" ");
  218. var out = "";
  219. for (var i = 1; i < res.length+1; i++) {
  220. out = out + "jvmarg." + i + "=" + res[i-1] + "\r\n";
  221. }
  222. project.setProperty("launcher.jvmargs", out);
  223. ]]>
  224. </script>
  225. <loadresource property="main.class.launcher">
  226. <propertyresource name="main.class"/>
  227. <filterchain>
  228. <tokenfilter>
  229. <filetokenizer/>
  230. <replacestring from="." to="/"/>
  231. </tokenfilter>
  232. </filterchain>
  233. </loadresource>
  234. </target>
  235. <target name="-extract-native-binaries">
  236. <java outputproperty="deployment.jarexcludes" dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  237. <arg value="getjarexcludes"/>
  238. </java>
  239. <java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  240. <arg value="Windows32"/>
  241. <arg value="${build.dir}/natives/windows-x86"/>
  242. </java>
  243. <java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  244. <arg value="Windows64"/>
  245. <arg value="${build.dir}/natives/windows-x64"/>
  246. </java>
  247. <java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  248. <arg value="Linux32"/>
  249. <arg value="${build.dir}/natives/linux-x86"/>
  250. </java>
  251. <java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  252. <arg value="Linux64"/>
  253. <arg value="${build.dir}/natives/linux-x64"/>
  254. </java>
  255. <java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
  256. <arg value="MacOSX64"/>
  257. <arg value="${build.dir}/natives/macosx-x64"/>
  258. </java>
  259. </target>