a simple Java-FX Application which Simulate the Approximation of Pi https://nextn.xyz
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.

4050 lines
218 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. *** GENERATED FROM TEMPLATE - DO NOT EDIT ***
  4. *** EDIT ../build.xml INSTEAD ***
  5. -->
  6. <project name="jfx-impl" default="jfx-deployment" basedir=".." xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"
  7. xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:fx="javafx:com.sun.javafx.tools.ant">
  8. <description>JavaFX-specific Ant calls</description>
  9. <!-- Empty placeholders for easier customization in ../build.xml -->
  10. <target name="-pre-jfx-jar">
  11. <!-- Called right before <fx:jar> task. You can override this target in the ../build.xml file. -->
  12. </target>
  13. <target name="-post-jfx-jar">
  14. <!-- Called right after <fx:jar> task. You can override this target in the ../build.xml file. -->
  15. </target>
  16. <target name="-pre-jfx-deploy">
  17. <!-- Called right before <fx:deploy> task. You can override this target in the ../build.xml file. -->
  18. </target>
  19. <target name="-post-jfx-deploy">
  20. <!-- Called right after <fx:deploy> task. You can override this target in the ../build.xml file. -->
  21. </target>
  22. <target name="-pre-jfx-native">
  23. <!-- Called right before the call to native packager (just after -pre-jfx-deploy). You can override this target in the ../build.xml file. -->
  24. </target>
  25. <target name="-post-jfx-native">
  26. <!-- Called right after the call to native packager (just after -post-jfx-deploy). You can override this target in the ../build.xml file. -->
  27. </target>
  28. <!-- Check system and JDK version -->
  29. <target name="-check-operating-system">
  30. <condition property="running.on.mac">
  31. <os family="mac"/>
  32. </condition>
  33. <condition property="running.on.unix">
  34. <os family="unix"/>
  35. </condition>
  36. <condition property="running.on.windows">
  37. <os family="windows"/>
  38. </condition>
  39. <echo message="running.on.mac = ${running.on.mac}" level="verbose"/>
  40. <echo message="running.on.unix = ${running.on.unix}" level="verbose"/>
  41. <echo message="running.on.windows = ${running.on.windows}" level="verbose"/>
  42. </target>
  43. <target name="-check-platform-home-fxsdk-java" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  44. <condition property="do.set.platform.home.fxsdk.java">
  45. <and>
  46. <not><isset property="active.platform.home.java.executable"/></not>
  47. <or>
  48. <available file="${javafx.sdk}${file.separator}bin${file.separator}java"/>
  49. <available file="${javafx.sdk}${file.separator}bin${file.separator}java.exe"/>
  50. </or>
  51. </and>
  52. </condition>
  53. </target>
  54. <target name="-set-platform-home-fxsdk-java" depends="-check-platform-home-fxsdk-java" if="do.set.platform.home.fxsdk.java">
  55. <property name="active.platform.home.java.executable" value="${javafx.sdk}${file.separator}bin${file.separator}java"/>
  56. </target>
  57. <target name="-check-platform-home-java" if="platform.home">
  58. <condition property="do.set.platform.home.java">
  59. <and>
  60. <not><isset property="active.platform.home.java.executable"/></not>
  61. <or>
  62. <available file="${platform.home}${file.separator}bin${file.separator}java"/>
  63. <available file="${platform.home}${file.separator}bin${file.separator}java.exe"/>
  64. </or>
  65. </and>
  66. </condition>
  67. </target>
  68. <target name="-set-platform-home-java" depends="-set-platform-home-fxsdk-java,-check-platform-home-java" if="do.set.platform.home.java">
  69. <property name="active.platform.home.java.executable" value="${platform.home}${file.separator}bin${file.separator}java"/>
  70. </target>
  71. <target name="-check-platform-home-probjdk-java" unless="active.platform.home.java.executable">
  72. <condition property="do.set.platform.home.probjdk.java">
  73. <and>
  74. <not><isset property="active.platform.home.java.executable"/></not>
  75. <or>
  76. <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}java"/>
  77. <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}java.exe"/>
  78. </or>
  79. </and>
  80. </condition>
  81. </target>
  82. <target name="-set-platform-home-probjdk-java" depends="-set-platform-home-java,-check-platform-home-probjdk-java" if="do.set.platform.home.probjdk.java">
  83. <property name="active.platform.home.java.executable" value="${java.home}${file.separator}..${file.separator}bin${file.separator}java"/>
  84. </target>
  85. <target name="-check-platform-home-envjdk-java" unless="active.platform.home.java.executable">
  86. <property environment="env"/>
  87. <condition property="do.set.platform.home.envjdk.java">
  88. <and>
  89. <not><isset property="active.platform.home.java.executable"/></not>
  90. <or>
  91. <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}java"/>
  92. <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}java.exe"/>
  93. </or>
  94. </and>
  95. </condition>
  96. </target>
  97. <target name="-set-platform-home-envjdk-java" depends="-set-platform-home-probjdk-java,-check-platform-home-envjdk-java" if="do.set.platform.home.envjdk.java">
  98. <property environment="env"/>
  99. <property name="active.platform.home.java.executable" value="${env.JAVA_HOME}${file.separator}bin${file.separator}java"/>
  100. </target>
  101. <target name="-check-platform-home-fxrt-java" depends="-check-property-javafx.runtime" if="javafx.runtime.defined">
  102. <condition property="do.set.platform.home.fxrt.java">
  103. <and>
  104. <not><isset property="active.platform.home.java.executable"/></not>
  105. <or>
  106. <available file="${javafx.runtime}${file.separator}bin${file.separator}java"/>
  107. <available file="${javafx.runtime}${file.separator}bin${file.separator}java.exe"/>
  108. </or>
  109. </and>
  110. </condition>
  111. </target>
  112. <target name="-set-platform-home-fxrt-java" depends="-set-platform-home-envjdk-java,-check-platform-home-fxrt-java" if="do.set.platform.home.fxrt.java">
  113. <property name="active.platform.home.java.executable" value="${javafx.runtime}${file.separator}bin${file.separator}java"/>
  114. <echo message="Warning: java executable not found in JDK, evaluating java executable in RT instead." level="info"/>
  115. </target>
  116. <target name="-check-platform-home-jre-java" unless="active.platform.home.java.executable">
  117. <condition property="do.set.platform.home.jre.java">
  118. <and>
  119. <not><isset property="active.platform.home.java.executable"/></not>
  120. <or>
  121. <available file="${java.home}${file.separator}bin${file.separator}java"/>
  122. <available file="${java.home}${file.separator}bin${file.separator}java.exe"/>
  123. </or>
  124. </and>
  125. </condition>
  126. </target>
  127. <target name="-set-platform-home-jre-java" depends="-set-platform-home-fxrt-java,-check-platform-home-jre-java" if="do.set.platform.home.jre.java">
  128. <property name="active.platform.home.java.executable" value="${java.home}${file.separator}bin${file.separator}java"/>
  129. <echo message="Warning: java executable not found in JDK, evaluating java executable in RT instead." level="info"/>
  130. </target>
  131. <target name="-check-platform-home" depends="-set-platform-home-jre-java">
  132. <echo message="active.platform.home.java.executable = ${active.platform.home.java.executable}" level="verbose"/>
  133. <fail message="Error:${line.separator}java executable not found !" unless="active.platform.home.java.executable"/>
  134. </target>
  135. <target name="-check-jdk-version" depends="-do-init,-check-platform-home" unless="jdk-version-checked-in-jfximpl">
  136. <local name="version-output"/>
  137. <exec executable="${active.platform.home.java.executable}" outputproperty="version-output">
  138. <arg value="-version"/>
  139. </exec>
  140. <echo message="version-output:${line.separator}${version-output}" level="verbose"/>
  141. <condition property="have-jdk-older-than-1.6">
  142. <or>
  143. <contains string="${version-output}" substring="java version &quot;1.0"/>
  144. <contains string="${version-output}" substring="java version &quot;1.1"/>
  145. <contains string="${version-output}" substring="java version &quot;1.2"/>
  146. <contains string="${version-output}" substring="java version &quot;1.3"/>
  147. <contains string="${version-output}" substring="java version &quot;1.4"/>
  148. <contains string="${version-output}" substring="java version &quot;1.5"/>
  149. </or>
  150. </condition>
  151. <fail message="Error:${line.separator}JavaFX 2.0+ projects require JDK version 1.6+ !" if="have-jdk-older-than-1.6"/>
  152. <condition property="have-jdk-7u4or5-mac">
  153. <and>
  154. <or>
  155. <contains string="${version-output}" substring="java version &quot;1.7.0_04"/>
  156. <contains string="${version-output}" substring="java version &quot;1.7.0_05"/>
  157. </or>
  158. <os family="mac"/>
  159. </and>
  160. </condition>
  161. <condition property="have-jdk-pre7u6">
  162. <or>
  163. <isset property="have-jdk-older-than-1.6"/>
  164. <contains string="${version-output}" substring="java version &quot;1.6"/>
  165. <contains string="${version-output}" substring="java version &quot;1.7.0&quot;"/>
  166. <contains string="${version-output}" substring="java version &quot;1.7.0_01"/>
  167. <contains string="${version-output}" substring="java version &quot;1.7.0_02"/>
  168. <contains string="${version-output}" substring="java version &quot;1.7.0_03"/>
  169. <contains string="${version-output}" substring="java version &quot;1.7.0_04"/>
  170. <contains string="${version-output}" substring="java version &quot;1.7.0_05"/>
  171. </or>
  172. </condition>
  173. <condition property="have-jdk-pre7u14">
  174. <or>
  175. <isset property="have-jdk-pre7u6"/>
  176. <contains string="${version-output}" substring="java version &quot;1.7.0_06"/>
  177. <contains string="${version-output}" substring="java version &quot;1.7.0_07"/>
  178. <contains string="${version-output}" substring="java version &quot;1.7.0_08"/>
  179. <contains string="${version-output}" substring="java version &quot;1.7.0_09"/>
  180. <contains string="${version-output}" substring="java version &quot;1.7.0_10"/>
  181. <contains string="${version-output}" substring="java version &quot;1.7.0_11"/>
  182. <contains string="${version-output}" substring="java version &quot;1.7.0_12"/>
  183. <contains string="${version-output}" substring="java version &quot;1.7.0_13"/>
  184. </or>
  185. </condition>
  186. <property name="jdk-version-checked-in-jfximpl" value="true"/>
  187. <echo message="have-jdk-7u4or5-mac = ${have-jdk-7u4or5-mac}" level="verbose"/>
  188. <echo message="have-jdk-pre7u6 = ${have-jdk-pre7u6}" level="verbose"/>
  189. <echo message="have-jdk-pre7u14 = ${have-jdk-pre7u14}" level="verbose"/>
  190. </target>
  191. <target name="-check-ant-jre-version" unless="ant-jre-version-checked-in-jfximpl">
  192. <local name="version-output"/>
  193. <exec executable="${java.home}${file.separator}bin${file.separator}java" outputproperty="version-output">
  194. <arg value="-version"/>
  195. </exec>
  196. <echo message="version-output:${line.separator}${version-output}" level="verbose"/>
  197. <condition property="have-ant-jre-pre7u6">
  198. <or>
  199. <contains string="${version-output}" substring="java version &quot;1.0"/>
  200. <contains string="${version-output}" substring="java version &quot;1.1"/>
  201. <contains string="${version-output}" substring="java version &quot;1.2"/>
  202. <contains string="${version-output}" substring="java version &quot;1.3"/>
  203. <contains string="${version-output}" substring="java version &quot;1.4"/>
  204. <contains string="${version-output}" substring="java version &quot;1.5"/>
  205. <contains string="${version-output}" substring="java version &quot;1.6"/>
  206. <contains string="${version-output}" substring="java version &quot;1.7.0&quot;"/>
  207. <contains string="${version-output}" substring="java version &quot;1.7.0_01"/>
  208. <contains string="${version-output}" substring="java version &quot;1.7.0_02"/>
  209. <contains string="${version-output}" substring="java version &quot;1.7.0_03"/>
  210. <contains string="${version-output}" substring="java version &quot;1.7.0_04"/>
  211. <contains string="${version-output}" substring="java version &quot;1.7.0_05"/>
  212. </or>
  213. </condition>
  214. <condition property="have-jdk7-css2bin-bug">
  215. <!-- as of NB7.4 release date the external css-to-bss converter is unreliable in all JDK7 versions before 7u40 (with exception of 7u14)-->
  216. <and>
  217. <contains string="${version-output}" substring="java version &quot;1.7"/>
  218. <not><matches string="${version-output}" pattern="\bjava version &quot;1\.7\.0_(14|[4-9].)"/></not>
  219. </and>
  220. </condition>
  221. <property name="ant-jre-version-checked-in-jfximpl" value="true"/>
  222. <echo message="have-ant-jre-pre7u6 = ${have-ant-jre-pre7u6}" level="verbose"/>
  223. <echo message="have-jdk7-css2bin-bug = ${have-jdk7-css2bin-bug}" level="verbose"/>
  224. </target>
  225. <target name="-check-jdk-7u4or5-mac" depends="-check-jdk-version" if="have-jdk-7u4or5-mac">
  226. <fail message="Error:${line.separator}JDK 7u4 Mac and 7u5 Mac do not support WebStart and JavaFX 2.0+ browser plugin technologies.${line.separator}Please upgrade to JDK 7u6 or later."/>
  227. </target>
  228. <!-- Check availability of JavaFX SDK deployment support (ant-javafx.jar) -->
  229. <target name="-check-endorsed-javafx-ant-classpath">
  230. <condition property="endorsed-javafx-ant-classpath-available">
  231. <and>
  232. <isset property="endorsed.javafx.ant.classpath"/>
  233. <not>
  234. <equals arg1="${endorsed.javafx.ant.classpath}" arg2=""/>
  235. </not>
  236. </and>
  237. </condition>
  238. <echo message="endorsed-javafx-ant-classpath-available = ${endorsed-javafx-ant-classpath-available}" level="verbose"/>
  239. </target>
  240. <target name="-check-property-javafx.sdk">
  241. <echo message="javafx.sdk = ${javafx.sdk}" level="verbose"/>
  242. <condition property="javafx.sdk.defined">
  243. <and>
  244. <isset property="javafx.sdk"/>
  245. <not><contains string="${javafx.sdk}" substring="$${platform" casesensitive="false"/></not>
  246. </and>
  247. </condition>
  248. <condition property="javafx.sdk.missing+default">
  249. <and>
  250. <equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/>
  251. <not><isset property="javafx.sdk.defined"/></not>
  252. </and>
  253. </condition>
  254. <condition property="javafx.sdk.missing-default">
  255. <and>
  256. <not><equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/></not>
  257. <not><isset property="javafx.sdk.defined"/></not>
  258. </and>
  259. </condition>
  260. <echo message="javafx.sdk.defined = ${javafx.sdk.defined}" level="verbose"/>
  261. <echo message="javafx.sdk.missing+default = ${javafx.sdk.missing+default}" level="verbose"/>
  262. <echo message="javafx.sdk.missing-default = ${javafx.sdk.missing-default}" level="verbose"/>
  263. </target>
  264. <target name="-check-ant-javafx-in-fxsdk-lib" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  265. <condition property="do.set.ant-javafx.in.fxsdk.lib">
  266. <and>
  267. <not><isset property="ant-javafx.jar.location"/></not>
  268. <available file="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
  269. </and>
  270. </condition>
  271. </target>
  272. <target name="-set-ant-javafx-in-fxsdk-lib" depends="-check-ant-javafx-in-fxsdk-lib" if="do.set.ant-javafx.in.fxsdk.lib">
  273. <property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
  274. </target>
  275. <target name="-check-ant-javafx-in-fxsdk-tools" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  276. <condition property="do.set.ant-javafx.in.fxsdk.tools">
  277. <and>
  278. <not><isset property="ant-javafx.jar.location"/></not>
  279. <available file="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
  280. </and>
  281. </condition>
  282. </target>
  283. <target name="-set-ant-javafx-in-fxsdk-tools" depends="-set-ant-javafx-in-fxsdk-lib,-check-ant-javafx-in-fxsdk-tools" if="do.set.ant-javafx.in.fxsdk.tools">
  284. <property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
  285. </target>
  286. <target name="-check-ant-javafx-in-platform-home-lib" if="platform.home">
  287. <condition property="do.set.ant-javafx.in.platform.home.lib">
  288. <and>
  289. <not><isset property="ant-javafx.jar.location"/></not>
  290. <available file="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
  291. </and>
  292. </condition>
  293. </target>
  294. <target name="-set-ant-javafx-in-platform-home-lib" depends="-set-ant-javafx-in-fxsdk-tools,-check-ant-javafx-in-platform-home-lib" if="do.set.ant-javafx.in.platform.home.lib">
  295. <property name="ant-javafx.jar.location" value="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
  296. </target>
  297. <target name="-check-ant-javafx-in-platform-home-tools" if="platform.home">
  298. <condition property="do.set.ant-javafx.in.platform.home.tools">
  299. <and>
  300. <not><isset property="ant-javafx.jar.location"/></not>
  301. <available file="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
  302. </and>
  303. </condition>
  304. </target>
  305. <target name="-set-ant-javafx-in-platform-home-tools" depends="-set-ant-javafx-in-platform-home-lib,-check-ant-javafx-in-platform-home-tools" if="do.set.ant-javafx.in.platform.home.tools">
  306. <property name="ant-javafx.jar.location" value="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
  307. </target>
  308. <target name="-check-ant-javafx-in-probjdk-lib" unless="ant-javafx.jar.location">
  309. <condition property="do.set.ant-javafx.in.probjdk.lib.has_jre">
  310. <available file="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
  311. </condition>
  312. <condition property="do.set.ant-javafx.in.probjdk.lib.no_jre">
  313. <available file="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
  314. </condition>
  315. <condition property="do.set.ant-javafx.in.probjdk.lib">
  316. <and>
  317. <not><isset property="ant-javafx.jar.location"/></not>
  318. <or>
  319. <isset property="do.set.ant-javafx.in.probjdk.lib.has_jre"/>
  320. <isset property="do.set.ant-javafx.in.probjdk.lib.no_jre"/>
  321. </or>
  322. </and>
  323. </condition>
  324. </target>
  325. <target name="-set-ant-javafx-in-probjdk-lib" depends="-set-ant-javafx-in-platform-home-tools,-check-ant-javafx-in-probjdk-lib" if="do.set.ant-javafx.in.probjdk.lib">
  326. <condition property="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar" else="${java.home}${file.separator}lib${file.separator}ant-javafx.jar">
  327. <isset property="do.set.ant-javafx.in.probjdk.lib.has_jre"/>
  328. </condition>
  329. </target>
  330. <target name="-check-ant-javafx-in-probjdk-tools" unless="ant-javafx.jar.location">
  331. <condition property="do.set.ant-javafx.in.probjdk.tools.has_jre">
  332. <available file="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
  333. </condition>
  334. <condition property="do.set.ant-javafx.in.probjdk.tools.no_jre">
  335. <available file="${java.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
  336. </condition>
  337. <condition property="do.set.ant-javafx.in.probjdk.tools">
  338. <and>
  339. <not><isset property="ant-javafx.jar.location"/></not>
  340. <or>
  341. <isset property="do.set.ant-javafx.in.probjdk.tools.has_jre"/>
  342. <isset property="do.set.ant-javafx.in.probjdk.tools.no_jre"/>
  343. </or>
  344. </and>
  345. </condition>
  346. </target>
  347. <target name="-set-ant-javafx-in-probjdk-tools" depends="-set-ant-javafx-in-probjdk-lib,-check-ant-javafx-in-probjdk-tools" if="do.set.ant-javafx.in.probjdk.tools">
  348. <condition property="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar" else="${java.home}${file.separator}tools${file.separator}ant-javafx.jar">
  349. <isset property="do.set.ant-javafx.in.probjdk.tools.has_jre"/>
  350. </condition>
  351. </target>
  352. <target name="-check-ant-javafx-in-macjdk-lib" unless="ant-javafx.jar.location">
  353. <condition property="do.set.ant-javafx.in.macjdk.lib">
  354. <and>
  355. <not><isset property="ant-javafx.jar.location"/></not>
  356. <available file="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
  357. </and>
  358. </condition>
  359. </target>
  360. <target name="-set-ant-javafx-in-macjdk-lib" depends="-set-ant-javafx-in-probjdk-tools,-check-ant-javafx-in-macjdk-lib" if="do.set.ant-javafx.in.macjdk.lib">
  361. <property name="ant-javafx.jar.location" value="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
  362. </target>
  363. <target name="-check-ant-javafx-in-envjdk-lib" unless="ant-javafx.jar.location">
  364. <property environment="env"/>
  365. <condition property="do.set.ant-javafx.in.envjdk.lib">
  366. <and>
  367. <not><isset property="ant-javafx.jar.location"/></not>
  368. <available file="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
  369. </and>
  370. </condition>
  371. </target>
  372. <target name="-set-ant-javafx-in-envjdk-lib" depends="-set-ant-javafx-in-macjdk-lib,-check-ant-javafx-in-envjdk-lib" if="do.set.ant-javafx.in.envjdk.lib">
  373. <property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
  374. </target>
  375. <target name="-check-ant-javafx-in-envjdk-tools" unless="ant-javafx.jar.location">
  376. <property environment="env"/>
  377. <condition property="do.set.ant-javafx.in.envjdk.tools">
  378. <and>
  379. <not><isset property="ant-javafx.jar.location"/></not>
  380. <available file="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
  381. </and>
  382. </condition>
  383. </target>
  384. <target name="-set-ant-javafx-in-envjdk-tools" depends="-set-ant-javafx-in-envjdk-lib,-check-ant-javafx-in-envjdk-tools" if="do.set.ant-javafx.in.envjdk.tools">
  385. <property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
  386. </target>
  387. <target name="-pre-check-ant-javafx-version" depends="-set-ant-javafx-in-envjdk-tools" unless="ant-javafx-version-already-checked-in-jfximpl">
  388. <condition property="do.check.ant-javafx.version">
  389. <and>
  390. <isset property="ant-javafx.jar.location"/>
  391. <not><isset property="ant-javafx-version-already-checked-in-jfximpl"/></not>
  392. </and>
  393. </condition>
  394. </target>
  395. <target name="-set-endorsed-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" if="endorsed-javafx-ant-classpath-available">
  396. <property name="javafx.ant.classpath" value="${endorsed.javafx.ant.classpath}:${ant-javafx.jar.location}"/>
  397. </target>
  398. <target name="-set-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" unless="endorsed-javafx-ant-classpath-available">
  399. <property name="javafx.ant.classpath" value="${ant-javafx.jar.location}"/>
  400. </target>
  401. <target name="-check-ant-javafx-version" depends="-pre-check-ant-javafx-version,
  402. -set-endorsed-javafx-ant-classpath,-set-javafx-ant-classpath" if="do.check.ant-javafx.version">
  403. <echo message="ant-javafx.jar.location = ${ant-javafx.jar.location}" level="verbose"/>
  404. <echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
  405. <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
  406. uri="javafx:com.sun.javafx.tools.ant"
  407. classpath="${javafx.ant.classpath}"/>
  408. <condition property="have-fx-ant-init">
  409. <typefound name="javafx:com.sun.javafx.tools.ant:init-ant"/>
  410. </condition>
  411. <property name="ant-javafx-version-already-checked-in-jfximpl" value="true"/>
  412. <echo message="have-fx-ant-init = ${have-fx-ant-init}" level="verbose"/>
  413. </target>
  414. <target name="-check-jfx-sdk-version-old" depends="-check-ant-javafx-version" unless="have-fx-ant-init">
  415. <property name="javafx.ant.version" value="1.0"/>
  416. </target>
  417. <target name="-check-jfx-sdk-version-new" depends="-check-ant-javafx-version" if="have-fx-ant-init">
  418. <fx:init-ant/>
  419. <condition property="have-fx-ant-api-1.1">
  420. <!-- new features from JavaFX 2.0.2 are available in API version 1.1 or later -->
  421. <matches pattern="1.[1-9]" string="${javafx.ant.version}"/>
  422. </condition>
  423. <condition property="have-fx-ant-api-1.2">
  424. <!-- new features from JavaFX 2.2 are available in API version 1.2 or later -->
  425. <matches pattern="1.[2-9]" string="${javafx.ant.version}"/>
  426. </condition>
  427. </target>
  428. <target name="-check-jfx-sdk-version" depends="-check-jfx-sdk-version-old, -check-jfx-sdk-version-new" unless="jfx.sdk.version.checked">
  429. <echo message="Detected JavaFX Ant API version ${javafx.ant.version}" level="info"/>
  430. <echo message="have-fx-ant-api-1.1 = ${have-fx-ant-api-1.1}" level="verbose"/>
  431. <echo message="have-fx-ant-api-1.2 = ${have-fx-ant-api-1.2}" level="verbose"/>
  432. <echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
  433. <property name="jfx.sdk.version.checked" value="true"/>
  434. </target>
  435. <target name="-check-jfx-deployment" depends="-check-jdk-version,-check-jfx-sdk-version">
  436. <condition property="jfx-deployment-available">
  437. <and>
  438. <or>
  439. <isset property="do.set.ant-javafx.in.fxsdk.lib"/>
  440. <isset property="do.set.ant-javafx.in.fxsdk.tools"/>
  441. <isset property="do.set.ant-javafx.in.platform.home.lib"/>
  442. <isset property="do.set.ant-javafx.in.platform.home.tools"/>
  443. <isset property="do.set.ant-javafx.in.probjdk.lib"/>
  444. <isset property="do.set.ant-javafx.in.probjdk.tools"/>
  445. <isset property="do.set.ant-javafx.in.envjdk.lib"/>
  446. <isset property="do.set.ant-javafx.in.envjdk.tools"/>
  447. </or>
  448. <isset property="ant-javafx.jar.location"/>
  449. </and>
  450. </condition>
  451. <condition property="jfx-deployment-missing+jdk7u6">
  452. <and>
  453. <not><isset property="jfx-deployment-available"/></not>
  454. <not><isset property="have-jdk-pre7u6"/></not>
  455. </and>
  456. </condition>
  457. <condition property="jfx-deployment-missing+javafx.sdk.missing+default">
  458. <and>
  459. <not><isset property="jfx-deployment-available"/></not>
  460. <isset property="have-jdk-pre7u6"/>
  461. <isset property="javafx.sdk.missing+default"/>
  462. </and>
  463. </condition>
  464. <condition property="jfx-deployment-missing+javafx.sdk.missing-default">
  465. <and>
  466. <not><isset property="jfx-deployment-available"/></not>
  467. <isset property="have-jdk-pre7u6"/>
  468. <isset property="javafx.sdk.missing-default"/>
  469. </and>
  470. </condition>
  471. <fail message="Error:${line.separator}JavaFX deployment library not found in active JDK.${line.separator}Please check that the JDK is correctly installed and its version is at least 7u4 on Mac or 7u6 on other systems." if="jfx-deployment-missing+jdk7u6"/>
  472. <fail message="Error:${line.separator}JavaFX deployment library not found.${line.separator}JavaFX SDK path undefined. Check the definition of ${platform.active} in Java Platform Manager${line.separator}(or directly the properties platform.active and javafx.sdk in project.properties file).${line.separator}Note: If missing, the default JavaFX-enabled platform gets created automatically when creating a new JavaFX Project." if="jfx-deployment-missing+javafx.sdk.missing+default"/>
  473. <fail message="Error:${line.separator}JavaFX deployment library not found.${line.separator}JavaFX SDK path undefined. Check the definition of ${platform.active} in Java Platform Manager${line.separator}(or directly the properties platform.active and javafx.sdk in project.properties file)." if="jfx-deployment-missing+javafx.sdk.missing-default"/>
  474. <fail message="Error:${line.separator}JavaFX deployment library not found." unless="jfx-deployment-available"/>
  475. <echo message="jfx-deployment-available = ${jfx-deployment-available}" level="verbose"/>
  476. </target>
  477. <!-- Check availability of main JavaFX runtime jar (jfxrt.jar) -->
  478. <target name="-check-property-javafx.runtime">
  479. <echo message="javafx.runtime = ${javafx.runtime}" level="verbose"/>
  480. <condition property="javafx.runtime.defined">
  481. <and>
  482. <isset property="javafx.runtime"/>
  483. <not><contains string="${javafx.runtime}" substring="$${platform" casesensitive="false"/></not>
  484. </and>
  485. </condition>
  486. <condition property="javafx.runtime.missing+default">
  487. <and>
  488. <equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/>
  489. <not><isset property="javafx.runtime.defined"/></not>
  490. </and>
  491. </condition>
  492. <condition property="javafx.runtime.missing-default">
  493. <and>
  494. <not><equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/></not>
  495. <not><isset property="javafx.runtime.defined"/></not>
  496. </and>
  497. </condition>
  498. <echo message="javafx.runtime.defined = ${javafx.runtime.defined}" level="verbose"/>
  499. <echo message="javafx.runtime.missing+default = ${javafx.runtime.missing+default}" level="verbose"/>
  500. <echo message="javafx.runtime.missing-default = ${javafx.runtime.missing-default}" level="verbose"/>
  501. </target>
  502. <target name="-check-jfxrt-in-fxrt" depends="-check-property-javafx.runtime" if="javafx.runtime.defined">
  503. <condition property="do.set.jfxrt.in.fxrt.old">
  504. <and>
  505. <not><isset property="jfxrt.jar.location"/></not>
  506. <available file="${javafx.runtime}${file.separator}lib${file.separator}jfxrt.jar"/>
  507. </and>
  508. </condition>
  509. <condition property="do.set.jfxrt.in.fxrt.new">
  510. <and>
  511. <not><isset property="do.set.jfxrt.in.fxrt.old"/></not>
  512. <not><isset property="jfxrt.jar.location"/></not>
  513. <available file="${javafx.runtime}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  514. </and>
  515. </condition>
  516. </target>
  517. <target name="-set-jfxrt-in-fxrt-old" depends="-check-jfxrt-in-fxrt" if="do.set.jfxrt.in.fxrt.old">
  518. <property name="jfxrt.jar.location" value="${javafx.runtime}${file.separator}lib${file.separator}jfxrt.jar"/>
  519. </target>
  520. <target name="-set-jfxrt-in-fxrt-new" depends="-set-jfxrt-in-fxrt-old,-check-jfxrt-in-fxrt" if="do.set.jfxrt.in.fxrt.new">
  521. <property name="jfxrt.jar.location" value="${javafx.runtime}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  522. </target>
  523. <target name="-check-jfxrt-in-fxsdk-jre" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  524. <condition property="do.set.jfxrt.in.fxsdk.jre.old">
  525. <and>
  526. <not><isset property="jfxrt.jar.location"/></not>
  527. <available file="${javafx.sdk}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  528. </and>
  529. </condition>
  530. <condition property="do.set.jfxrt.in.fxsdk.jre.new">
  531. <and>
  532. <not><isset property="do.set.jfxrt.in.fxsdk.jre.old"/></not>
  533. <not><isset property="jfxrt.jar.location"/></not>
  534. <available file="${javafx.sdk}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  535. </and>
  536. </condition>
  537. </target>
  538. <target name="-set-jfxrt-in-fxsdk-jre-old" depends="-set-jfxrt-in-fxrt-new,-check-jfxrt-in-fxsdk-jre" if="do.set.jfxrt.in.fxsdk.jre.old">
  539. <property name="jfxrt.jar.location" value="${javafx.sdk}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  540. </target>
  541. <target name="-set-jfxrt-in-fxsdk-jre-new" depends="-set-jfxrt-in-fxsdk-jre-old,-check-jfxrt-in-fxsdk-jre" if="do.set.jfxrt.in.fxsdk.jre.new">
  542. <property name="jfxrt.jar.location" value="${javafx.sdk}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  543. </target>
  544. <target name="-check-jfxrt-in-fxsdk-rt" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  545. <condition property="do.set.jfxrt.in.fxsdk.rt.old">
  546. <and>
  547. <not><isset property="jfxrt.jar.location"/></not>
  548. <available file="${javafx.sdk}${file.separator}rt${file.separator}lib${file.separator}jfxrt.jar"/>
  549. </and>
  550. </condition>
  551. <condition property="do.set.jfxrt.in.fxsdk.rt.new">
  552. <and>
  553. <not><isset property="do.set.jfxrt.in.fxsdk.rt.old"/></not>
  554. <not><isset property="jfxrt.jar.location"/></not>
  555. <available file="${javafx.sdk}${file.separator}rt${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  556. </and>
  557. </condition>
  558. </target>
  559. <target name="-set-jfxrt-in-fxsdk-rt-old" depends="-set-jfxrt-in-fxsdk-jre-new,-check-jfxrt-in-fxsdk-rt" if="do.set.jfxrt.in.fxsdk.rt.old">
  560. <property name="jfxrt.jar.location" value="${javafx.sdk}${file.separator}rt${file.separator}lib${file.separator}jfxrt.jar"/>
  561. </target>
  562. <target name="-set-jfxrt-in-fxsdk-rt-new" depends="-set-jfxrt-in-fxsdk-rt-old,-check-jfxrt-in-fxsdk-rt" if="do.set.jfxrt.in.fxsdk.rt.new">
  563. <property name="jfxrt.jar.location" value="${javafx.sdk}${file.separator}rt${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  564. </target>
  565. <target name="-check-jfxrt-in-platform-home-jre" if="platform.home">
  566. <condition property="do.set.jfxrt.in.platform.home.jre.old">
  567. <and>
  568. <not><isset property="jfxrt.jar.location"/></not>
  569. <available file="${platform.home}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  570. </and>
  571. </condition>
  572. <condition property="do.set.jfxrt.in.platform.home.jre.new">
  573. <and>
  574. <not><isset property="do.set.jfxrt.in.platform.home.jre.old"/></not>
  575. <not><isset property="jfxrt.jar.location"/></not>
  576. <available file="${platform.home}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  577. </and>
  578. </condition>
  579. </target>
  580. <target name="-set-jfxrt-in-platform-home-jre-old" depends="-set-jfxrt-in-fxsdk-rt-new,-check-jfxrt-in-platform-home-jre" if="do.set.jfxrt.in.platform.home.jre.old">
  581. <property name="jfxrt.jar.location" value="${platform.home}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  582. </target>
  583. <target name="-set-jfxrt-in-platform-home-jre-new" depends="-set-jfxrt-in-platform-home-jre-old,-check-jfxrt-in-platform-home-jre" if="do.set.jfxrt.in.platform.home.jre.new">
  584. <property name="jfxrt.jar.location" value="${platform.home}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  585. </target>
  586. <target name="-check-jfxrt-in-platform-home-rt" if="platform.home">
  587. <condition property="do.set.jfxrt.in.platform.home.rt.old">
  588. <and>
  589. <not><isset property="jfxrt.jar.location"/></not>
  590. <available file="${platform.home}${file.separator}rt${file.separator}lib${file.separator}jfxrt.jar"/>
  591. </and>
  592. </condition>
  593. <condition property="do.set.jfxrt.in.platform.home.rt.new">
  594. <and>
  595. <not><isset property="do.set.jfxrt.in.platform.home.rt.old"/></not>
  596. <not><isset property="jfxrt.jar.location"/></not>
  597. <available file="${platform.home}${file.separator}rt${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  598. </and>
  599. </condition>
  600. </target>
  601. <target name="-set-jfxrt-in-platform-home-rt-old" depends="-set-jfxrt-in-platform-home-jre-new,-check-jfxrt-in-platform-home-rt" if="do.set.jfxrt.in.platform.home.rt.old">
  602. <property name="jfxrt.jar.location" value="${platform.home}${file.separator}rt${file.separator}lib${file.separator}jfxrt.jar"/>
  603. </target>
  604. <target name="-set-jfxrt-in-platform-home-rt-new" depends="-set-jfxrt-in-platform-home-rt-old,-check-jfxrt-in-platform-home-rt" if="do.set.jfxrt.in.platform.home.rt.new">
  605. <property name="jfxrt.jar.location" value="${platform.home}${file.separator}rt${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  606. </target>
  607. <target name="-check-jfxrt-in-jre" unless="jfxrt.jar.location">
  608. <condition property="do.set.jfxrt.in.jre.old">
  609. <and>
  610. <not><isset property="jfxrt.jar.location"/></not>
  611. <available file="${java.home}${file.separator}lib${file.separator}jfxrt.jar"/>
  612. </and>
  613. </condition>
  614. <condition property="do.set.jfxrt.in.jre.new">
  615. <and>
  616. <not><isset property="do.set.jfxrt.in.jre.old"/></not>
  617. <not><isset property="jfxrt.jar.location"/></not>
  618. <available file="${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  619. </and>
  620. </condition>
  621. </target>
  622. <target name="-set-jfxrt-in-jre-old" depends="-set-jfxrt-in-platform-home-rt-new,-check-jfxrt-in-jre" if="do.set.jfxrt.in.jre.old">
  623. <property name="jfxrt.jar.location" value="${java.home}${file.separator}lib${file.separator}jfxrt.jar"/>
  624. </target>
  625. <target name="-set-jfxrt-in-jre-new" depends="-set-jfxrt-in-jre-old,-check-jfxrt-in-jre" if="do.set.jfxrt.in.jre.new">
  626. <property name="jfxrt.jar.location" value="${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  627. </target>
  628. <target name="-check-jfxrt-in-envjdk-jre" unless="jfxrt.jar.location">
  629. <property environment="env"/>
  630. <condition property="do.set.jfxrt.in.envjdk.jre.old">
  631. <and>
  632. <not><isset property="jfxrt.jar.location"/></not>
  633. <available file="${env.JAVA_HOME}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  634. </and>
  635. </condition>
  636. <condition property="do.set.jfxrt.in.envjdk.jre.new">
  637. <and>
  638. <not><isset property="do.set.jfxrt.in.envjdk.jre.old"/></not>
  639. <not><isset property="jfxrt.jar.location"/></not>
  640. <available file="${env.JAVA_HOME}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  641. </and>
  642. </condition>
  643. </target>
  644. <target name="-set-jfxrt-in-envjdk-jre-old" depends="-set-jfxrt-in-jre-new,-check-jfxrt-in-envjdk-jre" if="do.set.jfxrt.in.envjdk.jre.old">
  645. <property name="jfxrt.jar.location" value="${env.JAVA_HOME}${file.separator}jre${file.separator}lib${file.separator}jfxrt.jar"/>
  646. </target>
  647. <target name="-set-jfxrt-in-envjdk-jre-new" depends="-set-jfxrt-in-envjdk-jre-old,-check-jfxrt-in-envjdk-jre" if="do.set.jfxrt.in.envjdk.jre.new">
  648. <property name="jfxrt.jar.location" value="${env.JAVA_HOME}${file.separator}jre${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar"/>
  649. </target>
  650. <target name="-pre-check-jfx-runtime" depends="-set-jfxrt-in-envjdk-jre-new">
  651. <echo message="jfxrt.jar.location = ${jfxrt.jar.location}" level="verbose"/>
  652. </target>
  653. <target name="-check-jfx-runtime" depends="-check-jdk-version, -pre-check-jfx-runtime">
  654. <condition property="jfx-runtime-available">
  655. <and>
  656. <or>
  657. <isset property="do.set.jfxrt.in.fxrt.old"/>
  658. <isset property="do.set.jfxrt.in.fxrt.new"/>
  659. <isset property="do.set.jfxrt.in.fxsdk.jre.old"/>
  660. <isset property="do.set.jfxrt.in.fxsdk.jre.new"/>
  661. <isset property="do.set.jfxrt.in.fxsdk.rt.old"/>
  662. <isset property="do.set.jfxrt.in.fxsdk.rt.new"/>
  663. <isset property="do.set.jfxrt.in.platform.home.jre.old"/>
  664. <isset property="do.set.jfxrt.in.platform.home.jre.new"/>
  665. <isset property="do.set.jfxrt.in.platform.home.rt.old"/>
  666. <isset property="do.set.jfxrt.in.platform.home.rt.new"/>
  667. <isset property="do.set.jfxrt.in.jre.old"/>
  668. <isset property="do.set.jfxrt.in.jre.new"/>
  669. <isset property="do.set.jfxrt.in.envjdk.jre.old"/>
  670. <isset property="do.set.jfxrt.in.envjdk.jre.new"/>
  671. </or>
  672. <isset property="jfxrt.jar.location"/>
  673. </and>
  674. </condition>
  675. <fail message="Error:${line.separator}JavaFX runtime JAR not found." unless="jfx-runtime-available"/>
  676. <echo message="jfx-runtime-available = ${jfx-runtime-available}" level="verbose"/>
  677. </target>
  678. <!-- Check availability of WebStart executable -->
  679. <target name="-check-webstart-in-fxrt" depends="-check-property-javafx.runtime" if="javafx.runtime.defined">
  680. <condition property="do.set.webstart.in.fxrt">
  681. <and>
  682. <not><isset property="active.webstart.executable"/></not>
  683. <isset property="javafx.runtime.defined"/>
  684. <or>
  685. <available file="${javafx.runtime}${file.separator}bin${file.separator}javaws.exe"/>
  686. <available file="${javafx.runtime}${file.separator}bin${file.separator}javaws"/>
  687. </or>
  688. </and>
  689. </condition>
  690. </target>
  691. <target name="-set-webstart-in-fxrt" depends="-check-webstart-in-fxrt" if="do.set.webstart.in.fxrt">
  692. <property name="active.webstart.executable" value="${javafx.runtime}${file.separator}bin${file.separator}javaws"/>
  693. </target>
  694. <target name="-check-webstart-in-fxsdk-jre" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  695. <condition property="do.set.webstart.in.fxsdk.jre">
  696. <and>
  697. <not><isset property="active.webstart.executable"/></not>
  698. <isset property="javafx.sdk.defined"/>
  699. <or>
  700. <available file="${javafx.sdk}${file.separator}jre${file.separator}bin${file.separator}javaws.exe"/>
  701. <available file="${javafx.sdk}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
  702. </or>
  703. </and>
  704. </condition>
  705. </target>
  706. <target name="-set-webstart-in-fxsdk-jre" depends="-set-webstart-in-fxrt,-check-webstart-in-fxsdk-jre" if="do.set.webstart.in.fxsdk.jre">
  707. <property name="active.webstart.executable" value="${javafx.sdk}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
  708. </target>
  709. <target name="-check-webstart-in-fxsdk" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
  710. <condition property="do.set.webstart.in.fxsdk">
  711. <and>
  712. <not><isset property="active.webstart.executable"/></not>
  713. <isset property="javafx.sdk.defined"/>
  714. <or>
  715. <available file="${javafx.sdk}${file.separator}bin${file.separator}javaws.exe"/>
  716. <available file="${javafx.sdk}${file.separator}bin${file.separator}javaws"/>
  717. </or>
  718. </and>
  719. </condition>
  720. </target>
  721. <target name="-set-webstart-in-fxsdk" depends="-set-webstart-in-fxsdk-jre,-check-webstart-in-fxsdk" if="do.set.webstart.in.fxsdk">
  722. <property name="active.webstart.executable" value="${javafx.sdk}${file.separator}bin${file.separator}javaws"/>
  723. </target>
  724. <target name="-check-webstart-in-platform-home-jre" if="platform.home">
  725. <condition property="do.set.webstart.in.platform.home.jre">
  726. <and>
  727. <not><isset property="active.webstart.executable"/></not>
  728. <or>
  729. <available file="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws.exe"/>
  730. <available file="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
  731. </or>
  732. </and>
  733. </condition>
  734. </target>
  735. <target name="-set-webstart-in-platform-home-jre" depends="-set-webstart-in-fxsdk,-check-webstart-in-platform-home-jre" if="do.set.webstart.in.platform.home.jre">
  736. <property name="active.webstart.executable" value="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
  737. </target>
  738. <target name="-check-webstart-in-platform-home" if="platform.home">
  739. <condition property="do.set.webstart.in.platform.home">
  740. <and>
  741. <not><isset property="active.webstart.executable"/></not>
  742. <or>
  743. <available file="${platform.home}${file.separator}bin${file.separator}javaws.exe"/>
  744. <available file="${platform.home}${file.separator}bin${file.separator}javaws"/>
  745. </or>
  746. </and>
  747. </condition>
  748. </target>
  749. <target name="-set-webstart-in-platform-home" depends="-set-webstart-in-platform-home-jre,-check-webstart-in-platform-home" if="do.set.webstart.in.platform.home">
  750. <property name="active.webstart.executable" value="${platform.home}${file.separator}bin${file.separator}javaws"/>
  751. </target>
  752. <target name="-check-webstart-in-jre" unless="active.webstart.executable">
  753. <condition property="do.set.webstart.in.jre">
  754. <and>
  755. <not><isset property="active.webstart.executable"/></not>
  756. <or>
  757. <available file="${java.home}${file.separator}bin${file.separator}javaws.exe"/>
  758. <available file="${java.home}${file.separator}bin${file.separator}javaws"/>
  759. </or>
  760. </and>
  761. </condition>
  762. </target>
  763. <target name="-set-webstart-in-jre" depends="-set-webstart-in-platform-home,-check-webstart-in-jre" if="do.set.webstart.in.jre">
  764. <property name="active.webstart.executable" value="${java.home}${file.separator}bin${file.separator}javaws"/>
  765. </target>
  766. <target name="-check-webstart-in-probjdk" unless="active.webstart.executable">
  767. <condition property="do.set.webstart.in.probjdk">
  768. <and>
  769. <not><isset property="active.webstart.executable"/></not>
  770. <or>
  771. <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws.exe"/>
  772. <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
  773. </or>
  774. </and>
  775. </condition>
  776. </target>
  777. <target name="-set-webstart-in-probjdk" depends="-set-webstart-in-jre,-check-webstart-in-probjdk" if="do.set.webstart.in.probjdk">
  778. <property name="active.webstart.executable" value="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
  779. </target>
  780. <target name="-check-webstart-in-envjdk" unless="active.webstart.executable">
  781. <property environment="env"/>
  782. <condition property="do.set.webstart.in.envjdk">
  783. <and>
  784. <not><isset property="active.webstart.executable"/></not>
  785. <or>
  786. <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws.exe"/>
  787. <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws"/>
  788. </or>
  789. </and>
  790. </condition>
  791. </target>
  792. <target name="-set-webstart-in-envjdk" depends="-set-webstart-in-probjdk,-check-webstart-in-envjdk" if="do.set.webstart.in.envjdk">
  793. <property name="active.webstart.executable" value="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws"/>
  794. </target>
  795. <target name="-pre-check-webstart-in-unix" depends="-check-operating-system,-set-webstart-in-envjdk" unless="active.webstart.executable">
  796. <condition property="running.on.unix-active.webstart.executable">
  797. <and>
  798. <not><isset property="active.webstart.executable"/></not>
  799. <isset property="running.on.unix"/>
  800. </and>
  801. </condition>
  802. </target>
  803. <target name="-check-webstart-in-unix" depends="-pre-check-webstart-in-unix" if="running.on.unix-active.webstart.executable">
  804. <local name="exec.which.javaws.result"/>
  805. <exec executable="command" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.javaws.result" outputproperty="exec.which.javaws.output">
  806. <arg line="-v javaws"/>
  807. </exec>
  808. <condition property="do.set.webstart.in.unix">
  809. <and>
  810. <not><isset property="active.webstart.executable"/></not>
  811. <isset property="exec.which.javaws.result"/>
  812. <equals arg1="${exec.which.javaws.result}" arg2="0"/>
  813. <isset property="exec.which.javaws.output"/>
  814. <not><equals arg1="${exec.which.javaws.output}" arg2=""/></not>
  815. </and>
  816. </condition>
  817. <echo message="do.set.webstart.in.unix = ${do.set.webstart.in.unix}" level="verbose"/>
  818. </target>
  819. <target name="-set-webstart-in-unix" depends="-set-webstart-in-envjdk,-check-webstart-in-unix" if="do.set.webstart.in.unix">
  820. <property name="active.webstart.executable" value="${exec.which.javaws.output}"/>
  821. </target>
  822. <target name="-pre-check-jfx-webstart" depends="-set-webstart-in-unix">
  823. <echo message="active.webstart.executable = ${active.webstart.executable}" level="verbose"/>
  824. </target>
  825. <target name="-check-jfx-webstart" depends="-pre-check-jfx-webstart">
  826. <condition property="jfx-webstart-available">
  827. <and>
  828. <or>
  829. <isset property="do.set.webstart.in.fxrt"/>
  830. <isset property="do.set.webstart.in.fxsdk.jre"/>
  831. <isset property="do.set.webstart.in.fxsdk"/>
  832. <isset property="do.set.webstart.in.platform.home.jre"/>
  833. <isset property="do.set.webstart.in.platform.home"/>
  834. <isset property="do.set.webstart.in.jre"/>
  835. <isset property="do.set.webstart.in.probjdk"/>
  836. <isset property="do.set.webstart.in.envjdk"/>
  837. <isset property="do.set.webstart.in.unix"/>
  838. </or>
  839. <isset property="active.webstart.executable"/>
  840. </and>
  841. </condition>
  842. <condition property="jfx-webstart-missing+jdk7u6">
  843. <and>
  844. <not><isset property="jfx-webstart-available"/></not>
  845. <not><isset property="have-jdk-pre7u6"/></not>
  846. </and>
  847. </condition>
  848. <condition property="jfx-webstart-missing+javafx.runtime.missing+default">
  849. <and>
  850. <not><isset property="jfx-webstart-available"/></not>
  851. <isset property="have-jdk-pre7u6"/>
  852. <isset property="javafx.runtime.missing+default"/>
  853. </and>
  854. </condition>
  855. <condition property="jfx-webstart-missing+javafx.runtime.missing-default">
  856. <and>
  857. <not><isset property="jfx-webstart-available"/></not>
  858. <isset property="have-jdk-pre7u6"/>
  859. <isset property="javafx.runtime.missing-default"/>
  860. </and>
  861. </condition>
  862. <fail message="Error:${line.separator}WebStart executable could not be found in active JDK.${line.separator}Please check that the JDK is correctly installed and its version is at least 7u6." if="jfx-webstart-missing+jdk7u6"/>
  863. <fail message="Error:${line.separator}WebStart executable could not be found.${line.separator}JavaFX RT path undefined. Check the definition of ${platform.active} in Java Platform Manager${line.separator}(or directly the properties platform.active and javafx.runtime in project.properties file).${line.separator}Note: If missing, the default JavaFX-enabled platform gets created automatically when creating a new JavaFX Project." if="jfx-webstart-missing+javafx.runtime.missing+default"/>
  864. <fail message="Error:${line.separator}WebStart executable could not be found.${line.separator}JavaFX RT path undefined. Check the definition of ${platform.active} in Java Platform Manager${line.separator}(or directly the properties platform.active and javafx.runtime in project.properties file)." if="jfx-webstart-missing+javafx.runtime.missing-default"/>
  865. <fail message="Error:${line.separator}WebStart executable could not be found." unless="jfx-webstart-available"/>
  866. <echo message="jfx-webstart-available = ${jfx-webstart-available}" level="verbose"/>
  867. </target>
  868. <!-- Legacy targets kept for compatibility with older build-impl.xml scripts -->
  869. <!-- Note: target "-check-javafx" is not necessary any more but is referenced from NB 7.1 build-impl.xml -->
  870. <target name="-check-javafx"/>
  871. <!-- Note: target "-javafx-check-error" is not necessary any more but is referenced from NB 7.1 build-impl.xml -->
  872. <target name="-javafx-check-error"/>
  873. <!-- Note: target "-init-javafx" is not necessary any more but is referenced from NB 7.1 build-impl.xml -->
  874. <target name="-init-javafx"/>
  875. <!-- Check project properties -->
  876. <target name="-check-default-run-config" unless="config">
  877. <property name="config" value="&lt;default config&gt;"/>
  878. </target>
  879. <target name="-check-project">
  880. <condition property="main-class-available">
  881. <isset property="javafx.main.class"/>
  882. </condition>
  883. <condition property="vmargs-available">
  884. <and>
  885. <isset property="run.jvmargs"/>
  886. <not><equals arg1="${run.jvmargs}" arg2=""/></not>
  887. </and>
  888. </condition>
  889. <condition property="preloader-available">
  890. <and>
  891. <isset property="javafx.preloader.enabled"/>
  892. <equals arg1="${javafx.preloader.enabled}" arg2="true"/>
  893. <isset property="javafx.preloader.class"/>
  894. <not><equals arg1="${javafx.preloader.class}" arg2=""/></not>
  895. <isset property="javafx.preloader.jar.filename"/>
  896. <not><equals arg1="${javafx.preloader.jar.filename}" arg2=""/></not>
  897. </and>
  898. </condition>
  899. <condition property="app-with-preloader">
  900. <and>
  901. <istrue value="${preloader-available}"/>
  902. <istrue value="${main-class-available}"/>
  903. </and>
  904. </condition>
  905. <condition property="app-with-external-preloader-jar">
  906. <and>
  907. <isset property="app-with-preloader"/>
  908. <isset property="javafx.preloader.type"/>
  909. <equals arg1="${javafx.preloader.type}" arg2="jar" trim="true"/>
  910. </and>
  911. </condition>
  912. <condition property="app-without-preloader">
  913. <and>
  914. <not>
  915. <istrue value="${preloader-available}"/>
  916. </not>
  917. <istrue value="${main-class-available}"/>
  918. </and>
  919. </condition>
  920. <condition property="preloader-app">
  921. <and>
  922. <isset property="javafx.preloader"/>
  923. <equals arg1="${javafx.preloader}" arg2="true"/>
  924. </and>
  925. </condition>
  926. <condition property="fx-in-swing-app">
  927. <and>
  928. <isset property="javafx.swing"/>
  929. <equals arg1="${javafx.swing}" arg2="true"/>
  930. </and>
  931. </condition>
  932. <condition property="fx-in-swing-workaround-app">
  933. <and>
  934. <istrue value="${fx-in-swing-app}"/>
  935. <istrue value="${preloader-app}"/>
  936. </and>
  937. </condition>
  938. <condition property="preloader-app-no-workaround">
  939. <and>
  940. <istrue value="${preloader-app}"/>
  941. <not><istrue value="${fx-in-swing-app}"/></not>
  942. </and>
  943. </condition>
  944. <condition property="html-template-available">
  945. <and>
  946. <isset property="javafx.run.htmltemplate"/>
  947. <not>
  948. <equals arg1="${javafx.run.htmltemplate}" arg2=""/>
  949. </not>
  950. </and>
  951. </condition>
  952. <condition property="icon-available">
  953. <and>
  954. <isset property="javafx.deploy.icon"/>
  955. <not>
  956. <equals arg1="${javafx.deploy.icon}" arg2=""/>
  957. </not>
  958. </and>
  959. </condition>
  960. <condition property="dimensions-available">
  961. <and>
  962. <isset property="javafx.run.width"/>
  963. <isset property="javafx.run.height"/>
  964. <not><equals arg1="${javafx.run.width}" arg2=""/></not>
  965. <not><equals arg1="${javafx.run.height}" arg2=""/></not>
  966. </and>
  967. </condition>
  968. <condition property="update-mode-background">
  969. <and>
  970. <isset property="javafx.deploy.backgroundupdate"/>
  971. <equals arg1="${javafx.deploy.backgroundupdate}" arg2="true" trim="true"/>
  972. </and>
  973. </condition>
  974. <condition property="offline-allowed">
  975. <and>
  976. <isset property="javafx.deploy.allowoffline"/>
  977. <equals arg1="${javafx.deploy.allowoffline}" arg2="true" trim="true"/>
  978. </and>
  979. </condition>
  980. <condition property="permissions-elevated">
  981. <and>
  982. <isset property="javafx.deploy.permissionselevated"/>
  983. <equals arg1="${javafx.deploy.permissionselevated}" arg2="true" trim="true"/>
  984. </and>
  985. </condition>
  986. <condition property="binary-encode-css">
  987. <and>
  988. <isset property="javafx.binarycss"/>
  989. <equals arg1="${javafx.binarycss}" arg2="true" trim="true"/>
  990. </and>
  991. </condition>
  992. <condition property="rebase-lib-jars">
  993. <and>
  994. <isset property="javafx.rebase.libs"/>
  995. <equals arg1="${javafx.rebase.libs}" arg2="true" trim="true"/>
  996. </and>
  997. </condition>
  998. <condition property="use-blob-signing">
  999. <and>
  1000. <isset property="javafx.signing.blob"/>
  1001. <equals arg1="${javafx.signing.blob}" arg2="true" trim="true"/>
  1002. </and>
  1003. </condition>
  1004. <echo message="main-class-available = ${main-class-available}" level="verbose"/>
  1005. <echo message="vmargs-available = ${vmargs-available}" level="verbose"/>
  1006. <echo message="preloader-available = ${preloader-available}" level="verbose"/>
  1007. <echo message="app-with-preloader = ${app-with-preloader}" level="verbose"/>
  1008. <echo message="app-with-preloader-without-project = ${app-with-preloader-without-project}" level="verbose"/>
  1009. <echo message="app-without-preloader = ${app-without-preloader}" level="verbose"/>
  1010. <echo message="preloader-app = ${preloader-app}" level="verbose"/>
  1011. <echo message="fx-in-swing-app = ${fx-in-swing-app}" level="verbose"/>
  1012. <echo message="fx-in-swing-workaround-app = ${fx-in-swing-workaround-app}" level="verbose"/>
  1013. <echo message="preloader-app-no-workaround = ${preloader-app-no-workaround}" level="verbose"/>
  1014. <echo message="html-template-available = ${html-template-available}" level="verbose"/>
  1015. <echo message="icon-available = ${icon-available}" level="verbose"/>
  1016. <echo message="dimensions-available = ${dimensions-available}" level="verbose"/>
  1017. <echo message="update-mode-background = ${update-mode-background}" level="verbose"/>
  1018. <echo message="offline-allowed = ${offline-allowed}" level="verbose"/>
  1019. <echo message="permissions-elevated = ${permissions-elevated}" level="verbose"/>
  1020. <echo message="binary-encode-css = ${binary-encode-css}" level="verbose"/>
  1021. <echo message="rebase-lib-jars = ${rebase-lib-jars}" level="verbose"/>
  1022. <echo message="use-blob-signing = ${use-blob-signing}" level="verbose"/>
  1023. </target>
  1024. <target name="-swing-api-check" depends="-check-project,-check-jfx-deployment" if="fx-in-swing-app">
  1025. <condition property="fx-in-swing-app-workaround">
  1026. <and>
  1027. <isset property="fx-in-swing-app"/>
  1028. <not><isset property="have-fx-ant-api-1.2"/></not>
  1029. </and>
  1030. </condition>
  1031. </target>
  1032. <target name="-swing-api-warning" depends="-swing-api-check" if="fx-in-swing-app-workaround">
  1033. <echo message="Info: No support for FX-in-Swing deployment detected in current JavaFX SDK. Using workaround instead."/>
  1034. </target>
  1035. <target name="-icon-deployment-check" depends="-check-project,-check-jfx-deployment" if="icon-available">
  1036. <condition property="icon-deployment-may-not-be-supported">
  1037. <and>
  1038. <isset property="icon-available"/>
  1039. <not><isset property="have-fx-ant-api-1.1"/></not>
  1040. </and>
  1041. </condition>
  1042. </target>
  1043. <target name="-icon-warning" depends="-icon-deployment-check" if="icon-deployment-may-not-be-supported">
  1044. <echo message="Warning: Note that due to a bug in early JavaFX 2.0 SDK distributions the icon may not be properly set in deployment files."/>
  1045. </target>
  1046. <target name="-set-dimensions" depends="-check-project" if="dimensions-available">
  1047. <property name="javafx.width" value="${javafx.run.width}"/>
  1048. <property name="javafx.height" value="${javafx.run.height}"/>
  1049. </target>
  1050. <target name="-reset-dimensions" depends="-check-project" unless="dimensions-available">
  1051. <property name="javafx.width" value="800"/>
  1052. <property name="javafx.height" value="600"/>
  1053. </target>
  1054. <target name="-set-update-mode-background" depends="-check-project" if="update-mode-background">
  1055. <property name="update-mode" value="background"/>
  1056. </target>
  1057. <target name="-set-update-mode-eager" depends="-check-project" unless="update-mode-background">
  1058. <property name="update-mode" value="eager"/>
  1059. </target>
  1060. <target name="-set-permissions-elevated" depends="-check-project" if="permissions-elevated">
  1061. <property name="permissions.elevated" value="true"/>
  1062. </target>
  1063. <target name="-reset-permissions-elevated" depends="-check-project" unless="permissions-elevated">
  1064. <property name="permissions.elevated" value="false"/>
  1065. </target>
  1066. <target name="-set-binary-css" depends="-check-project,-init-css-conversion" if="do.copy.binary.css">
  1067. <property name="css-include-ext" value="bss"/>
  1068. <property name="css-exclude-ext" value="css"/>
  1069. </target>
  1070. <target name="-unset-binary-css" depends="-check-project,-init-css-conversion" unless="do.copy.binary.css">
  1071. <property name="css-include-ext" value="css"/>
  1072. <property name="css-exclude-ext" value="bss"/>
  1073. </target>
  1074. <target name="-copy-binary-css" depends="-init-css-conversion,-set-binary-css,-unset-binary-css,-copy-binary-css-bypass,-copy-binary-css-impl"/>
  1075. <target name="-init-css-conversion" depends="-check-project,-check-ant-jre-version">
  1076. <fileset id="cssfiles" dir="${basedir}${file.separator}${build.classes.dir}">
  1077. <include name="**${file.separator}*.css"/>
  1078. </fileset>
  1079. <pathconvert refid="cssfiles" property="cssfileset.notempty" setonempty="false"/>
  1080. <condition property="do.copy.binary.css">
  1081. <and>
  1082. <isset property="binary-encode-css"/>
  1083. <isset property="cssfileset.notempty"/>
  1084. <not><isset property="have-jdk7-css2bin-bug"/></not>
  1085. </and>
  1086. </condition>
  1087. <condition property="do.bypass.binary.css">
  1088. <and>
  1089. <isset property="binary-encode-css"/>
  1090. <isset property="cssfileset.notempty"/>
  1091. <isset property="have-jdk7-css2bin-bug"/>
  1092. </and>
  1093. </condition>
  1094. <echo message="do.copy.binary.css = ${do.copy.binary.css}" level="verbose"/>
  1095. <echo message="do.bypass.binary.css = ${do.bypass.binary.css}" level="verbose"/>
  1096. </target>
  1097. <target name="-copy-binary-css-bypass" depends="-init-css-conversion" if="do.bypass.binary.css">
  1098. <echo message="Warning: Bypassing FX CSS to BSS conversion due to a bug in &lt;fx:csstobin&gt; task in current JDK platform" level="warning"/>
  1099. </target>
  1100. <target name="-copy-binary-css-impl" depends="-init-css-conversion" if="do.copy.binary.css">
  1101. <property name="cssfileslist" refid="cssfiles"/>
  1102. <echo message="css files to binary convert: " level="verbose">${cssfileslist}</echo>
  1103. <fx:csstobin outdir="${basedir}${file.separator}${build.classes.dir}">
  1104. <fileset refid="cssfiles"/>
  1105. </fx:csstobin>
  1106. </target>
  1107. <!-- Copy dependent libraries -->
  1108. <!-- Note: target "-jfx-copylibs" is referenced from NB 7.1 build-impl.xml -->
  1109. <target name="-jfx-copylibs" depends="init,compile,-pre-pre-jar,-pre-jar,-jfx-copylibs-warning" unless="fallback.no.javascript">
  1110. <jfx-copylibs-js-impl/>
  1111. </target>
  1112. <target name="-jfx-copylibs-warning" if="fallback.no.javascript">
  1113. <echo message="Warning: Dependent Libraries copy (-jfx-copylibs) skipped in fallback build mode due to JDK missing JavaScript support."/>
  1114. </target>
  1115. <macrodef name="jfx-copylibs-js-impl">
  1116. <sequential>
  1117. <local name="run.classpath.without.build.classes.and.dist.dir"/>
  1118. <pathconvert property="run.classpath.without.build.classes.and.dist.dir">
  1119. <path path="${run.classpath}"/>
  1120. <map from="${basedir}${file.separator}${build.classes.dir}" to=""/>
  1121. <map from="${basedir}${file.separator}${dist.jar}" to=""/>
  1122. <scriptmapper language="javascript">
  1123. self.addMappedName(
  1124. (source.indexOf("jfxrt.jar") >= 0) ||
  1125. (source.indexOf("deploy.jar") >= 0) ||
  1126. (source.indexOf("javaws.jar") >= 0) ||
  1127. (source.indexOf("plugin.jar") >= 0)
  1128. ? "" : source
  1129. );
  1130. </scriptmapper>
  1131. </pathconvert>
  1132. <!-- add possibly missing dependencies at distance 2 (build system logic thus provides transitive closure) -->
  1133. <local name="run.and.lib.classpath"/>
  1134. <echo message="JavaScript: -jfx-copylibs" level="verbose"/>
  1135. <script language="javascript">
  1136. <![CDATA[
  1137. function prefix(s, len) {
  1138. if(s == null || len <= 0 || s.length == 0) {
  1139. return new String("");
  1140. }
  1141. return new String(s.substr(0, len));
  1142. }
  1143. function defined(s) {
  1144. return (s != null) && (s != "null") && (s.length > 0);
  1145. }
  1146. var pathConvert = project.createTask("pathconvert");
  1147. pathConvert.setProperty("run.and.lib.classpath");
  1148. var classPath = new String(project.getProperty("run.classpath.without.build.classes.and.dist.dir"));
  1149. var fileSeparator = new String(project.getProperty("file.separator"));
  1150. if(defined(classPath)) {
  1151. var classPathCopy = pathConvert.createPath();
  1152. classPathCopy.setPath(classPath);
  1153. var pathArray;
  1154. if(classPath.indexOf(";") != -1) {
  1155. pathArray = classPath.split(";");
  1156. } else {
  1157. pathArray = classPath.split(":");
  1158. }
  1159. var added = new java.lang.StringBuilder();
  1160. for (var i = 0; i < pathArray.length; i++) {
  1161. var index = pathArray[i].lastIndexOf(fileSeparator);
  1162. if (index >= 0) {
  1163. var onePath = prefix(pathArray[i], index+1).concat("lib");
  1164. var oneDir = new java.io.File(onePath);
  1165. if(oneDir.exists()) {
  1166. var fs = project.createDataType( "fileset" );
  1167. fs.setDir( oneDir );
  1168. fs.setIncludes("*.jar");
  1169. var ds = fs.getDirectoryScanner(project);
  1170. var srcFiles = ds.getIncludedFiles();
  1171. for (var j = 0; j < srcFiles.length; j++) {
  1172. if(classPath.indexOf( srcFiles[j] ) == -1 && added.indexOf( srcFiles[j] ) == -1) {
  1173. var path = pathConvert.createPath();
  1174. path.setPath( onePath.concat(fileSeparator).concat(srcFiles[j]) );
  1175. added.append( srcFiles[j] );
  1176. }
  1177. }
  1178. }
  1179. }
  1180. }
  1181. }
  1182. pathConvert.perform();
  1183. ]]>
  1184. </script>
  1185. <echo message="run.and.lib.classpath = ${run.and.lib.classpath}" level="verbose"/>
  1186. <delete dir="${dist.dir}${file.separator}lib" includeEmptyDirs="true" quiet="true"/>
  1187. <copy todir="${dist.dir}${file.separator}lib" flatten="true" preservelastmodified="true" overwrite="true">
  1188. <path>
  1189. <pathelement path="${run.and.lib.classpath}"/>
  1190. </path>
  1191. </copy>
  1192. </sequential>
  1193. </macrodef>
  1194. <target name="-copy-external-preloader-jar" depends="-check-project" if="app-with-external-preloader-jar">
  1195. <copy file="${javafx.preloader.jar.path}" todir="${dist.dir}${file.separator}lib"/>
  1196. </target>
  1197. <!-- Optional classpath re-base of dependent JAR manifests after copy to lib/, required by GlassFish -->
  1198. <!-- Note: target "-rebase-libs" is referenced from NB 7.1 build-impl.xml -->
  1199. <target name="-rebase-libs" depends="-check-project, -jfx-copylibs, -check-rebase-libs, -rebase-libs-warning" if="do-rebase-lib-jars">
  1200. <rebase-libs-js-impl/>
  1201. </target>
  1202. <target name="-check-rebase-libs">
  1203. <condition property="do-rebase-lib-jars">
  1204. <and>
  1205. <isset property="rebase-lib-jars"/>
  1206. <not><isset property="fallback.no.javascript"/></not>
  1207. </and>
  1208. </condition>
  1209. <condition property="do-skip-rebase-libs">
  1210. <and>
  1211. <isset property="rebase-lib-jars"/>
  1212. <isset property="fallback.no.javascript"/>
  1213. </and>
  1214. </condition>
  1215. </target>
  1216. <target name="-rebase-libs-warning" depends="-check-rebase-libs" if="do-skip-rebase-libs">
  1217. <echo message="Warning: Dependent Libraries JARs rebase (-rebase-libs) skipped in fallback build mode due to JDK missing JavaScript support."/>
  1218. </target>
  1219. <macrodef name="rebase-libs-js-impl">
  1220. <sequential>
  1221. <property name="pp_rebase_dir" value="${basedir}${file.separator}${dist.dir}${file.separator}lib"/>
  1222. <property name="pp_rebase_fs" value="*.jar"/>
  1223. <echo message="JavaScript: -rebase-libs-js-impl" level="verbose"/>
  1224. <script language="javascript">
  1225. <![CDATA[
  1226. var dir = new String(project.getProperty("pp_rebase_dir"));
  1227. var fDir = new java.io.File(dir);
  1228. if( fDir.exists() ) {
  1229. var callTask = project.createTask("antcall");
  1230. callTask.setTarget("-rebase-libs-macro-call");
  1231. var param = callTask.createParam();
  1232. param.setName("jar.file.to.rebase");
  1233. var includes = new String(project.getProperty("pp_rebase_fs"));
  1234. var fs = project.createDataType("fileset");
  1235. fs.setDir( fDir );
  1236. fs.setIncludes(includes);
  1237. var ds = fs.getDirectoryScanner(project);
  1238. var srcFiles = ds.getIncludedFiles();
  1239. for (var i = 0; i < srcFiles.length; i++) {
  1240. param.setValue(dir.concat("${file.separator}").concat(srcFiles[i]));
  1241. callTask.perform();
  1242. }
  1243. }
  1244. ]]>
  1245. </script>
  1246. </sequential>
  1247. </macrodef>
  1248. <macrodef name="rebase-lib">
  1249. <attribute name="jarfile"/>
  1250. <sequential>
  1251. <local name="tmpdir"/>
  1252. <property name="tmpdir" value="${java.io.tmpdir}${file.separator}${user.name}_${ant.project.name}_rebase" />
  1253. <echo message="tmpdir = ${tmpdir}" level="verbose"/>
  1254. <delete dir="${tmpdir}" quiet="true"/>
  1255. <mkdir dir="${tmpdir}"/>
  1256. <unzip src="@{jarfile}" dest="${tmpdir}">
  1257. <patternset>
  1258. <include name="META-INF${file.separator}MANIFEST.MF"/>
  1259. </patternset>
  1260. </unzip>
  1261. <local name="manifest.file.temp"/>
  1262. <property name="manifest.file.temp" value="${tmpdir}${file.separator}META-INF${file.separator}MANIFEST.MF" />
  1263. <echo message="manifest.file.temp = ${manifest.file.temp}" level="verbose"/>
  1264. <!-- edited manifest file -->
  1265. <local name="manifest.file.temp.new"/>
  1266. <property name="manifest.file.temp.new" value="${manifest.file.temp}_new" />
  1267. <echo message="manifest.file.temp.new = ${manifest.file.temp.new}" level="verbose"/>
  1268. <echo message="JavaScript: rebase-lib" level="verbose"/>
  1269. <script language="javascript">
  1270. <![CDATA[
  1271. var UTF_8 = "UTF-8";
  1272. var ATTR_CLASS_PATH = "Class-Path";
  1273. var ATTR_CLASS_PATH_FX = "JavaFX-Class-Path";
  1274. function endsWith(s, suffix) {
  1275. var i = s.lastIndexOf(suffix);
  1276. return (i != -1) && (i == (s.length - suffix.length));
  1277. }
  1278. function isSigned(manifest) {
  1279. var sections = manifest.getSectionNames();
  1280. while(sections.hasMoreElements()) {
  1281. var sectionname = new String(sections.nextElement());
  1282. var section = manifest.getSection(sectionname);
  1283. if(section != null) {
  1284. var sectionKeys = section.getAttributeKeys();
  1285. while (sectionKeys.hasMoreElements()) {
  1286. var element = new String(sectionKeys.nextElement());
  1287. if (endsWith(element, "-Digest") || endsWith(element, "-digest")) {
  1288. return true;
  1289. }
  1290. }
  1291. }
  1292. }
  1293. return false;
  1294. }
  1295. var src = new String(project.getProperty("manifest.file.temp"));
  1296. var srf = new java.io.File(src);
  1297. var manifest;
  1298. try {
  1299. var fis = new java.io.FileInputStream(srf);
  1300. try {
  1301. var isr = new java.io.InputStreamReader(fis, UTF_8);
  1302. try {
  1303. manifest = new org.apache.tools.ant.taskdefs.Manifest(isr);
  1304. } finally {
  1305. isr.close();
  1306. }
  1307. } finally {
  1308. fis.close();
  1309. }
  1310. } catch(e) {
  1311. manifest = null;
  1312. }
  1313. if(manifest != null) {
  1314. if(isSigned(manifest)) {
  1315. print("Warning: Signed JAR can not be rebased.");
  1316. } else {
  1317. var mainSection = manifest.getMainSection();
  1318. var classPath = mainSection.getAttributeValue(ATTR_CLASS_PATH);
  1319. var classPathAttr = null;
  1320. if (classPath != null) {
  1321. classPathAttr = ATTR_CLASS_PATH;
  1322. } else {
  1323. classPath = mainSection.getAttributeValue(ATTR_CLASS_PATH_FX);
  1324. if(classPath != null) {
  1325. classPathAttr = ATTR_CLASS_PATH_FX;
  1326. }
  1327. }
  1328. if(classPath != null) {
  1329. var result = new java.lang.StringBuilder();
  1330. var changed = false;
  1331. var pathArray = classPath.split(" ");
  1332. for (var i = 0; i < pathArray.length; i++) {
  1333. if (result.length() > 0) {
  1334. result.append(' ');
  1335. }
  1336. var index = pathArray[i].lastIndexOf('/');
  1337. if (index >= 0 && index < pathArray[i].length - 1) {
  1338. pathArray[i] = pathArray[i].substring(index+1);
  1339. changed = true;
  1340. }
  1341. result.append(pathArray[i]);
  1342. }
  1343. mainSection.removeAttribute(classPathAttr);
  1344. mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute(classPathAttr, result.toString()));
  1345. var tgt = new String(project.getProperty("manifest.file.temp.new"));
  1346. var tgf = new java.io.File(tgt);
  1347. try {
  1348. var fos = new java.io.FileOutputStream(tgf);
  1349. try {
  1350. var osw = new java.io.OutputStreamWriter(fos, UTF_8);
  1351. try {
  1352. var manifestOut = new java.io.PrintWriter(osw);
  1353. manifest.write(manifestOut);
  1354. manifestOut.close();
  1355. } finally {
  1356. osw.close();
  1357. }
  1358. } finally {
  1359. fos.close();
  1360. }
  1361. } catch(e) {
  1362. print("Warning: problem storing rebased manifest file.");
  1363. }
  1364. }
  1365. }
  1366. }
  1367. ]]>
  1368. </script>
  1369. <antcall target="-move-new-manifest-if-exists">
  1370. <param name="move.file.from" value="${manifest.file.temp.new}"/>
  1371. <param name="move.file.to" value="${manifest.file.temp}"/>
  1372. </antcall>
  1373. <zip destfile="@{jarfile}" basedir="${tmpdir}" update="true"/>
  1374. <delete dir="${tmpdir}" quiet="true"/>
  1375. </sequential>
  1376. </macrodef>
  1377. <target name="-new-temp-mainfest-existence">
  1378. <condition property="new-temp-manifest-exists">
  1379. <available file="${move.file.from}"/>
  1380. </condition>
  1381. <echo message="new-temp-manifest-exists = ${new-temp-manifest-exists}" level="verbose"/>
  1382. </target>
  1383. <target name="-move-new-manifest-if-exists" depends="-new-temp-mainfest-existence" if="new-temp-manifest-exists">
  1384. <move file="${move.file.from}" tofile="${move.file.to}" failonerror="false"/>
  1385. </target>
  1386. <target name="-rebase-libs-macro-call">
  1387. <echo message="Rebase jarfile = ${jar.file.to.rebase}" level="verbose"/>
  1388. <rebase-lib jarfile="${jar.file.to.rebase}"/>
  1389. </target>
  1390. <!-- Main Deployment Target -->
  1391. <!-- Note: target "jfx-deployment" is referenced from NB 7.1+ build-impl.xml -->
  1392. <target name="jfx-deployment" depends="-check-jfx-deployment-launch,-do-jfx-deployment-script,-do-jfx-deployment-noscript" if="jfx-deployment-available"/>
  1393. <target name="-check-dist-lib-exists">
  1394. <deploy-defines/>
  1395. <available file="${jfx.deployment.dir}${file.separator}lib" type="dir" property="dist.lib.exists"/>
  1396. </target>
  1397. <target name="-check-jfx-deployment-jar-current-nolib" depends="-check-dist-lib-exists" unless="dist.lib.exists">
  1398. <uptodate property="jfx-deployment-jar-current" targetfile="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}" >
  1399. <srcfiles dir="${basedir}${file.separator}${build.classes.dir}" includes="**${file.separator}*"/>
  1400. <srcfiles dir="${basedir}${file.separator}nbproject" includes="**${file.separator}*"/>
  1401. </uptodate>
  1402. </target>
  1403. <target name="-check-jfx-deployment-jar-current-lib" depends="-check-dist-lib-exists" if="dist.lib.exists">
  1404. <uptodate property="jfx-deployment-jar-current" targetfile="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}" >
  1405. <srcfiles dir="${basedir}${file.separator}${build.classes.dir}" includes="**${file.separator}*"/>
  1406. <srcfiles dir="${jfx.deployment.dir}${file.separator}lib" includes="**${file.separator}*"/>
  1407. <srcfiles dir="${basedir}${file.separator}nbproject" includes="**${file.separator}*"/>
  1408. </uptodate>
  1409. </target>
  1410. <target name="-check-jfx-deployment-launch" depends="-check-jfx-deployment,-check-jfx-deployment-jar-current-nolib,-check-jfx-deployment-jar-current-lib">
  1411. <condition property="do-jfx-deployment-script">
  1412. <and>
  1413. <isset property="jfx-deployment-available"/>
  1414. <not><isset property="fallback.no.javascript"/></not>
  1415. <not><isset property="jfx-deployment-jar-current"/></not>
  1416. </and>
  1417. </condition>
  1418. <condition property="do-jfx-deployment-noscript">
  1419. <and>
  1420. <isset property="jfx-deployment-available"/>
  1421. <isset property="fallback.no.javascript"/>
  1422. <not><isset property="jfx-deployment-jar-current"/></not>
  1423. </and>
  1424. </condition>
  1425. </target>
  1426. <target name="-do-jfx-deployment-script" depends="-check-jfx-deployment-launch" if="do-jfx-deployment-script">
  1427. <antcall target="jfx-deployment-script"/>
  1428. </target>
  1429. <target name="-do-jfx-deployment-noscript" depends="-check-jfx-deployment-launch" if="do-jfx-deployment-noscript">
  1430. <antcall target="jfx-deployment-noscript"/>
  1431. </target>
  1432. <target name="jfx-deployment-script" depends="-check-jfx-deployment,-check-project,
  1433. -swing-api-warning,-icon-warning,
  1434. -set-dimensions,-reset-dimensions,-set-update-mode-background,-set-update-mode-eager,
  1435. -set-permissions-elevated,-reset-permissions-elevated,
  1436. -copy-external-preloader-jar,-copy-binary-css,
  1437. -deploy-app-sign-nopreloader-notemplate,
  1438. -deploy-app-sign-preloader-notemplate,
  1439. -deploy-app-sign-nopreloader-template,
  1440. -deploy-app-sign-preloader-template,
  1441. -deploy-app-sign-nopreloader-notemplate-swing,
  1442. -deploy-app-sign-nopreloader-template-swing,
  1443. -deploy-app-sign-blob-nopreloader-notemplate,
  1444. -deploy-app-sign-blob-preloader-notemplate,
  1445. -deploy-app-sign-blob-nopreloader-template,
  1446. -deploy-app-sign-blob-preloader-template,
  1447. -deploy-app-sign-blob-nopreloader-notemplate-swing,
  1448. -deploy-app-sign-blob-nopreloader-template-swing,
  1449. -deploy-app-nosign-nopreloader-notemplate,
  1450. -deploy-app-nosign-preloader-notemplate,
  1451. -deploy-app-nosign-nopreloader-template,
  1452. -deploy-app-nosign-preloader-template,
  1453. -deploy-app-nosign-nopreloader-notemplate-swing,
  1454. -deploy-app-nosign-nopreloader-template-swing"
  1455. if="jfx-deployment-available">
  1456. </target>
  1457. <target name="jfx-deployment-noscript" depends="-check-jfx-deployment,-check-project,
  1458. -swing-api-warning,-icon-warning,
  1459. -set-dimensions,-reset-dimensions,-set-update-mode-background,-set-update-mode-eager,
  1460. -set-permissions-elevated,-reset-permissions-elevated,
  1461. -copy-external-preloader-jar,-copy-binary-css,
  1462. -fallback-deploy-app-sign-nopreloader-notemplate,
  1463. -fallback-deploy-app-sign-preloader-notemplate,
  1464. -fallback-deploy-app-sign-nopreloader-template,
  1465. -fallback-deploy-app-sign-preloader-template,
  1466. -fallback-deploy-app-sign-nopreloader-notemplate-swing,
  1467. -fallback-deploy-app-sign-nopreloader-template-swing,
  1468. -fallback-deploy-app-sign-blob-nopreloader-notemplate,
  1469. -fallback-deploy-app-sign-blob-preloader-notemplate,
  1470. -fallback-deploy-app-sign-blob-nopreloader-template,
  1471. -fallback-deploy-app-sign-blob-preloader-template,
  1472. -fallback-deploy-app-sign-blob-nopreloader-notemplate-swing,
  1473. -fallback-deploy-app-sign-blob-nopreloader-template-swing,
  1474. -fallback-deploy-app-nosign-nopreloader-notemplate,
  1475. -fallback-deploy-app-nosign-preloader-notemplate,
  1476. -fallback-deploy-app-nosign-nopreloader-template,
  1477. -fallback-deploy-app-nosign-preloader-template,
  1478. -fallback-deploy-app-nosign-nopreloader-notemplate-swing,
  1479. -fallback-deploy-app-nosign-nopreloader-template-swing"
  1480. if="jfx-deployment-available">
  1481. </target>
  1482. <!-- Security / Signing -->
  1483. <target name="-unavailable-signjars-task" depends="-check-jfx-deployment" unless="jfx-deployment-available">
  1484. <echo message="Warning: Task required to sign JAR file is missing, check the availability of JavaFX 2.0 deployment tasks. JAR files will not be signed."/>
  1485. </target>
  1486. <target name="-security-props-check">
  1487. <condition property="javafx.signed.true">
  1488. <istrue value="${javafx.signing.enabled}"/>
  1489. </condition>
  1490. </target>
  1491. <target name="-check-signing-possible" depends="-security-props-check,-check-jfx-deployment,-unavailable-signjars-task">
  1492. <condition property="javafx.signed.true+signjars.task.available">
  1493. <and>
  1494. <isset property="javafx.signed.true"/>
  1495. <isset property="jfx-deployment-available"/>
  1496. </and>
  1497. </condition>
  1498. </target>
  1499. <target name="-javafx-init-keystore" depends="-check-signing-possible,-javafx-init-signing,-javafx-init-keystore1,-javafx-init-keystore2,-check-keystore-exists"
  1500. if="javafx.signed.true+signjars.task.available" unless="do.not.init.keystore">
  1501. <property name="javafx.signjar.vendor" value="CN=${application.vendor}"/>
  1502. <echo message="Going to create default keystore in ${javafx.signjar.keystore}"/>
  1503. <genkey dname="${javafx.signjar.vendor}" alias="${javafx.signjar.alias}" keystore="${javafx.signjar.keystore}"
  1504. storepass="${javafx.signjar.storepass}" keypass="${javafx.signjar.keypass}"/>
  1505. </target>
  1506. <target name="-check-keystore-exists" depends="-security-props-check">
  1507. <available property="javafx.signjar.keystore.exists" file="${javafx.signjar.keystore}"/>
  1508. <condition property="do.not.init.keystore">
  1509. <or>
  1510. <not><isset property="javafx.signed.true"/></not>
  1511. <isset property="javafx.signjar.keystore.exists"/>
  1512. </or>
  1513. </condition>
  1514. </target>
  1515. <target name="-javafx-init-signing">
  1516. <condition property="generated.key.signing">
  1517. <equals arg1="${javafx.signing.type}" arg2="self" trim="true"/>
  1518. </condition>
  1519. </target>
  1520. <target name="-javafx-init-keystore1" depends="-javafx-init-signing" if="generated.key.signing">
  1521. <property name="javafx.signjar.keystore" value="${basedir}${file.separator}build${file.separator}nb-jfx.jks" />
  1522. <property name="javafx.signjar.storepass" value="storepass"/>
  1523. <property name="javafx.signjar.keypass" value="keypass"/>
  1524. <property name="javafx.signjar.alias" value="nb-jfx"/>
  1525. </target>
  1526. <target name="-javafx-init-keystore2" depends="-javafx-init-signing" unless="generated.key.signing">
  1527. <property name="javafx.signjar.keystore" value="${javafx.signing.keystore}" />
  1528. <property name="javafx.signjar.storepass" value="${javafx.signing.keystore.password}"/>
  1529. <property name="javafx.signjar.keypass" value="${javafx.signing.keyalias.password}"/>
  1530. <property name="javafx.signjar.alias" value="${javafx.signing.keyalias}"/>
  1531. </target>
  1532. <target name="-check-signing-security" depends="-security-props-check">
  1533. <condition property="is.signing.unsafe">
  1534. <or>
  1535. <not><isset property="javafx.signed.true"/></not>
  1536. <not><equals arg1="${javafx.signing.type}" arg2="key" casesensitive="false" trim="true"/></not>
  1537. </or>
  1538. </condition>
  1539. </target>
  1540. <target name="-warn-insufficient-signing" depends="-check-signing-security" if="is.signing.unsafe">
  1541. <echo message="Warning: Unsigned and self-signed WebStart Applications and Applets are deprecated from JDK7u21 onwards due to security reasons.${line.separator} To ensure future correct functionality please sign WebStart Applications and Applets using trusted certificate."/>
  1542. </target>
  1543. <!-- Project Deployment Macros -->
  1544. <macrodef name="deploy-defines">
  1545. <sequential>
  1546. <basename property="jfx.deployment.jar" file="${dist.jar}"/>
  1547. <property name="jfx.deployment.dir" location="${dist.dir}"/>
  1548. </sequential>
  1549. </macrodef>
  1550. <macrodef name="deploy-preprocess">
  1551. <sequential>
  1552. <delete includeEmptyDirs="true" quiet="true">
  1553. <fileset dir="${jfx.deployment.dir}${file.separator}lib">
  1554. <exclude name="**${file.separator}*.jar"/>
  1555. </fileset>
  1556. </delete>
  1557. </sequential>
  1558. </macrodef>
  1559. <!-- fx:jar scripted call enables passing of arbitrarily long list of params and fx-version dependent behavior -->
  1560. <macrodef name="deploy-jar">
  1561. <sequential>
  1562. <antcall target="-pre-jfx-jar"/>
  1563. <echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
  1564. <typedef name="fx_jar" classname="com.sun.javafx.tools.ant.FXJar" classpath="${javafx.ant.classpath}"/>
  1565. <echo message="Launching &lt;fx:jar&gt; task from ${ant-javafx.jar.location}" level="info"/>
  1566. <property name="pp_jar_destfile" value="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}"/>
  1567. <property name="pp_jar_buildclasses" value="${basedir}${file.separator}${build.classes.dir}"/>
  1568. <property name="pp_jar_cssbss" value="**${file.separator}*.${css-exclude-ext}"/>
  1569. <property name="pp_jar_dir" value="${jfx.deployment.dir}"/>
  1570. <property name="pp_jar_fs1" value="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1571. <property name="pp_jar_fs2" value="lib${file.separator}*.jar"/>
  1572. <echo message="deploy_jar: pp_jar_destfile = ${pp_jar_destfile}" level="verbose"/>
  1573. <echo message="deploy_jar: pp_jar_buildclasses = ${pp_jar_buildclasses}" level="verbose"/>
  1574. <echo message="deploy_jar: pp_jar_cssbss = ${pp_jar_cssbss}" level="verbose"/>
  1575. <echo message="deploy_jar: pp_jar_dir = ${pp_jar_dir}" level="verbose"/>
  1576. <echo message="deploy_jar: pp_jar_fs1 = ${pp_jar_fs1}" level="verbose"/>
  1577. <echo message="deploy_jar: pp_jar_fs2 = ${pp_jar_fs2}" level="verbose"/>
  1578. <echo message="JavaScript: deploy-jar" level="verbose"/>
  1579. <script language="javascript">
  1580. <![CDATA[
  1581. function isTrue(prop) {
  1582. return prop != null &&
  1583. ( prop.toLowerCase() == "true" || prop.toLowerCase() == "yes" || prop.toLowerCase() == "on" );
  1584. }
  1585. function prefix(s, len) {
  1586. if(s == null || len <= 0 || s.length == 0) {
  1587. return new String("");
  1588. }
  1589. return new String(s.substr(0, len));
  1590. }
  1591. function replaceSuffix(s, os, ns) {
  1592. return prefix(s, s.indexOf(os)).concat(ns);
  1593. }
  1594. function startsWith(s, prefix) {
  1595. return (s != null) && (s.indexOf(prefix) == 0);
  1596. }
  1597. function endsWith(s, suffix) {
  1598. var i = s.lastIndexOf(suffix);
  1599. return (i != -1) && (i == (s.length - suffix.length));
  1600. }
  1601. function defined(s) {
  1602. return (s != null) && (s != "null") && (s.length > 0);
  1603. }
  1604. function contains(array, prop) {
  1605. for (var i = 0; i < array.length; i++) {
  1606. var s1 = new String(array[i]);
  1607. var s2 = new String(prop);
  1608. if( s1.toLowerCase() == s2.toLowerCase() ) {
  1609. return true;
  1610. }
  1611. }
  1612. return false;
  1613. }
  1614. var S = new String(java.io.File.separator);
  1615. var JFXPAR = "javafx.param";
  1616. var JFXMAN = "javafx.manifest.entry";
  1617. var JFXPARN = "name";
  1618. var JFXPARV = "value";
  1619. var JFXPARH = "hidden";
  1620. var JFXLAZY = "download.mode.lazy.jar";
  1621. var withpreloader = new String(project.getProperty("app-with-preloader"));
  1622. var fx_ant_api_1_1 = new String(project.getProperty("have-fx-ant-api-1.1"));
  1623. var fx_ant_api_1_2 = new String(project.getProperty("have-fx-ant-api-1.2"));
  1624. var fx_in_swing_app = new String(project.getProperty("fx-in-swing-app"));
  1625. // get jars with lazy download mode property set
  1626. function getLazyJars() {
  1627. var jars = new Array();
  1628. var keys = project.getProperties().keys();
  1629. while(keys.hasMoreElements()) {
  1630. var pn = new String(keys.nextElement());
  1631. if(startsWith(pn, JFXLAZY)) {
  1632. var fname = new String(pn.substring(JFXLAZY.length+1));
  1633. jars.push(fname);
  1634. }
  1635. }
  1636. return jars.length > 0 ? jars : null;
  1637. }
  1638. // set download mode of dependent libraries
  1639. function setDownloadMode(fsEager, fsLazy, jars) {
  1640. for(var i = 0; i < jars.length; i++) {
  1641. fsEager.setExcludes("lib" + S + jars[i]);
  1642. fsLazy.setIncludes("lib" + S + jars[i]);
  1643. }
  1644. }
  1645. // fx:jar
  1646. var jar = project.createTask("fx_jar");
  1647. jar.setProject(project);
  1648. var destfile = new String(project.getProperty("pp_jar_destfile"));
  1649. jar.setDestfile(destfile);
  1650. // fx:application
  1651. var app = jar.createApplication();
  1652. app.setProject(project);
  1653. var title = new String(project.getProperty("application.title"));
  1654. var mainclass;
  1655. if(isTrue(fx_in_swing_app) && isTrue(fx_ant_api_1_2)) {
  1656. mainclass = new String(project.getProperty("main.class"));
  1657. app.setToolkit("swing");
  1658. } else {
  1659. mainclass = new String(project.getProperty("javafx.main.class"));
  1660. }
  1661. var fallback = new String(project.getProperty("javafx.fallback.class"));
  1662. app.setName(title);
  1663. app.setMainClass(mainclass);
  1664. app.setFallbackClass(fallback);
  1665. if(isTrue(withpreloader)) {
  1666. preloaderclass = new String(project.getProperty("javafx.preloader.class"));
  1667. app.setPreloaderClass(preloaderclass);
  1668. }
  1669. var appversion = new String(project.getProperty("javafx.application.implementation.version"));
  1670. if(defined(appversion)) {
  1671. app.setVersion(appversion);
  1672. } else {
  1673. app.setVersion("1.0");
  1674. }
  1675. // fx:param, fx:argument
  1676. var searchHides = project.getProperties().keys();
  1677. var hides = new Array();
  1678. while(searchHides.hasMoreElements()) {
  1679. // collect all hidden property names
  1680. var pns = new String(searchHides.nextElement());
  1681. if(startsWith(pns, JFXPAR) && endsWith(pns, JFXPARN)) {
  1682. var propns = new String(project.getProperty(pns));
  1683. var phs = replaceSuffix(pns, JFXPARN, JFXPARH);
  1684. var proph = new String(project.getProperty(phs));
  1685. if(isTrue(proph)) {
  1686. hides.push(propns);
  1687. }
  1688. }
  1689. }
  1690. var keys = project.getProperties().keys();
  1691. while(keys.hasMoreElements()) {
  1692. var pn = new String(keys.nextElement());
  1693. if(startsWith(pn, JFXPAR) && endsWith(pn, JFXPARN)) {
  1694. var propn = new String(project.getProperty(pn));
  1695. if(defined(propn) && !contains(hides, propn)) {
  1696. var pv = replaceSuffix(pn, JFXPARN, JFXPARV);
  1697. var propv = new String(project.getProperty(pv));
  1698. if(defined(propv)) {
  1699. var par = app.createParam();
  1700. par.setName(propn);
  1701. par.setValue(propv);
  1702. } else {
  1703. if(isTrue(fx_ant_api_1_1)) {
  1704. var arg = app.createArgument();
  1705. arg.addText(propn);
  1706. } else {
  1707. print("Warning: Unnamed parameters not supported by this version of JavaFX SDK deployment Ant tasks. Upgrade JavaFX to 2.0.2 or higher.");
  1708. }
  1709. }
  1710. }
  1711. }
  1712. }
  1713. // fx:resources
  1714. var res = jar.createResources();
  1715. res.setProject(project);
  1716. var pdir = new String(project.getProperty("pp_jar_dir"));
  1717. if(isTrue(withpreloader)) {
  1718. var f1 = res.createFileSet();
  1719. f1.setProject(project);
  1720. f1.setDir(new java.io.File(pdir));
  1721. var i1 = new String(project.getProperty("pp_jar_fs1"));
  1722. f1.setIncludes(i1);
  1723. f1.setRequiredFor("preloader");
  1724. var f2 = res.createFileSet();
  1725. f2.setProject(project);
  1726. f2.setDir(new java.io.File(pdir));
  1727. var i2b = new String(project.getProperty("pp_jar_fs2"));
  1728. var e2c = new String(project.getProperty("pp_jar_fs1"));
  1729. f2.setIncludes(i2b);
  1730. f2.setExcludes(e2c);
  1731. f2.setRequiredFor("startup");
  1732. var lazyjars = getLazyJars();
  1733. if(lazyjars != null) {
  1734. var f3 = res.createFileSet();
  1735. f3.setProject(project);
  1736. f3.setDir(new java.io.File(pdir));
  1737. f3.setRequiredFor("runtime");
  1738. setDownloadMode(f2,f3,lazyjars);
  1739. }
  1740. } else {
  1741. var fn = res.createFileSet();
  1742. fn.setProject(project);
  1743. fn.setDir(new java.io.File(pdir));
  1744. var ib = new String(project.getProperty("pp_jar_fs2"));
  1745. fn.setIncludes(ib);
  1746. fn.setRequiredFor("startup");
  1747. var lazyjars = getLazyJars();
  1748. if(lazyjars != null) {
  1749. var fn2 = res.createFileSet();
  1750. fn2.setProject(project);
  1751. fn2.setDir(new java.io.File(pdir));
  1752. fn2.setRequiredFor("runtime");
  1753. setDownloadMode(fn,fn2,lazyjars);
  1754. }
  1755. }
  1756. // fileset to exclude *.css or *.bss
  1757. var fs = jar.createFileSet();
  1758. fs.setProject(project);
  1759. var buildcls = new String(project.getProperty("pp_jar_buildclasses"));
  1760. var exc = new String(project.getProperty("pp_jar_cssbss"));
  1761. fs.setDir(new java.io.File(buildcls));
  1762. fs.setExcludes(exc);
  1763. // manifest
  1764. var man = jar.createManifest();
  1765. var userManifestPath = project.getProperty("manifest.file");
  1766. if (userManifestPath) {
  1767. var userManifestFile = project.resolveFile(userManifestPath);
  1768. if (userManifestFile.isFile()) {
  1769. var manifestEncoding = project.getProperty("manifest.encoding");
  1770. var userManifestReader = manifestEncoding ?
  1771. new java.io.InputStreamReader(
  1772. new java.io.FileInputStream(userManifestFile),
  1773. manifestEncoding) :
  1774. new java.io.InputStreamReader(
  1775. new java.io.FileInputStream(userManifestFile));
  1776. try {
  1777. var userManifest = new org.apache.tools.ant.taskdefs.Manifest(userManifestReader);
  1778. man.merge(userManifest);
  1779. } finally {
  1780. userManifestReader.close();
  1781. }
  1782. }
  1783. }
  1784. var a1val = new String(project.getProperty("application.vendor"));
  1785. var a1 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1786. a1.setName("Implementation-Vendor");
  1787. a1.setValue(a1val);
  1788. man.addConfiguredAttribute(a1);
  1789. var a2val = new String(project.getProperty("application.title"));
  1790. var a2 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1791. a2.setName("Implementation-Title");
  1792. a2.setValue(a2val);
  1793. man.addConfiguredAttribute(a2);
  1794. if(defined(appversion)) {
  1795. var a3 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1796. a3.setName("Implementation-Version");
  1797. a3.setValue(appversion);
  1798. man.addConfiguredAttribute(a3);
  1799. }
  1800. var a4prop = new String(project.getProperty("javafx.deploy.disable.proxy"));
  1801. if(isTrue(a4prop)) {
  1802. var a4 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1803. a4.setName("JavaFX-Feature-Proxy");
  1804. a4.setValue("None");
  1805. man.addConfiguredAttribute(a4);
  1806. }
  1807. // custom manifest entries
  1808. var searchManifestHides = project.getProperties().keys();
  1809. var manifestHides = new Array();
  1810. while(searchManifestHides.hasMoreElements()) {
  1811. // collect all hidden property names
  1812. var pns = new String(searchManifestHides.nextElement());
  1813. if(startsWith(pns, JFXMAN) && endsWith(pns, JFXPARN)) {
  1814. var propns = new String(project.getProperty(pns));
  1815. var phs = replaceSuffix(pns, JFXPARN, JFXPARH);
  1816. var proph = new String(project.getProperty(phs));
  1817. if(isTrue(proph)) {
  1818. manifestHides.push(propns);
  1819. }
  1820. }
  1821. }
  1822. var manifestKeys = project.getProperties().keys();
  1823. while(manifestKeys.hasMoreElements()) {
  1824. var pn = new String(manifestKeys.nextElement());
  1825. if(startsWith(pn, JFXMAN) && endsWith(pn, JFXPARN)) {
  1826. var propn = new String(project.getProperty(pn));
  1827. if(defined(propn) && !contains(manifestHides, propn)) {
  1828. var propnr = propn.replace(/\s/g, "-");
  1829. var entry = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1830. entry.setName(propnr);
  1831. var pv = replaceSuffix(pn, JFXPARN, JFXPARV);
  1832. var propv = new String(project.getProperty(pv));
  1833. if(defined(propv)) {
  1834. entry.setValue(propv);
  1835. } else {
  1836. entry.setValue("");
  1837. }
  1838. man.addConfiguredAttribute(entry);
  1839. }
  1840. }
  1841. }
  1842. var profileAvailable = new String(project.getProperty("profile.available"));
  1843. if (defined(profileAvailable)) {
  1844. var profileAttribute = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1845. profileAttribute.setName("Profile");
  1846. profileAttribute.setValue(new String(project.getProperty("javac.profile")));
  1847. man.addConfiguredAttribute(profileAttribute);
  1848. }
  1849. var perm_elev = new String(project.getProperty("permissions.elevated"));
  1850. var cust_perm = new String(project.getProperty("manifest.custom.permissions"));
  1851. var cust_cb = new String(project.getProperty("manifest.custom.codebase"));
  1852. var sa1 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1853. sa1.setName("Codebase");
  1854. if(!defined(cust_cb) || cust_cb == "*") {
  1855. sa1.setValue("*");
  1856. print("Warning: From JDK7u25 the Codebase manifest attribute should be used to restrict JAR repurposing.");
  1857. print(" Please set manifest.custom.codebase property to override the current default non-secure value '*'.");
  1858. } else {
  1859. sa1.setValue(cust_cb);
  1860. }
  1861. man.addConfiguredAttribute(sa1);
  1862. var sa2 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
  1863. sa2.setName("Permissions");
  1864. if(!defined(cust_perm)) {
  1865. if(isTrue(perm_elev)) {
  1866. sa2.setValue("all-permissions");
  1867. } else {
  1868. sa2.setValue("sandbox");
  1869. }
  1870. } else {
  1871. if(cust_perm == "all-permissions") {
  1872. sa2.setValue("all-permissions");
  1873. } else {
  1874. sa2.setValue("sandbox");
  1875. }
  1876. }
  1877. man.addConfiguredAttribute(sa2);
  1878. // Note: see JavaFX Jira issue #RT-25003 if attribute names are created lowercase in manifest
  1879. jar.perform();
  1880. ]]>
  1881. </script>
  1882. <antcall target="-post-jfx-jar"/>
  1883. </sequential>
  1884. </macrodef>
  1885. <macrodef name="deploy-sign">
  1886. <sequential>
  1887. <echo message="keystore=${javafx.signjar.keystore}" level="verbose"/>
  1888. <echo message="storepass=${javafx.signjar.storepass}" level="verbose"/>
  1889. <echo message="alias=${javafx.signjar.alias}" level="verbose"/>
  1890. <echo message="keypass=${javafx.signjar.keypass}" level="verbose"/>
  1891. <signjar keystore="${javafx.signjar.keystore}"
  1892. storepass="${javafx.signjar.storepass}"
  1893. alias="${javafx.signjar.alias}"
  1894. keypass="${javafx.signjar.keypass}">
  1895. <fileset dir="${jfx.deployment.dir}">
  1896. <include name="${jfx.deployment.jar}"/>
  1897. <include name="lib${file.separator}*.jar"/>
  1898. </fileset>
  1899. </signjar>
  1900. </sequential>
  1901. </macrodef>
  1902. <macrodef name="deploy-sign-blob">
  1903. <sequential>
  1904. <echo message="keystore=${javafx.signjar.keystore}" level="verbose"/>
  1905. <echo message="storepass=${javafx.signjar.storepass}" level="verbose"/>
  1906. <echo message="alias=${javafx.signjar.alias}" level="verbose"/>
  1907. <echo message="keypass=${javafx.signjar.keypass}" level="verbose"/>
  1908. <echo message="Launching &lt;fx:signjar&gt; task from ${ant-javafx.jar.location}" level="info"/>
  1909. <fx:signjar keystore="${javafx.signjar.keystore}"
  1910. storepass="${javafx.signjar.storepass}"
  1911. alias="${javafx.signjar.alias}"
  1912. keypass="${javafx.signjar.keypass}">
  1913. <fileset dir="${jfx.deployment.dir}">
  1914. <include name="${jfx.deployment.jar}"/>
  1915. <include name="lib${file.separator}*.jar"/>
  1916. </fileset>
  1917. </fx:signjar>
  1918. </sequential>
  1919. </macrodef>
  1920. <macrodef name="deploy-sign-preloader">
  1921. <sequential>
  1922. <echo message="keystore=${javafx.signjar.keystore}" level="verbose"/>
  1923. <echo message="storepass=${javafx.signjar.storepass}" level="verbose"/>
  1924. <echo message="alias=${javafx.signjar.alias}" level="verbose"/>
  1925. <echo message="keypass=${javafx.signjar.keypass}" level="verbose"/>
  1926. <signjar keystore="${javafx.signjar.keystore}"
  1927. storepass="${javafx.signjar.storepass}"
  1928. alias="${javafx.signjar.alias}"
  1929. keypass="${javafx.signjar.keypass}">
  1930. <fileset dir="${jfx.deployment.dir}">
  1931. <include name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1932. </fileset>
  1933. </signjar>
  1934. <signjar keystore="${javafx.signjar.keystore}"
  1935. storepass="${javafx.signjar.storepass}"
  1936. alias="${javafx.signjar.alias}"
  1937. keypass="${javafx.signjar.keypass}">
  1938. <fileset dir="${jfx.deployment.dir}">
  1939. <include name="${jfx.deployment.jar}"/>
  1940. <include name="lib${file.separator}*.jar"/>
  1941. <exclude name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1942. </fileset>
  1943. </signjar>
  1944. </sequential>
  1945. </macrodef>
  1946. <macrodef name="deploy-sign-blob-preloader">
  1947. <sequential>
  1948. <echo message="keystore=${javafx.signjar.keystore}" level="verbose"/>
  1949. <echo message="storepass=${javafx.signjar.storepass}" level="verbose"/>
  1950. <echo message="alias=${javafx.signjar.alias}" level="verbose"/>
  1951. <echo message="keypass=${javafx.signjar.keypass}" level="verbose"/>
  1952. <signjar keystore="${javafx.signjar.keystore}"
  1953. storepass="${javafx.signjar.storepass}"
  1954. alias="${javafx.signjar.alias}"
  1955. keypass="${javafx.signjar.keypass}">
  1956. <fileset dir="${jfx.deployment.dir}">
  1957. <include name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1958. </fileset>
  1959. </signjar>
  1960. <echo message="Launching &lt;fx:signjar&gt; task from ${ant-javafx.jar.location}" level="info"/>
  1961. <fx:signjar keystore="${javafx.signjar.keystore}"
  1962. storepass="${javafx.signjar.storepass}"
  1963. alias="${javafx.signjar.alias}"
  1964. keypass="${javafx.signjar.keypass}">
  1965. <fileset dir="${jfx.deployment.dir}">
  1966. <include name="${jfx.deployment.jar}"/>
  1967. <include name="lib${file.separator}*.jar"/>
  1968. <exclude name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1969. </fileset>
  1970. </fx:signjar>
  1971. </sequential>
  1972. </macrodef>
  1973. <macrodef name="deploy-process-template">
  1974. <sequential>
  1975. <echo message="javafx.run.htmltemplate = ${javafx.run.htmltemplate}" level="verbose"/>
  1976. <pathconvert property="javafx.run.htmltemplate.processed">
  1977. <path path="${javafx.run.htmltemplate}"/>
  1978. <mapper>
  1979. <chainedmapper>
  1980. <flattenmapper/>
  1981. <globmapper from="*" to="${jfx.deployment.dir}${file.separator}*" casesensitive="no"/>
  1982. </chainedmapper>
  1983. </mapper>
  1984. </pathconvert>
  1985. <echo message="javafx.run.htmltemplate.processed = ${javafx.run.htmltemplate.processed}" level="verbose"/>
  1986. </sequential>
  1987. </macrodef>
  1988. <!-- fx:deploy scripted call enables passing of arbitrarily long lists of params, vmoptions and callbacks and fx-version dependent behavior -->
  1989. <macrodef name="deploy-deploy">
  1990. <sequential>
  1991. <antcall target="-pre-jfx-deploy"/>
  1992. <antcall target="-call-pre-jfx-native"/>
  1993. <echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
  1994. <typedef name="fx_deploy" classname="com.sun.javafx.tools.ant.DeployFXTask" classpath="${javafx.ant.classpath}"/>
  1995. <echo message="Launching &lt;fx:deploy&gt; task from ${ant-javafx.jar.location}" level="info"/>
  1996. <property name="pp_deploy_dir" value="${jfx.deployment.dir}"/>
  1997. <property name="pp_deploy_fs1" value="lib${file.separator}${javafx.preloader.jar.filename}"/>
  1998. <property name="pp_deploy_fs2" value="lib${file.separator}*.jar"/>
  1999. <echo message="deploy_deploy: pp_deploy_dir = ${pp_deploy_dir}" level="verbose"/>
  2000. <echo message="deploy_deploy: pp_deploy_fs1 = ${pp_deploy_fs1}" level="verbose"/>
  2001. <echo message="deploy_deploy: pp_deploy_fs2 = ${pp_deploy_fs2}" level="verbose"/>
  2002. <echo message="JavaScript: deploy-deploy" level="verbose"/>
  2003. <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
  2004. <script language="javascript">
  2005. <![CDATA[
  2006. function isTrue(prop) {
  2007. return prop != null &&
  2008. (prop.toLowerCase()=="true" || prop.toLowerCase()=="yes" || prop.toLowerCase()=="on");
  2009. }
  2010. function prefix(s, len) {
  2011. if(s == null || len <= 0 || s.length == 0) {
  2012. return new String("");
  2013. }
  2014. return new String(s.substr(0, len));
  2015. }
  2016. function replaceSuffix(s, os, ns) {
  2017. return prefix(s, s.indexOf(os)).concat(ns);
  2018. }
  2019. function startsWith(s, prefix) {
  2020. return (s != null) && (s.indexOf(prefix) == 0);
  2021. }
  2022. function endsWith(s, suffix) {
  2023. var i = s.lastIndexOf(suffix);
  2024. return (i != -1) && (i == (s.length - suffix.length));
  2025. }
  2026. function defined(s) {
  2027. return (s != null) && (s != "null") && (s.length > 0);
  2028. }
  2029. function contains(array, prop) {
  2030. for (var i = 0; i < array.length; i++) {
  2031. var s1 = new String(array[i]);
  2032. var s2 = new String(prop);
  2033. if( s1.toLowerCase() == s2.toLowerCase() ) {
  2034. return true;
  2035. }
  2036. }
  2037. return false;
  2038. }
  2039. var S = java.io.File.separator;
  2040. var JFXPAR = "javafx.param";
  2041. var JFXPARN = "name";
  2042. var JFXPARV = "value";
  2043. var JFXPARH = "hidden";
  2044. var JFXCALLB = "javafx.jscallback";
  2045. var JFXLAZY = "download.mode.lazy.jar";
  2046. var withpreloader = new String(project.getProperty("app-with-preloader"));
  2047. var fx_ant_api_1_1 = new String(project.getProperty("have-fx-ant-api-1.1"));
  2048. var fx_ant_api_1_2 = new String(project.getProperty("have-fx-ant-api-1.2"));
  2049. var have_jdk_pre7u14 = new String(project.getProperty("have-jdk-pre7u14"));
  2050. var fx_in_swing_app = new String(project.getProperty("fx-in-swing-app"));
  2051. var debug_in_browser = new String(project.getProperty("project.state.debugging.in.browser"));
  2052. // get jars with lazy download mode property set
  2053. function getLazyJars() {
  2054. var jars = new Array();
  2055. var keys = project.getProperties().keys();
  2056. while(keys.hasMoreElements()) {
  2057. var pn = new String(keys.nextElement());
  2058. if(startsWith(pn, JFXLAZY)) {
  2059. var fname = pn.substring(JFXLAZY.length+1);
  2060. jars.push(fname);
  2061. }
  2062. }
  2063. return jars.length > 0 ? jars : null;
  2064. }
  2065. // set download mode of dependent libraries
  2066. function setDownloadMode(fsEager, fsLazy, jars) {
  2067. for(var i = 0; i < jars.length; i++) {
  2068. fsEager.setExcludes("lib" + S + jars[i]);
  2069. fsLazy.setIncludes("lib" + S + jars[i]);
  2070. }
  2071. }
  2072. // convert path to absolute if relative
  2073. function derelativizePath(path) {
  2074. var f = new java.io.File(path);
  2075. if(!f.exists()) {
  2076. f = new java.io.File(new String(project.getBaseDir()) + S + path);
  2077. }
  2078. if(f.exists()) {
  2079. try {
  2080. return f.getCanonicalPath();
  2081. } catch(err) {
  2082. return path;
  2083. }
  2084. }
  2085. return path;
  2086. }
  2087. // fx:deploy
  2088. var deploy = project.createTask("fx_deploy");
  2089. deploy.setProject(project);
  2090. var width = new String(project.getProperty("javafx.width"));
  2091. var height = new String(project.getProperty("javafx.height"));
  2092. var outdir = new String(project.getProperty("jfx.deployment.dir"));
  2093. var embedJNLP = new String(project.getProperty("javafx.deploy.embedJNLP"));
  2094. var updatemode = new String(project.getProperty("update-mode"));
  2095. var outfile = new String(project.getProperty("application.title"));
  2096. var includeDT = new String(project.getProperty("javafx.deploy.includeDT"));
  2097. var offline = new String(project.getProperty("javafx.deploy.allowoffline"));
  2098. if (width.indexOf("%") != -1) {
  2099. deploy.setEmbeddedWidth(width);
  2100. deploy.setWidth(800);
  2101. } else {
  2102. deploy.setWidth(width);
  2103. }
  2104. if (height.indexOf("%") != -1) {
  2105. deploy.setEmbeddedHeight(height);
  2106. deploy.setHeight(600);
  2107. } else {
  2108. deploy.setHeight(height);
  2109. }
  2110. deploy.setOutdir(outdir);
  2111. deploy.setEmbedJNLP(isTrue(embedJNLP));
  2112. deploy.setUpdateMode(updatemode);
  2113. deploy.setOutfile(outfile);
  2114. deploy.setIncludeDT(isTrue(includeDT));
  2115. if(defined(offline)) {
  2116. if(isTrue(fx_ant_api_1_1)) {
  2117. deploy.setOfflineAllowed(isTrue(offline));
  2118. } else {
  2119. print("Warning: offlineAllowed not supported by this version of JavaFX SDK deployment Ant task. Please upgrade JavaFX to 2.0.2 or higher.");
  2120. }
  2121. }
  2122. // native packaging (time consuming, thus applied in explicit build only)
  2123. var nativeEnabled = new String(project.getProperty("do.build.native.package"));
  2124. var nativeType = new String(project.getProperty("javafx.native.bundling.type"));
  2125. var projStateRun = new String(project.getProperty("project.state.running"));
  2126. var projStateDbg = new String(project.getProperty("project.state.debugging"));
  2127. var projStatePrf = new String(project.getProperty("project.state.profiling"));
  2128. if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
  2129. if(!isTrue(projStateRun) && !isTrue(projStateDbg) && !isTrue(projStatePrf)) {
  2130. if(isTrue(fx_ant_api_1_2)) {
  2131. deploy.setNativeBundles(nativeType);
  2132. print("Note: To create native bundles the <fx:deploy> task may require external tools. See JavaFX 2.2+ documentation for details.");
  2133. print("");
  2134. print("Launching <fx:deploy> in native packager mode...");
  2135. } else {
  2136. print("Warning: Native packaging is not supported by this version of JavaFX SDK deployment Ant task. Please upgrade to JDK 7u6 or higher.");
  2137. }
  2138. }
  2139. }
  2140. // fx:application
  2141. var app = deploy.createApplication();
  2142. app.setProject(project);
  2143. var title = new String(project.getProperty("application.title"));
  2144. var mainclass;
  2145. if(isTrue(fx_in_swing_app) && isTrue(fx_ant_api_1_2)) {
  2146. mainclass = new String(project.getProperty("main.class"));
  2147. app.setToolkit("swing");
  2148. } else {
  2149. mainclass = new String(project.getProperty("javafx.main.class"));
  2150. }
  2151. var fallback = new String(project.getProperty("javafx.fallback.class"));
  2152. app.setName(title);
  2153. app.setMainClass(mainclass);
  2154. app.setFallbackClass(fallback);
  2155. if(isTrue(withpreloader)) {
  2156. preloaderclass = new String(project.getProperty("javafx.preloader.class"));
  2157. app.setPreloaderClass(preloaderclass);
  2158. }
  2159. var appversion = new String(project.getProperty("javafx.application.implementation.version"));
  2160. if(defined(appversion)) {
  2161. app.setVersion(appversion);
  2162. } else {
  2163. app.setVersion("1.0");
  2164. }
  2165. // fx:param, fx:argument
  2166. var searchHides = project.getProperties().keys();
  2167. var hides = new Array();
  2168. while(searchHides.hasMoreElements()) {
  2169. // collect all hidden property names
  2170. var pns = new String(searchHides.nextElement());
  2171. if(startsWith(pns, JFXPAR) && endsWith(pns, JFXPARN)) {
  2172. var propns = new String(project.getProperty(pns));
  2173. var phs = replaceSuffix(pns, JFXPARN, JFXPARH);
  2174. var proph = new String(project.getProperty(phs));
  2175. if(isTrue(proph)) {
  2176. hides.push(propns);
  2177. }
  2178. }
  2179. }
  2180. var keys = project.getProperties().keys();
  2181. while(keys.hasMoreElements()) {
  2182. var pn = new String(keys.nextElement());
  2183. if(startsWith(pn, JFXPAR) && endsWith(pn, JFXPARN)) {
  2184. var propn = new String(project.getProperty(pn));
  2185. if(defined(propn) && !contains(hides, propn)) {
  2186. var pv = replaceSuffix(pn, JFXPARN, JFXPARV);
  2187. var propv = new String(project.getProperty(pv));
  2188. if(defined(propv)) {
  2189. var par = app.createParam();
  2190. par.setName(propn);
  2191. par.setValue(propv);
  2192. } else {
  2193. if(isTrue(fx_ant_api_1_1)) {
  2194. var arg = app.createArgument();
  2195. arg.addText(propn);
  2196. } else {
  2197. print("Warning: Unnamed parameters not supported by this version of JavaFX SDK deployment Ant tasks. Upgrade JavaFX to 2.0.2 or higher.");
  2198. }
  2199. }
  2200. }
  2201. }
  2202. }
  2203. // fx:resources
  2204. var res = deploy.createResources();
  2205. res.setProject(project);
  2206. var deploydir = new String(project.getProperty("pp_deploy_dir"));
  2207. if(isTrue(withpreloader)) {
  2208. var f1 = res.createFileSet();
  2209. f1.setProject(project);
  2210. f1.setDir(new java.io.File(deploydir));
  2211. var i1 = new String(project.getProperty("pp_deploy_fs1"));
  2212. f1.setIncludes(i1);
  2213. f1.setRequiredFor("preloader");
  2214. var f2 = res.createFileSet();
  2215. f2.setProject(project);
  2216. f2.setDir(new java.io.File(deploydir));
  2217. var i2a = new String(project.getProperty("jfx.deployment.jar"));
  2218. var i2b = new String(project.getProperty("pp_deploy_fs2"));
  2219. var e2c = new String(project.getProperty("pp_deploy_fs1"));
  2220. f2.setIncludes(i2a);
  2221. f2.setIncludes(i2b);
  2222. f2.setExcludes(e2c);
  2223. f2.setRequiredFor("startup");
  2224. var lazyjars = getLazyJars();
  2225. if(lazyjars != null) {
  2226. var f3 = res.createFileSet();
  2227. f3.setProject(project);
  2228. f3.setDir(new java.io.File(deploydir));
  2229. f3.setRequiredFor("runtime");
  2230. setDownloadMode(f2,f3,lazyjars);
  2231. }
  2232. } else {
  2233. var fn = res.createFileSet();
  2234. fn.setProject(project);
  2235. fn.setDir(new java.io.File(deploydir));
  2236. var ia = new String(project.getProperty("jfx.deployment.jar"));
  2237. var ib = new String(project.getProperty("pp_deploy_fs2"));
  2238. fn.setIncludes(ia);
  2239. fn.setIncludes(ib);
  2240. fn.setRequiredFor("startup");
  2241. var lazyjars = getLazyJars();
  2242. if(lazyjars != null) {
  2243. var fn2 = res.createFileSet();
  2244. fn2.setProject(project);
  2245. fn2.setDir(new java.io.File(deploydir));
  2246. fn2.setRequiredFor("runtime");
  2247. setDownloadMode(fn,fn2,lazyjars);
  2248. }
  2249. }
  2250. // fx:info
  2251. var info = deploy.createInfo();
  2252. info.setProject(project);
  2253. var vendor = new String(project.getProperty("application.vendor"));
  2254. var description = new String(project.getProperty("application.desc"));
  2255. info.setTitle(title); // title known from before
  2256. info.setVendor(vendor);
  2257. info.setDescription(description);
  2258. var splash = new String(project.getProperty("javafx.deploy.splash"));
  2259. if(defined(splash)) {
  2260. if(isTrue(fx_ant_api_1_1)) {
  2261. var sicon = info.createSplash();
  2262. sicon.setHref(splash);
  2263. sicon.setMode("any");
  2264. print("Adding splash image reference: " + splash);
  2265. } else {
  2266. print("Warning: Splash Image not supported by this version of JavaFX SDK deployment Ant task. Please upgrade JavaFX to 2.0.2 or higher.");
  2267. }
  2268. }
  2269. if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
  2270. var icon = new String(project.getProperty("javafx.deploy.icon.native"));
  2271. if(defined(icon)) {
  2272. if(isTrue(fx_ant_api_1_2) && !isTrue(have_jdk_pre7u14)) {
  2273. var dicon = derelativizePath(icon);
  2274. // create temporary icon copy renamed to application name (required by native packager)
  2275. var baseDir = new String(project.getProperty("basedir"));
  2276. var buildDir = new String(project.getProperty("build.dir"));
  2277. var deployBase = new String(project.getProperty("jfx.deployment.base"));
  2278. var copyTask = project.createTask("copy");
  2279. var source = new java.io.File(dicon);
  2280. var sourceName = new String(source.getName());
  2281. var lastDot = sourceName.lastIndexOf(".");
  2282. var sourceExt;
  2283. if(lastDot >=0) {
  2284. sourceExt = sourceName.substr(lastDot);
  2285. } else {
  2286. sourceExt = new String("");
  2287. }
  2288. var target = new java.io.File(baseDir.concat(S).concat(buildDir).concat(S).concat("icon").concat(S).concat(deployBase).concat(sourceExt));
  2289. copyTask.setFile(source);
  2290. copyTask.setTofile(target);
  2291. copyTask.setFlatten(true);
  2292. copyTask.setFailOnError(false);
  2293. copyTask.perform();
  2294. var tempicon;
  2295. if(target.exists()) {
  2296. try {
  2297. tempicon = target.getCanonicalPath();
  2298. } catch(err) {
  2299. tempicon = dicon;
  2300. }
  2301. } else {
  2302. tempicon = dicon;
  2303. }
  2304. var nicon = info.createIcon();
  2305. nicon.setHref(tempicon);
  2306. print("Source native icon reference: " + dicon);
  2307. print("Processed native icon reference: " + tempicon);
  2308. } else {
  2309. print("Warning: Native Package icon not supported by this version of JavaFX SDK deployment Ant task. Please upgrade to JDK7u14.");
  2310. }
  2311. }
  2312. } else {
  2313. var icon = new String(project.getProperty("javafx.deploy.icon"));
  2314. if(defined(icon)) {
  2315. if(isTrue(fx_ant_api_1_1)) {
  2316. var iicon = info.createIcon();
  2317. iicon.setHref(icon);
  2318. print("Adding WebStart icon reference: " + icon);
  2319. } else {
  2320. print("Warning: WebStart Icon not supported by this version of JavaFX SDK deployment Ant task. Please upgrade JavaFX to 2.0.2 or higher.");
  2321. }
  2322. }
  2323. }
  2324. // fx:permissions
  2325. var perm = deploy.createPermissions();
  2326. perm.setProject(project);
  2327. var elev = new String(project.getProperty("permissions.elevated"));
  2328. perm.setElevated(isTrue(elev));
  2329. // fx:preferences
  2330. var pref = deploy.createPreferences();
  2331. pref.setProject(project);
  2332. var scut = new String(project.getProperty("javafx.deploy.adddesktopshortcut"));
  2333. var instp = new String(project.getProperty("javafx.deploy.installpermanently"));
  2334. var smenu = new String(project.getProperty("javafx.deploy.addstartmenushortcut"));
  2335. pref.setShortcut(isTrue(scut));
  2336. pref.setInstall(isTrue(instp));
  2337. pref.setMenu(isTrue(smenu));
  2338. // fx:template
  2339. var templ = new String(project.getProperty("javafx.run.htmltemplate"));
  2340. var templp = new String(project.getProperty("javafx.run.htmltemplate.processed"));
  2341. if(defined(templ) && defined(templp)) {
  2342. var temp = deploy.createTemplate();
  2343. temp.setProject(project);
  2344. temp.setFile(new java.io.File(templ));
  2345. temp.setTofile(new java.io.File(templp));
  2346. }
  2347. // fx:platform
  2348. var plat = deploy.createPlatform();
  2349. plat.setProject(project);
  2350. var requestRT = new String(project.getProperty("javafx.deploy.request.runtime"));
  2351. if(defined(requestRT)) {
  2352. plat.setJavafx(requestRT);
  2353. }
  2354. var jvmargs = new String(project.getProperty("run.jvmargs"));
  2355. if(defined(jvmargs)) {
  2356. var jvmargss = jvmargs.split(" ");
  2357. for(var i = 0; i < jvmargss.length; i++) {
  2358. if(defined(jvmargss[i])) {
  2359. var vmarg = plat.createJvmarg();
  2360. vmarg.setValue(jvmargss[i]);
  2361. }
  2362. }
  2363. }
  2364. if(isTrue(debug_in_browser)) {
  2365. var vmarg = plat.createJvmarg();
  2366. vmarg.setValue(new String("-ea:javafx.browserdebug"));
  2367. }
  2368. if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
  2369. if(!isTrue(projStateRun) && !isTrue(projStateDbg) && !isTrue(projStatePrf)) {
  2370. if(plat.setBasedir) {
  2371. var sdkdir = new String(project.getProperty("javafx.sdk"));
  2372. if(defined(sdkdir)) {
  2373. plat.setBasedir(sdkdir);
  2374. }
  2375. } else {
  2376. print("Note: the current version of native packager Ant task can bundle the default JRE only.");
  2377. }
  2378. }
  2379. }
  2380. // fx:callbacks
  2381. var callbs = deploy.createCallbacks();
  2382. callbs.setProject(project);
  2383. var keys = project.getProperties().keys();
  2384. while(keys.hasMoreElements()) {
  2385. var pn = new String(keys.nextElement());
  2386. if(startsWith(pn, JFXCALLB)) {
  2387. var prop = new String(project.getProperty(pn));
  2388. if(defined(prop)) {
  2389. var cname = pn.substring(JFXCALLB.length+1);
  2390. var cb = callbs.createCallback();
  2391. cb.setProject(project);
  2392. cb.setName(cname);
  2393. cb.addText(prop);
  2394. }
  2395. }
  2396. }
  2397. deploy.perform();
  2398. ]]>
  2399. </script>
  2400. <antcall target="-post-jfx-deploy"/>
  2401. <antcall target="-call-post-jfx-native"/>
  2402. </sequential>
  2403. </macrodef>
  2404. <!-- JavaFX SDK 2.0.x and 2.1.x deploy task can not generate pre-FX jnlp which is needed for FX-in-Swing projects-->
  2405. <macrodef name="deploy-deploy-swing">
  2406. <sequential>
  2407. <antcall target="-pre-jfx-deploy"/>
  2408. <local name="permissions-elevated-token"/>
  2409. <condition property="permissions-elevated-token" value="${line.separator} &lt;security&gt;${line.separator} &lt;all-permissions/&gt;${line.separator} &lt;/security&gt;" else="">
  2410. <isset property="permissions-elevated"/>
  2411. </condition>
  2412. <local name="offline-allowed-token"/>
  2413. <condition property="offline-allowed-token" value="${line.separator} &lt;offline-allowed/&gt;" else="">
  2414. <isset property="offline-allowed"/>
  2415. </condition>
  2416. <local name="update-mode-background-token"/>
  2417. <condition property="update-mode-background-token" value="background" else="always">
  2418. <isset property="update-mode-background"/>
  2419. </condition>
  2420. <local name="html-template-processed-available"/>
  2421. <condition property="html-template-processed-available">
  2422. <and>
  2423. <isset property="javafx.run.htmltemplate.processed"/>
  2424. <not>
  2425. <equals arg1="${javafx.run.htmltemplate.processed}" arg2=""/>
  2426. </not>
  2427. </and>
  2428. </condition>
  2429. <local name="javafx.deploy.icon.basename"/>
  2430. <basename property="javafx.deploy.icon.basename" file="${javafx.deploy.icon}"/>
  2431. <local name="local-icon-filename-available"/>
  2432. <condition property="local-icon-filename-available">
  2433. <and>
  2434. <isset property="icon-available"/>
  2435. <isset property="javafx.deploy.icon.basename"/>
  2436. <not><equals arg1="${javafx.deploy.icon.basename}" arg2=""/></not>
  2437. <not><contains string="${javafx.deploy.icon.basename}" substring="$${javafx" casesensitive="false"/></not>
  2438. <not><contains string="${javafx.deploy.icon}" substring="http:" casesensitive="false"/></not>
  2439. </and>
  2440. </condition>
  2441. <local name="icon-token"/>
  2442. <condition property="icon-token" value="${line.separator} &lt;icon href=&quot;${javafx.deploy.icon.basename}&quot; kind=&quot;default&quot;/&gt;">
  2443. <isset property="local-icon-filename-available"/>
  2444. </condition>
  2445. <condition property="icon-token" value="${line.separator} &lt;icon href=&quot;${javafx.deploy.icon}&quot; kind=&quot;default&quot;/&gt;" else="">
  2446. <isset property="icon-available"/>
  2447. </condition>
  2448. <basename property="dist.filename" file="${dist.jar}" suffix=".jar"/>
  2449. <length file="${dist.jar}" property="dist.jar.size" />
  2450. <local name="vmargs-token"/>
  2451. <condition property="vmargs-token" value="java-vm-args=&quot;${run.jvmargs}&quot; " else="">
  2452. <isset property="vmargs-available"/>
  2453. </condition>
  2454. <local name="applet-params-token"/>
  2455. <local name="application-args-token"/>
  2456. <echo message="JavaScript: deploy-deploy-swing 1" level="verbose"/>
  2457. <script language="javascript">
  2458. <![CDATA[
  2459. function prefix(s, len) {
  2460. if(s == null || len <= 0 || s.length == 0) {
  2461. return new String("");
  2462. }
  2463. return new String(s.substr(0, len));
  2464. }
  2465. function replaceSuffix(s, os, ns) {
  2466. return prefix(s, s.indexOf(os)).concat(ns);
  2467. }
  2468. function startsWith(s, prefix) {
  2469. return (s != null) && (s.indexOf(prefix) == 0);
  2470. }
  2471. function endsWith(s, suffix) {
  2472. var i = s.lastIndexOf(suffix);
  2473. return (i != -1) && (i == (s.length - suffix.length));
  2474. }
  2475. function defined(s) {
  2476. return (s != null) && (s != "null") && (s.length > 0);
  2477. }
  2478. var JFXPAR = "javafx.param";
  2479. var JFXPARN = "name";
  2480. var JFXPARV = "value";
  2481. var params = new java.lang.StringBuilder();
  2482. var args = new java.lang.StringBuilder();
  2483. var keys = project.getProperties().keys();
  2484. while(keys.hasMoreElements()) {
  2485. var pn = new String(keys.nextElement());
  2486. if(startsWith(pn, JFXPAR) && endsWith(pn, JFXPARN)) {
  2487. var propn = new String(project.getProperty(pn));
  2488. if(defined(propn)) {
  2489. var pv = replaceSuffix(pn, JFXPARN, JFXPARV);
  2490. var propv = new String(project.getProperty(pv));
  2491. if(defined(propv)) {
  2492. params.append("\n <param name=\"");
  2493. params.append(propn);
  2494. params.append("\" value=\"");
  2495. params.append(propv);
  2496. params.append("\"/>");
  2497. args.append("\n <argument>");
  2498. args.append(propn);
  2499. args.append("=");
  2500. args.append(propv);
  2501. args.append("</argument>");
  2502. } else {
  2503. params.append("\n <param name=\"");
  2504. params.append(propn);
  2505. params.append("\" value=\"\"/>");
  2506. args.append("\n <argument>");
  2507. args.append(propn);
  2508. args.append("</argument>");
  2509. }
  2510. }
  2511. }
  2512. }
  2513. project.setProperty("applet-params-token", new String(params.toString()));
  2514. project.setProperty("application-args-token", new String(args.toString()));
  2515. ]]>
  2516. </script>
  2517. <local name="application.desc.processed"/>
  2518. <condition property="application.desc.processed" value="${application.desc}" else="Swing applet embedding JavaFX components.">
  2519. <isset property="application.desc"/>
  2520. </condition>
  2521. <filterchain id="jnlp.template.filter">
  2522. <replacetokens>
  2523. <token key="NAME" value="${dist.filename}"/>
  2524. <token key="MAINCLASS" value="${main.class}"/>
  2525. <token key="FILESIZE" value="${dist.jar.size}"/>
  2526. <token key="VENDOR" value="${application.vendor}"/>
  2527. <token key="TITLE" value="${application.title}"/>
  2528. <token key="DESCRIPTION" value="${application.desc.processed}"/>
  2529. <token key="WIDTH" value="${javafx.run.width}"/>
  2530. <token key="HEIGHT" value="${javafx.run.height}"/>
  2531. <token key="PERMISSIONS" value="${permissions-elevated-token}"/>
  2532. <token key="OFFLINE" value="${offline-allowed-token}"/>
  2533. <token key="UPDATEMODE" value="${update-mode-background-token}"/>
  2534. <token key="ICON" value="${icon-token}"/>
  2535. <token key="VMARGS" value="${vmargs-token}"/>
  2536. <token key="PARAMETERS" value="${applet-params-token}"/>
  2537. <token key="ARGUMENTS" value="${application-args-token}"/>
  2538. </replacetokens>
  2539. </filterchain>
  2540. <copy file="${basedir}${file.separator}nbproject${file.separator}templates${file.separator}FXSwingTemplateApplication.jnlp"
  2541. tofile="${dist.dir}${file.separator}${dist.filename}_application.jnlp" >
  2542. <filterchain refid="jnlp.template.filter"/>
  2543. </copy>
  2544. <copy file="${basedir}${file.separator}nbproject${file.separator}templates${file.separator}FXSwingTemplateApplet.jnlp"
  2545. tofile="${dist.dir}${file.separator}${dist.filename}_applet.jnlp" >
  2546. <filterchain refid="jnlp.template.filter"/>
  2547. </copy>
  2548. <copy file="${basedir}${file.separator}nbproject${file.separator}templates${file.separator}FXSwingTemplate.html"
  2549. tofile="${dist.dir}${file.separator}${dist.filename}.html" >
  2550. <filterchain refid="jnlp.template.filter"/>
  2551. </copy>
  2552. <echo message="JavaScript: deploy-deploy-swing 2" level="verbose"/>
  2553. <script language="javascript">
  2554. <![CDATA[
  2555. function startsWith(s, prefix) {
  2556. return (s != null) && (s.indexOf(prefix) == 0);
  2557. }
  2558. function defined(s) {
  2559. return (s != null) && (s != "null") && (s.length > 0);
  2560. }
  2561. var PREF = "file:";
  2562. var doCopyIcon = new String(project.getProperty("local-icon-filename-available"));
  2563. if(defined(doCopyIcon)) {
  2564. var iconProp = new String(project.getProperty("javafx.deploy.icon"));
  2565. if(startsWith(iconProp, PREF)) {
  2566. iconProp = iconProp.slice(PREF.length);
  2567. }
  2568. while(iconProp.charAt(0) == "/") {
  2569. iconProp = iconProp.slice(1);
  2570. }
  2571. var S = java.io.File.separator;
  2572. var baseDir = new String(project.getProperty("basedir"));
  2573. var distDir = new String(project.getProperty("dist.dir"));
  2574. var copyTask = new String(project.createTask("copy"));
  2575. var source = new java.io.File(iconProp);
  2576. var target = new java.io.File(baseDir.concat(S).concat(distDir));
  2577. copyTask.setFile(source);
  2578. copyTask.setTodir(target);
  2579. copyTask.setFlatten(true);
  2580. copyTask.setFailOnError(false);
  2581. copyTask.perform();
  2582. }
  2583. var doCopyHTMLFrom = new String(project.getProperty("html-template-available"));
  2584. var doCopyHTMLTo = new String(project.getProperty("html-template-processed-available"));
  2585. if(defined(doCopyHTMLFrom) && defined(doCopyHTMLTo)) {
  2586. var htmlFrom = new String(project.getProperty("javafx.run.htmltemplate"));
  2587. if(startsWith(htmlFrom, PREF)) {
  2588. htmlFrom = htmlFrom.slice(PREF.length);
  2589. }
  2590. while(startsWith(htmlFrom, "/")) {
  2591. htmlFrom = htmlFrom.slice(1);
  2592. }
  2593. var htmlTo = new String(project.getProperty("javafx.run.htmltemplate.processed"));
  2594. if(startsWith(htmlTo, PREF)) {
  2595. htmlTo = htmlTo.slice(PREF.length);
  2596. }
  2597. while(startsWith(htmlTo, "/")) {
  2598. htmlTo = htmlTo.slice(1);
  2599. }
  2600. var copyTask = project.createTask("copy");
  2601. var source = new java.io.File(htmlFrom);
  2602. var target = new java.io.File(htmlTo);
  2603. copyTask.setFile(source);
  2604. copyTask.setTofile(target);
  2605. copyTask.setFailOnError(false);
  2606. copyTask.perform();
  2607. }
  2608. ]]>
  2609. </script>
  2610. <antcall target="-post-jfx-deploy"/>
  2611. </sequential>
  2612. </macrodef>
  2613. <!-- Fallback Project Deployment Macros To Support At Least Partially JDKs Without JavaScript Support -->
  2614. <macrodef name="fallback-deploy-application-def">
  2615. <sequential>
  2616. <echo message="Warning: Parameters (if any) not passed to &lt;fx:application&gt; in fallback build mode due to JDK missing JavaScript support."/>
  2617. <fx:application id="fxApp"
  2618. name="${application.title}"
  2619. mainClass="${javafx.main.class}"
  2620. fallbackClass="${javafx.fallback.class}">
  2621. <!-- PARAMETERS NOT PASSED IN FALLBACK -->
  2622. </fx:application>
  2623. </sequential>
  2624. </macrodef>
  2625. <macrodef name="fallback-deploy-application-def-preloader">
  2626. <sequential>
  2627. <echo message="Warning: Parameters (if any) not passed to &lt;fx:application&gt; in fallback build mode due to JDK missing JavaScript support."/>
  2628. <fx:application id="fxApp"
  2629. name="${application.title}"
  2630. mainClass="${javafx.main.class}"
  2631. preloaderClass="${javafx.preloader.class}"
  2632. fallbackClass="${javafx.fallback.class}">
  2633. <!-- PARAMETERS NOT PASSED IN FALLBACK -->
  2634. </fx:application>
  2635. </sequential>
  2636. </macrodef>
  2637. <macrodef name="fallback-deploy-application-def-swing">
  2638. <sequential>
  2639. <echo message="Warning: Parameters (if any) not passed to &lt;fx:application&gt; in fallback build mode due to JDK missing JavaScript support."/>
  2640. <fx:application id="fxApp"
  2641. name="${application.title}"
  2642. mainClass="${main.class}"
  2643. fallbackClass="${javafx.fallback.class}"
  2644. toolkit="swing">
  2645. <!-- PARAMETERS NOT PASSED IN FALLBACK -->
  2646. </fx:application>
  2647. </sequential>
  2648. </macrodef>
  2649. <macrodef name="fallback-deploy-resources">
  2650. <sequential>
  2651. <fx:resources id="appRes">
  2652. <fx:fileset requiredFor="startup" dir="${jfx.deployment.dir}">
  2653. <include name="${jfx.deployment.jar}"/>
  2654. <include name="lib${file.separator}*.jar"/>
  2655. <exclude name="lib${file.separator}${jfx.deployment.jar}"/>
  2656. </fx:fileset>
  2657. </fx:resources>
  2658. </sequential>
  2659. </macrodef>
  2660. <macrodef name="fallback-deploy-resources-preloader">
  2661. <sequential>
  2662. <fx:resources id="appRes">
  2663. <fx:fileset requiredFor="preloader" dir="${jfx.deployment.dir}">
  2664. <include name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  2665. </fx:fileset>
  2666. <fx:fileset requiredFor="startup" dir="${jfx.deployment.dir}">
  2667. <include name="${jfx.deployment.jar}"/>
  2668. <include name="lib${file.separator}*.jar"/>
  2669. <exclude name="lib${file.separator}${javafx.preloader.jar.filename}"/>
  2670. <exclude name="lib${file.separator}${jfx.deployment.jar}"/>
  2671. </fx:fileset>
  2672. </fx:resources>
  2673. </sequential>
  2674. </macrodef>
  2675. <macrodef name="fallback-deploy-jar">
  2676. <sequential>
  2677. <antcall target="-pre-jfx-jar"/>
  2678. <fx:jar destfile="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}">
  2679. <fx:application refid="fxApp"/>
  2680. <fx:resources refid="appRes"/>
  2681. <fileset dir="${build.classes.dir}">
  2682. <exclude name="**${file.separator}*.${css-exclude-ext}"/>
  2683. </fileset>
  2684. <manifest>
  2685. <attribute name="Implementation-Vendor" value="${application.vendor}"/>
  2686. <attribute name="Implementation-Title" value="${application.title}"/>
  2687. <attribute name="Implementation-Version" value="1.0"/>
  2688. </manifest>
  2689. </fx:jar>
  2690. <antcall target="-post-jfx-jar"/>
  2691. </sequential>
  2692. </macrodef>
  2693. <macrodef name="fallback-deploy-deploy">
  2694. <sequential>
  2695. <antcall target="-pre-jfx-deploy"/>
  2696. <echo message="Warning: JVM Arguments and Callbacks (if any) not passed to &lt;fx:deploy&gt; in fallback build mode due to JDK missing JavaScript support."/>
  2697. <fx:deploy width="${javafx.width}" height="${javafx.height}"
  2698. outdir="${jfx.deployment.dir}" embedjnlp="true" updatemode="${update-mode}"
  2699. outfile="${application.title}" includeDT="${javafx.deploy.includeDT}">
  2700. <fx:application refid="fxApp"/>
  2701. <fx:resources refid="appRes"/>
  2702. <fx:info title="${application.title}" vendor="${application.vendor}"/>
  2703. <fx:permissions elevated="${permissions.elevated}"/>
  2704. <fx:preferences shortcut="${javafx.deploy.adddesktopshortcut}" install="${javafx.deploy.installpermanently}" menu="${javafx.deploy.addstartmenushortcut}"/>
  2705. <!-- PLATFORM NOT PASSED IN FALLBACK -->
  2706. <!-- CALLBACKS NOT PASSED IN FALLBACK -->
  2707. </fx:deploy>
  2708. <antcall target="-post-jfx-deploy"/>
  2709. </sequential>
  2710. </macrodef>
  2711. <macrodef name="fallback-deploy-deploy-template">
  2712. <sequential>
  2713. <antcall target="-pre-jfx-deploy"/>
  2714. <echo message="Warning: JVM Arguments and Callbacks (if any) not passed to &lt;fx:deploy&gt; in fallback build mode due to JDK missing JavaScript support."/>
  2715. <deploy-process-template/>
  2716. <fx:deploy width="${javafx.width}" height="${javafx.height}"
  2717. outdir="${jfx.deployment.dir}" embedjnlp="true" updatemode="${update-mode}"
  2718. outfile="${application.title}" includeDT="${javafx.deploy.includeDT}">
  2719. <fx:application refid="fxApp"/>
  2720. <fx:resources refid="appRes"/>
  2721. <fx:info title="${application.title}" vendor="${application.vendor}"/>
  2722. <fx:permissions elevated="${permissions.elevated}"/>
  2723. <fx:preferences shortcut="${javafx.deploy.adddesktopshortcut}" install="${javafx.deploy.installpermanently}" menu="${javafx.deploy.addstartmenushortcut}"/>
  2724. <fx:template file="${javafx.run.htmltemplate}" tofile="${javafx.run.htmltemplate.processed}"/>
  2725. <!-- PLATFORM NOT PASSED IN FALLBACK -->
  2726. <!-- CALLBACKS NOT PASSED IN FALLBACK -->
  2727. </fx:deploy>
  2728. <antcall target="-post-jfx-deploy"/>
  2729. </sequential>
  2730. </macrodef>
  2731. <!-- Project Deployment Targets -->
  2732. <target name="-check-sign" depends="-check-project,-javafx-init-keystore" if="javafx.signed.true+signjars.task.available">
  2733. <condition property="sign-nopreloader-notemplate">
  2734. <and>
  2735. <isset property="app-without-preloader"/>
  2736. <not><isset property="html-template-available"/></not>
  2737. <not><isset property="fx-in-swing-app-workaround"/></not>
  2738. <not><isset property="use-blob-signing"/></not>
  2739. </and>
  2740. </condition>
  2741. <condition property="sign-preloader-notemplate">
  2742. <and>
  2743. <isset property="app-with-preloader"/>
  2744. <not><isset property="html-template-available"/></not>
  2745. <not><isset property="fx-in-swing-app-workaround"/></not>
  2746. <not><isset property="use-blob-signing"/></not>
  2747. </and>
  2748. </condition>
  2749. <condition property="sign-nopreloader-template">
  2750. <and>
  2751. <isset property="app-without-preloader"/>
  2752. <isset property="html-template-available"/>
  2753. <not><isset property="fx-in-swing-app-workaround"/></not>
  2754. <not><isset property="use-blob-signing"/></not>
  2755. </and>
  2756. </condition>
  2757. <condition property="sign-preloader-template">
  2758. <and>
  2759. <isset property="app-with-preloader"/>
  2760. <isset property="html-template-available"/>
  2761. <not><isset property="fx-in-swing-app-workaround"/></not>
  2762. <not><isset property="use-blob-signing"/></not>
  2763. </and>
  2764. </condition>
  2765. <condition property="sign-nopreloader-notemplate-swing">
  2766. <and>
  2767. <isset property="app-without-preloader"/>
  2768. <not><isset property="html-template-available"/></not>
  2769. <isset property="fx-in-swing-app-workaround"/>
  2770. <not><isset property="use-blob-signing"/></not>
  2771. </and>
  2772. </condition>
  2773. <condition property="sign-nopreloader-template-swing">
  2774. <and>
  2775. <isset property="app-without-preloader"/>
  2776. <isset property="html-template-available"/>
  2777. <isset property="fx-in-swing-app-workaround"/>
  2778. <not><isset property="use-blob-signing"/></not>
  2779. </and>
  2780. </condition>
  2781. <condition property="sign-blob-nopreloader-notemplate">
  2782. <and>
  2783. <isset property="app-without-preloader"/>
  2784. <not><isset property="html-template-available"/></not>
  2785. <not><isset property="fx-in-swing-app-workaround"/></not>
  2786. <isset property="use-blob-signing"/>
  2787. </and>
  2788. </condition>
  2789. <condition property="sign-blob-preloader-notemplate">
  2790. <and>
  2791. <isset property="app-with-preloader"/>
  2792. <not><isset property="html-template-available"/></not>
  2793. <not><isset property="fx-in-swing-app-workaround"/></not>
  2794. <isset property="use-blob-signing"/>
  2795. </and>
  2796. </condition>
  2797. <condition property="sign-blob-nopreloader-template">
  2798. <and>
  2799. <isset property="app-without-preloader"/>
  2800. <isset property="html-template-available"/>
  2801. <not><isset property="fx-in-swing-app-workaround"/></not>
  2802. <isset property="use-blob-signing"/>
  2803. </and>
  2804. </condition>
  2805. <condition property="sign-blob-preloader-template">
  2806. <and>
  2807. <isset property="app-with-preloader"/>
  2808. <isset property="html-template-available"/>
  2809. <not><isset property="fx-in-swing-app-workaround"/></not>
  2810. <isset property="use-blob-signing"/>
  2811. </and>
  2812. </condition>
  2813. <condition property="sign-blob-nopreloader-notemplate-swing">
  2814. <and>
  2815. <isset property="app-without-preloader"/>
  2816. <not><isset property="html-template-available"/></not>
  2817. <isset property="fx-in-swing-app-workaround"/>
  2818. <isset property="use-blob-signing"/>
  2819. </and>
  2820. </condition>
  2821. <condition property="sign-blob-nopreloader-template-swing">
  2822. <and>
  2823. <isset property="app-without-preloader"/>
  2824. <isset property="html-template-available"/>
  2825. <isset property="fx-in-swing-app-workaround"/>
  2826. <isset property="use-blob-signing"/>
  2827. </and>
  2828. </condition>
  2829. </target>
  2830. <target name="-check-nosign" depends="-check-project">
  2831. <condition property="nosign-nopreloader-notemplate">
  2832. <and>
  2833. <isset property="app-without-preloader"/>
  2834. <not><isset property="html-template-available"/></not>
  2835. <not><isset property="javafx.signed.true"/></not>
  2836. <not><isset property="fx-in-swing-app-workaround"/></not>
  2837. </and>
  2838. </condition>
  2839. <condition property="nosign-preloader-notemplate">
  2840. <and>
  2841. <isset property="app-with-preloader"/>
  2842. <not><isset property="html-template-available"/></not>
  2843. <not><isset property="javafx.signed.true"/></not>
  2844. <not><isset property="fx-in-swing-app-workaround"/></not>
  2845. </and>
  2846. </condition>
  2847. <condition property="nosign-nopreloader-template">
  2848. <and>
  2849. <isset property="app-without-preloader"/>
  2850. <isset property="html-template-available"/>
  2851. <not><isset property="javafx.signed.true"/></not>
  2852. <not><isset property="fx-in-swing-app-workaround"/></not>
  2853. </and>
  2854. </condition>
  2855. <condition property="nosign-preloader-template">
  2856. <and>
  2857. <isset property="app-with-preloader"/>
  2858. <isset property="html-template-available"/>
  2859. <not><isset property="javafx.signed.true"/></not>
  2860. <not><isset property="fx-in-swing-app-workaround"/></not>
  2861. </and>
  2862. </condition>
  2863. <condition property="nosign-nopreloader-notemplate-swing">
  2864. <and>
  2865. <isset property="app-without-preloader"/>
  2866. <not><isset property="html-template-available"/></not>
  2867. <not><isset property="javafx.signed.true"/></not>
  2868. <isset property="fx-in-swing-app-workaround"/>
  2869. </and>
  2870. </condition>
  2871. <condition property="nosign-nopreloader-template-swing">
  2872. <and>
  2873. <isset property="app-without-preloader"/>
  2874. <isset property="html-template-available"/>
  2875. <not><isset property="javafx.signed.true"/></not>
  2876. <isset property="fx-in-swing-app-workaround"/>
  2877. </and>
  2878. </condition>
  2879. </target>
  2880. <!-- WITH SIGNING -->
  2881. <!-- project without preloader -->
  2882. <!-- no html template -->
  2883. <target name="-deploy-app-sign-nopreloader-notemplate" depends="-check-sign" if="sign-nopreloader-notemplate" unless="preloader-app">
  2884. <echo message="-deploy-app-sign-nopreloader-notemplate" level="verbose"/>
  2885. <deploy-defines/>
  2886. <deploy-preprocess/>
  2887. <deploy-jar/>
  2888. <deploy-sign/>
  2889. <deploy-deploy/>
  2890. </target>
  2891. <target name="-deploy-app-sign-blob-nopreloader-notemplate" depends="-check-sign" if="sign-blob-nopreloader-notemplate" unless="preloader-app">
  2892. <echo message="-deploy-app-sign-blob-nopreloader-notemplate" level="verbose"/>
  2893. <deploy-defines/>
  2894. <deploy-preprocess/>
  2895. <deploy-jar/>
  2896. <deploy-sign-blob/>
  2897. <deploy-deploy/>
  2898. </target>
  2899. <!-- project with preloader -->
  2900. <!-- no html template -->
  2901. <target name="-deploy-app-sign-preloader-notemplate" depends="-check-sign" if="sign-preloader-notemplate" unless="preloader-app">
  2902. <echo message="-deploy-app-sign-preloader-notemplate" level="verbose"/>
  2903. <deploy-defines/>
  2904. <deploy-preprocess/>
  2905. <deploy-jar/>
  2906. <deploy-sign-preloader/>
  2907. <deploy-deploy/>
  2908. </target>
  2909. <target name="-deploy-app-sign-blob-preloader-notemplate" depends="-check-sign" if="sign-blob-preloader-notemplate" unless="preloader-app">
  2910. <echo message="-deploy-app-sign-blob-preloader-notemplate" level="verbose"/>
  2911. <deploy-defines/>
  2912. <deploy-preprocess/>
  2913. <deploy-jar/>
  2914. <deploy-sign-blob-preloader/>
  2915. <deploy-deploy/>
  2916. </target>
  2917. <!-- project without preloader -->
  2918. <!-- html template -->
  2919. <target name="-deploy-app-sign-nopreloader-template" depends="-check-sign" if="sign-nopreloader-template" unless="preloader-app">
  2920. <echo message="-deploy-app-sign-nopreloader-template" level="verbose"/>
  2921. <deploy-defines/>
  2922. <deploy-preprocess/>
  2923. <deploy-jar/>
  2924. <deploy-sign/>
  2925. <deploy-process-template/>
  2926. <deploy-deploy/>
  2927. </target>
  2928. <target name="-deploy-app-sign-blob-nopreloader-template" depends="-check-sign" if="sign-blob-nopreloader-template" unless="preloader-app">
  2929. <echo message="-deploy-app-sign-blob-nopreloader-template" level="verbose"/>
  2930. <deploy-defines/>
  2931. <deploy-preprocess/>
  2932. <deploy-jar/>
  2933. <deploy-sign-blob/>
  2934. <deploy-process-template/>
  2935. <deploy-deploy/>
  2936. </target>
  2937. <!-- project with preloader -->
  2938. <!-- html template -->
  2939. <target name="-deploy-app-sign-preloader-template" depends="-check-sign" if="sign-preloader-template" unless="preloader-app">
  2940. <echo message="-deploy-app-sign-preloader-template" level="verbose"/>
  2941. <deploy-defines/>
  2942. <deploy-preprocess/>
  2943. <deploy-jar/>
  2944. <deploy-sign-preloader/>
  2945. <deploy-process-template/>
  2946. <deploy-deploy/>
  2947. </target>
  2948. <target name="-deploy-app-sign-blob-preloader-template" depends="-check-sign" if="sign-blob-preloader-template" unless="preloader-app">
  2949. <echo message="-deploy-app-sign-blob-preloader-template" level="verbose"/>
  2950. <deploy-defines/>
  2951. <deploy-preprocess/>
  2952. <deploy-jar/>
  2953. <deploy-sign-blob-preloader/>
  2954. <deploy-process-template/>
  2955. <deploy-deploy/>
  2956. </target>
  2957. <!-- project without preloader -->
  2958. <!-- no html template -->
  2959. <!-- FX in Swing app -->
  2960. <target name="-deploy-app-sign-nopreloader-notemplate-swing" depends="-check-sign" if="sign-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  2961. <echo message="-deploy-app-sign-nopreloader-notemplate-swing" level="verbose"/>
  2962. <deploy-defines/>
  2963. <deploy-preprocess/>
  2964. <deploy-jar/>
  2965. <deploy-sign/>
  2966. <deploy-deploy-swing/>
  2967. </target>
  2968. <target name="-deploy-app-sign-blob-nopreloader-notemplate-swing" depends="-check-sign" if="sign-blob-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  2969. <echo message="-deploy-app-sign-blob-nopreloader-notemplate-swing" level="verbose"/>
  2970. <deploy-defines/>
  2971. <deploy-preprocess/>
  2972. <deploy-jar/>
  2973. <deploy-sign-blob/>
  2974. <deploy-deploy-swing/>
  2975. </target>
  2976. <!-- project without preloader -->
  2977. <!-- html template -->
  2978. <!-- FX in Swing app -->
  2979. <target name="-deploy-app-sign-nopreloader-template-swing" depends="-check-sign" if="sign-nopreloader-template-swing" unless="preloader-app-no-workaround">
  2980. <echo message="-deploy-app-sign-nopreloader-template-swing" level="verbose"/>
  2981. <deploy-defines/>
  2982. <deploy-preprocess/>
  2983. <deploy-jar/>
  2984. <deploy-sign/>
  2985. <deploy-process-template/>
  2986. <deploy-deploy-swing/>
  2987. </target>
  2988. <target name="-deploy-app-sign-blob-nopreloader-template-swing" depends="-check-sign" if="sign-blob-nopreloader-template-swing" unless="preloader-app-no-workaround">
  2989. <echo message="-deploy-app-sign-blob-nopreloader-template-swing" level="verbose"/>
  2990. <deploy-defines/>
  2991. <deploy-preprocess/>
  2992. <deploy-jar/>
  2993. <deploy-sign-blob/>
  2994. <deploy-process-template/>
  2995. <deploy-deploy-swing/>
  2996. </target>
  2997. <!-- NO SIGNING -->
  2998. <!-- project without preloader -->
  2999. <!-- no html template -->
  3000. <target name="-deploy-app-nosign-nopreloader-notemplate" depends="-check-nosign" if="nosign-nopreloader-notemplate" unless="preloader-app">
  3001. <echo message="-deploy-app-nosign-nopreloader-notemplate" level="verbose"/>
  3002. <deploy-defines/>
  3003. <deploy-preprocess/>
  3004. <deploy-jar/>
  3005. <deploy-deploy/>
  3006. </target>
  3007. <!-- project with preloader -->
  3008. <!-- no html template -->
  3009. <target name="-deploy-app-nosign-preloader-notemplate" depends="-check-nosign" if="nosign-preloader-notemplate" unless="preloader-app">
  3010. <echo message="-deploy-app-nosign-preloader-notemplate" level="verbose"/>
  3011. <deploy-defines/>
  3012. <deploy-preprocess/>
  3013. <deploy-jar/>
  3014. <deploy-deploy/>
  3015. </target>
  3016. <!-- project without preloader -->
  3017. <!-- html template -->
  3018. <target name="-deploy-app-nosign-nopreloader-template" depends="-check-nosign" if="nosign-nopreloader-template" unless="preloader-app">
  3019. <echo message="-deploy-app-nosign-nopreloader-template" level="verbose"/>
  3020. <deploy-defines/>
  3021. <deploy-preprocess/>
  3022. <deploy-jar/>
  3023. <deploy-process-template/>
  3024. <deploy-deploy/>
  3025. </target>
  3026. <!-- project with preloader -->
  3027. <!-- html template -->
  3028. <target name="-deploy-app-nosign-preloader-template" depends="-check-nosign" if="nosign-preloader-template" unless="preloader-app">
  3029. <echo message="-deploy-app-nosign-preloader-template" level="verbose"/>
  3030. <deploy-defines/>
  3031. <deploy-preprocess/>
  3032. <deploy-jar/>
  3033. <deploy-process-template/>
  3034. <deploy-deploy/>
  3035. </target>
  3036. <!-- project without preloader -->
  3037. <!-- no html template -->
  3038. <!-- FX in Swing app -->
  3039. <target name="-deploy-app-nosign-nopreloader-notemplate-swing" depends="-check-nosign" if="nosign-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  3040. <echo message="-deploy-app-nosign-nopreloader-notemplate-swing" level="verbose"/>
  3041. <deploy-defines/>
  3042. <deploy-preprocess/>
  3043. <deploy-jar/>
  3044. <deploy-deploy-swing/>
  3045. </target>
  3046. <!-- project without preloader -->
  3047. <!-- html template -->
  3048. <!-- FX in Swing app -->
  3049. <target name="-deploy-app-nosign-nopreloader-template-swing" depends="-check-nosign" if="nosign-nopreloader-template-swing" unless="preloader-app-no-workaround">
  3050. <echo message="-deploy-app-nosign-nopreloader-template-swing" level="verbose"/>
  3051. <deploy-defines/>
  3052. <deploy-preprocess/>
  3053. <deploy-jar/>
  3054. <deploy-process-template/>
  3055. <deploy-deploy-swing/>
  3056. </target>
  3057. <!-- FALLBACK (NO JAVASCRIPT) TARGETS WITH SIGNING -->
  3058. <target name="-check-fallback-sign-deploy-swing-possible" depends="-check-sign">
  3059. <local name="fail-deploy-swing-possible"/>
  3060. <condition property="fail-deploy-swing-possible">
  3061. <and>
  3062. <or>
  3063. <isset property="sign-nopreloader-notemplate-swing"/>
  3064. <isset property="sign-nopreloader-template-swing"/>
  3065. </or>
  3066. <not><isset property="have-fx-ant-api-1.2"/></not>
  3067. </and>
  3068. </condition>
  3069. <fail message="Error: JavaFX SDK version 2.2 or newer is needed to deploy FX-in-Swing on JDK without JavaScript support."
  3070. if="fail-deploy-swing-possible"/>
  3071. </target>
  3072. <!-- FALLBACK project without preloader -->
  3073. <!-- FALLBACK no html template -->
  3074. <target name="-fallback-deploy-app-sign-nopreloader-notemplate" depends="-check-sign" if="sign-nopreloader-notemplate" unless="preloader-app">
  3075. <echo message="-fallback-deploy-app-sign-nopreloader-notemplate" level="verbose"/>
  3076. <deploy-defines/>
  3077. <deploy-preprocess/>
  3078. <fallback-deploy-application-def/>
  3079. <fallback-deploy-resources/>
  3080. <fallback-deploy-jar/>
  3081. <deploy-sign/>
  3082. <fallback-deploy-deploy/>
  3083. </target>
  3084. <target name="-fallback-deploy-app-sign-blob-nopreloader-notemplate" depends="-check-sign" if="sign-blob-nopreloader-notemplate" unless="preloader-app">
  3085. <echo message="-fallback-deploy-app-sign-blob-nopreloader-notemplate" level="verbose"/>
  3086. <deploy-defines/>
  3087. <deploy-preprocess/>
  3088. <fallback-deploy-application-def/>
  3089. <fallback-deploy-resources/>
  3090. <fallback-deploy-jar/>
  3091. <deploy-sign-blob/>
  3092. <fallback-deploy-deploy/>
  3093. </target>
  3094. <!-- FALLBACK project with preloader -->
  3095. <!-- FALLBACK no html template -->
  3096. <target name="-fallback-deploy-app-sign-preloader-notemplate" depends="-check-sign" if="sign-preloader-notemplate" unless="preloader-app">
  3097. <echo message="-fallback-deploy-app-sign-preloader-notemplate" level="verbose"/>
  3098. <deploy-defines/>
  3099. <deploy-preprocess/>
  3100. <fallback-deploy-application-def-preloader/>
  3101. <fallback-deploy-resources-preloader/>
  3102. <fallback-deploy-jar/>
  3103. <deploy-sign-preloader/>
  3104. <fallback-deploy-deploy/>
  3105. </target>
  3106. <target name="-fallback-deploy-app-sign-blob-preloader-notemplate" depends="-check-sign" if="sign-blob-preloader-notemplate" unless="preloader-app">
  3107. <echo message="-fallback-deploy-app-sign-blob-preloader-notemplate" level="verbose"/>
  3108. <deploy-defines/>
  3109. <deploy-preprocess/>
  3110. <fallback-deploy-application-def-preloader/>
  3111. <fallback-deploy-resources-preloader/>
  3112. <fallback-deploy-jar/>
  3113. <deploy-sign-blob-preloader/>
  3114. <fallback-deploy-deploy/>
  3115. </target>
  3116. <!-- FALLBACK project without preloader -->
  3117. <!-- FALLBACK html template -->
  3118. <target name="-fallback-deploy-app-sign-nopreloader-template" depends="-check-sign" if="sign-nopreloader-template" unless="preloader-app">
  3119. <echo message="-fallback-deploy-app-sign-nopreloader-template" level="verbose"/>
  3120. <deploy-defines/>
  3121. <deploy-preprocess/>
  3122. <fallback-deploy-application-def/>
  3123. <fallback-deploy-resources/>
  3124. <fallback-deploy-jar/>
  3125. <deploy-sign/>
  3126. <fallback-deploy-deploy-template/>
  3127. </target>
  3128. <target name="-fallback-deploy-app-sign-blob-nopreloader-template" depends="-check-sign" if="sign-blob-nopreloader-template" unless="preloader-app">
  3129. <echo message="-fallback-deploy-app-sign-blob-nopreloader-template" level="verbose"/>
  3130. <deploy-defines/>
  3131. <deploy-preprocess/>
  3132. <fallback-deploy-application-def/>
  3133. <fallback-deploy-resources/>
  3134. <fallback-deploy-jar/>
  3135. <deploy-sign-blob/>
  3136. <fallback-deploy-deploy-template/>
  3137. </target>
  3138. <!-- FALLBACK project with preloader -->
  3139. <!-- FALLBACK html template -->
  3140. <target name="-fallback-deploy-app-sign-preloader-template" depends="-check-sign" if="sign-preloader-template" unless="preloader-app">
  3141. <echo message="-fallback-deploy-app-sign-preloader-template" level="verbose"/>
  3142. <deploy-defines/>
  3143. <deploy-preprocess/>
  3144. <fallback-deploy-application-def-preloader/>
  3145. <fallback-deploy-resources-preloader/>
  3146. <fallback-deploy-jar/>
  3147. <deploy-sign-preloader/>
  3148. <fallback-deploy-deploy-template/>
  3149. </target>
  3150. <target name="-fallback-deploy-app-sign-blob-preloader-template" depends="-check-sign" if="sign-blob-preloader-template" unless="preloader-app">
  3151. <echo message="-fallback-deploy-app-sign-blob-preloader-template" level="verbose"/>
  3152. <deploy-defines/>
  3153. <deploy-preprocess/>
  3154. <fallback-deploy-application-def-preloader/>
  3155. <fallback-deploy-resources-preloader/>
  3156. <fallback-deploy-jar/>
  3157. <deploy-sign-blob-preloader/>
  3158. <fallback-deploy-deploy-template/>
  3159. </target>
  3160. <!-- FALLBACK project without preloader -->
  3161. <!-- FALLBACK no html template -->
  3162. <!-- FALLBACK FX in Swing app -->
  3163. <target name="-fallback-deploy-app-sign-nopreloader-notemplate-swing" depends="-check-fallback-sign-deploy-swing-possible" if="sign-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  3164. <echo message="-fallback-deploy-app-sign-nopreloader-notemplate-swing" level="verbose"/>
  3165. <deploy-defines/>
  3166. <deploy-preprocess/>
  3167. <fallback-deploy-application-def-swing/>
  3168. <fallback-deploy-resources/>
  3169. <fallback-deploy-jar/>
  3170. <deploy-sign/>
  3171. <fallback-deploy-deploy/>
  3172. </target>
  3173. <target name="-fallback-deploy-app-sign-blob-nopreloader-notemplate-swing" depends="-check-fallback-sign-deploy-swing-possible" if="sign-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  3174. <echo message="-fallback-deploy-app-sign-blob-nopreloader-notemplate-swing" level="verbose"/>
  3175. <deploy-defines/>
  3176. <deploy-preprocess/>
  3177. <fallback-deploy-application-def-swing/>
  3178. <fallback-deploy-resources/>
  3179. <fallback-deploy-jar/>
  3180. <deploy-sign-blob/>
  3181. <fallback-deploy-deploy/>
  3182. </target>
  3183. <!-- FALLBACK project without preloader -->
  3184. <!-- FALLBACK html template -->
  3185. <!-- FALLBACK FX in Swing app -->
  3186. <target name="-fallback-deploy-app-sign-nopreloader-template-swing" depends="-check-fallback-sign-deploy-swing-possible" if="sign-nopreloader-template-swing" unless="preloader-app-no-workaround">
  3187. <echo message="-fallback-deploy-app-sign-nopreloader-template-swing" level="verbose"/>
  3188. <deploy-defines/>
  3189. <deploy-preprocess/>
  3190. <fallback-deploy-application-def-swing/>
  3191. <fallback-deploy-resources/>
  3192. <fallback-deploy-jar/>
  3193. <deploy-sign/>
  3194. <fallback-deploy-deploy-template/>
  3195. </target>
  3196. <target name="-fallback-deploy-app-sign-blob-nopreloader-template-swing" depends="-check-fallback-sign-deploy-swing-possible" if="sign-nopreloader-template-swing" unless="preloader-app-no-workaround">
  3197. <echo message="-fallback-deploy-app-sign-blob-nopreloader-template-swing" level="verbose"/>
  3198. <deploy-defines/>
  3199. <deploy-preprocess/>
  3200. <fallback-deploy-application-def-swing/>
  3201. <fallback-deploy-resources/>
  3202. <fallback-deploy-jar/>
  3203. <deploy-sign-blob/>
  3204. <fallback-deploy-deploy-template/>
  3205. </target>
  3206. <!-- FALLBACK (NO JAVASCRIPT) TARGETS NO SIGNING -->
  3207. <target name="-check-fallback-nosign-deploy-swing-possible" depends="-check-nosign">
  3208. <local name="fail-deploy-swing-possible"/>
  3209. <condition property="fail-deploy-swing-possible">
  3210. <and>
  3211. <or>
  3212. <isset property="nosign-nopreloader-notemplate-swing"/>
  3213. <isset property="nosign-nopreloader-template-swing"/>
  3214. </or>
  3215. <not><isset property="have-fx-ant-api-1.2"/></not>
  3216. </and>
  3217. </condition>
  3218. <fail message="Error: JavaFX SDK version 2.2 or newer is needed to deploy FX-in-Swing on JDK without JavaScript support."
  3219. if="fail-deploy-swing-possible"/>
  3220. </target>
  3221. <!-- FALLBACK project without preloader -->
  3222. <!-- FALLBACK no html template -->
  3223. <target name="-fallback-deploy-app-nosign-nopreloader-notemplate" depends="-check-nosign" if="nosign-nopreloader-notemplate" unless="preloader-app">
  3224. <echo message="-fallback-deploy-app-nosign-nopreloader-notemplate" level="verbose"/>
  3225. <deploy-defines/>
  3226. <deploy-preprocess/>
  3227. <fallback-deploy-application-def/>
  3228. <fallback-deploy-resources/>
  3229. <fallback-deploy-jar/>
  3230. <fallback-deploy-deploy/>
  3231. </target>
  3232. <!-- FALLBACK project with preloader -->
  3233. <!-- FALLBACK no html template -->
  3234. <target name="-fallback-deploy-app-nosign-preloader-notemplate" depends="-check-nosign" if="nosign-preloader-notemplate" unless="preloader-app">
  3235. <echo message="-fallback-deploy-app-nosign-preloader-notemplate" level="verbose"/>
  3236. <deploy-defines/>
  3237. <deploy-preprocess/>
  3238. <fallback-deploy-application-def-preloader/>
  3239. <fallback-deploy-resources-preloader/>
  3240. <fallback-deploy-jar/>
  3241. <fallback-deploy-deploy/>
  3242. </target>
  3243. <!-- FALLBACK project without preloader -->
  3244. <!-- FALLBACK html template -->
  3245. <target name="-fallback-deploy-app-nosign-nopreloader-template" depends="-check-nosign" if="nosign-nopreloader-template" unless="preloader-app">
  3246. <echo message="-fallback-deploy-app-nosign-nopreloader-template" level="verbose"/>
  3247. <deploy-defines/>
  3248. <deploy-preprocess/>
  3249. <fallback-deploy-application-def/>
  3250. <fallback-deploy-resources/>
  3251. <fallback-deploy-jar/>
  3252. <fallback-deploy-deploy-template/>
  3253. </target>
  3254. <!-- FALLBACK project with preloader -->
  3255. <!-- FALLBACK html template -->
  3256. <target name="-fallback-deploy-app-nosign-preloader-template" depends="-check-nosign" if="nosign-preloader-template" unless="preloader-app">
  3257. <echo message="-fallback-deploy-app-nosign-preloader-template" level="verbose"/>
  3258. <deploy-defines/>
  3259. <deploy-preprocess/>
  3260. <fallback-deploy-application-def-preloader/>
  3261. <fallback-deploy-resources-preloader/>
  3262. <fallback-deploy-jar/>
  3263. <fallback-deploy-deploy-template/>
  3264. </target>
  3265. <!-- FALLBACK project without preloader -->
  3266. <!-- FALLBACK no html template -->
  3267. <!-- FALLBACK FX in Swing app -->
  3268. <target name="-fallback-deploy-app-nosign-nopreloader-notemplate-swing" depends="-check-fallback-nosign-deploy-swing-possible" if="nosign-nopreloader-notemplate-swing" unless="preloader-app-no-workaround">
  3269. <echo message="-fallback-deploy-app-nosign-nopreloader-notemplate-swing" level="verbose"/>
  3270. <deploy-defines/>
  3271. <deploy-preprocess/>
  3272. <fallback-deploy-application-def-swing/>
  3273. <fallback-deploy-resources/>
  3274. <fallback-deploy-jar/>
  3275. <fallback-deploy-deploy/>
  3276. </target>
  3277. <!-- FALLBACK project without preloader -->
  3278. <!-- FALLBACK html template -->
  3279. <!-- FALLBACK FX in Swing app -->
  3280. <target name="-fallback-deploy-app-nosign-nopreloader-template-swing" depends="-check-fallback-nosign-deploy-swing-possible" if="nosign-nopreloader-template-swing" unless="preloader-app-no-workaround">
  3281. <echo message="-fallback-deploy-app-nosign-nopreloader-template-swing" level="verbose"/>
  3282. <deploy-defines/>
  3283. <deploy-preprocess/>
  3284. <fallback-deploy-application-def-swing/>
  3285. <fallback-deploy-resources/>
  3286. <fallback-deploy-jar/>
  3287. <fallback-deploy-deploy-template/>
  3288. </target>
  3289. <!-- Project Build Targets -->
  3290. <target name="jfx-build" depends="-jfx-do-compile, -jfx-do-jar, -jfx-do-post-jar"/>
  3291. <target name="jfx-build-noscript" depends="-set-fallback-no-javascript, -jfx-do-compile, -jfx-do-jar, -jfx-do-post-jar"/>
  3292. <target name="jfx-rebuild" depends="clean, -jfx-do-compile, -jfx-do-jar, -jfx-do-post-jar"/>
  3293. <target name="jfx-rebuild-noscript" depends="-set-fallback-no-javascript, clean, -jfx-do-compile, -jfx-do-jar, -jfx-do-post-jar"/>
  3294. <target name="jfx-build-native" depends="-set-do-build-native-package, -check-ant-jre-supports-native-packaging, -check-native-packager-external-tools, jfx-rebuild"/>
  3295. <target name="jfx-build-native-noscript" depends="-set-do-build-native-package, -check-ant-jre-supports-native-packaging, -check-native-packager-external-tools, jfx-rebuild-noscript"/>
  3296. <target name="build-native">
  3297. <property name="javafx.native.bundling.type" value="${native.bundling.type}"/>
  3298. <antcall target="jfx-build-native"/>
  3299. </target>
  3300. <target name="build-native-noscript">
  3301. <property name="javafx.native.bundling.type" value="${native.bundling.type}"/>
  3302. <antcall target="jfx-build-native-noscript"/>
  3303. </target>
  3304. <target name="-check-do-jar">
  3305. <condition property="do-jar-false">
  3306. <and>
  3307. <isset property="do.jar"/>
  3308. <equals arg1="${do.jar}" arg2="false"/>
  3309. </and>
  3310. </condition>
  3311. </target>
  3312. <target name="-set-fallback-no-javascript">
  3313. <property name="fallback.no.javascript" value="true"/>
  3314. <echo message="Warning: Using fallback build infrastructure due to default JDK missing JavaScript support."/>
  3315. </target>
  3316. <target name="-jfx-do-compile" depends="-check-do-jar" if="do-jar-false">
  3317. <antcall target="compile"/>
  3318. </target>
  3319. <target name="-jfx-do-jar" depends="-check-do-jar" unless="do-jar-false">
  3320. <antcall target="jar"/>
  3321. </target>
  3322. <target name="-jfx-do-post-jar" depends="-init-check,-check-project" if="preloader-app">
  3323. <!-- Preloaders are created using SE copylibs task that creates readme file relevant for SE only -->
  3324. <delete file="${basedir}${file.separator}${dist.dir}${file.separator}README.TXT"/>
  3325. </target>
  3326. <target name="-set-do-build-native-package">
  3327. <property name="do.build.native.package" value="true"/>
  3328. <echo message="do.build.native.package = ${do.build.native.package}" level="verbose"/>
  3329. </target>
  3330. <target name="-check-ant-jre-supports-native-packaging" depends="-check-ant-jre-version">
  3331. <fail message="Error:${line.separator}JavaFX native packager requires NetBeans to run on JDK 1.7u6 or later !" if="have-ant-jre-pre7u6"/>
  3332. </target>
  3333. <target name="-call-pre-jfx-native" if="do.build.native.package">
  3334. <antcall target="-pre-jfx-native"/>
  3335. </target>
  3336. <target name="-call-post-jfx-native" if="do.build.native.package">
  3337. <antcall target="-post-jfx-native"/>
  3338. </target>
  3339. <target name="-check-native-bundling-type" depends="-check-operating-system" if="do.build.native.package">
  3340. <condition property="need.Inno.presence">
  3341. <and>
  3342. <isset property="running.on.windows"/>
  3343. <isset property="javafx.native.bundling.type"/>
  3344. <or>
  3345. <equals arg1="${javafx.native.bundling.type}" arg2="all" casesensitive="false"/>
  3346. <equals arg1="${javafx.native.bundling.type}" arg2="installer" casesensitive="false"/>
  3347. <equals arg1="${javafx.native.bundling.type}" arg2="exe" casesensitive="false"/>
  3348. </or>
  3349. </and>
  3350. </condition>
  3351. <condition property="need.WiX.presence">
  3352. <and>
  3353. <isset property="running.on.windows"/>
  3354. <isset property="javafx.native.bundling.type"/>
  3355. <or>
  3356. <equals arg1="${javafx.native.bundling.type}" arg2="all" casesensitive="false"/>
  3357. <equals arg1="${javafx.native.bundling.type}" arg2="installer" casesensitive="false"/>
  3358. <equals arg1="${javafx.native.bundling.type}" arg2="msi" casesensitive="false"/>
  3359. </or>
  3360. </and>
  3361. </condition>
  3362. <condition property="need.dpkg.presence">
  3363. <and>
  3364. <isset property="running.on.unix"/>
  3365. <isset property="javafx.native.bundling.type"/>
  3366. <or>
  3367. <equals arg1="${javafx.native.bundling.type}" arg2="deb" casesensitive="false"/>
  3368. </or>
  3369. </and>
  3370. </condition>
  3371. <condition property="need.rpmbuild.presence">
  3372. <and>
  3373. <isset property="running.on.unix"/>
  3374. <isset property="javafx.native.bundling.type"/>
  3375. <or>
  3376. <equals arg1="${javafx.native.bundling.type}" arg2="rpm" casesensitive="false"/>
  3377. </or>
  3378. </and>
  3379. </condition>
  3380. <echo message="need.Inno.presence:${need.Inno.presence}" level="verbose"/>
  3381. <echo message="need.WiX.presence:${need.WiX.presence}" level="verbose"/>
  3382. <echo message="need.dpkg.presence:${need.dpkg.presence}" level="verbose"/>
  3383. <echo message="need.rpmbuild.presence:${need.rpmbuild.presence}" level="verbose"/>
  3384. </target>
  3385. <target name="-check-Inno-presence" depends="-check-native-bundling-type" if="need.Inno.presence">
  3386. <local name="exec-output"/>
  3387. <local name="exec-error"/>
  3388. <local name="exec-result"/>
  3389. <exec executable="iscc" outputproperty="exec-output" failifexecutionfails="false" errorproperty="exec-error" resultproperty="exec-result"/>
  3390. <echo message="exec-output:${exec-output}" level="verbose"/>
  3391. <echo message="exec-error:${exec-error}" level="verbose"/>
  3392. <echo message="exec-result:${exec-result}" level="verbose"/>
  3393. <condition property="missing.Inno">
  3394. <not><and>
  3395. <contains string="${exec-output}" substring="Inno Setup"/>
  3396. <not><contains string="${exec-output}" substring="Inno Setup 1"/></not>
  3397. <not><contains string="${exec-output}" substring="Inno Setup 2"/></not>
  3398. <not><contains string="${exec-output}" substring="Inno Setup 3"/></not>
  3399. <not><contains string="${exec-output}" substring="Inno Setup 4"/></not>
  3400. </and></not>
  3401. </condition>
  3402. </target>
  3403. <target name="-check-WiX-presence" depends="-check-native-bundling-type" if="need.WiX.presence">
  3404. <local name="exec-output"/>
  3405. <local name="exec-error"/>
  3406. <local name="exec-result"/>
  3407. <exec executable="candle" outputproperty="exec-output" failifexecutionfails="false" errorproperty="exec-error" resultproperty="exec-result">
  3408. <arg value="-?"/>
  3409. </exec>
  3410. <echo message="exec-output:${exec-output}" level="verbose"/>
  3411. <echo message="exec-error:${exec-error}" level="verbose"/>
  3412. <echo message="exec-result:${exec-result}" level="verbose"/>
  3413. <condition property="missing.WiX">
  3414. <not>
  3415. <matches string="${exec-output}" pattern="windows\s+installer\s+xml\s+(toolset\s+)?compiler\s+version\s+3.*" casesensitive="false"/>
  3416. </not>
  3417. </condition>
  3418. </target>
  3419. <target name="-check-dpkg-presence" depends="-check-native-bundling-type" if="need.dpkg.presence">
  3420. <local name="exec.which.dpkg.result"/>
  3421. <local name="exec.which.dpkg.output"/>
  3422. <exec executable="command" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.dpkg.result" outputproperty="exec.which.dpkg.output">
  3423. <arg line="-v dpkg"/>
  3424. </exec>
  3425. <condition property="missing.dpkg">
  3426. <not><and>
  3427. <isset property="exec.which.dpkg.result"/>
  3428. <equals arg1="${exec.which.dpkg.result}" arg2="0"/>
  3429. <isset property="exec.which.dpkg.output"/>
  3430. <not><equals arg1="${exec.which.dpkg.output}" arg2=""/></not>
  3431. </and></not>
  3432. </condition>
  3433. </target>
  3434. <target name="-check-rpmbuild-presence" depends="-check-native-bundling-type" if="need.rpmbuild.presence">
  3435. <local name="exec.which.rpmbuild.result"/>
  3436. <local name="exec.which.rpmbuild.output"/>
  3437. <exec executable="command" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.rpmbuild.result" outputproperty="exec.which.rpmbuild.output">
  3438. <arg line="-v rpmbuild"/>
  3439. </exec>
  3440. <condition property="missing.rpmbuild">
  3441. <not><and>
  3442. <isset property="exec.which.rpmbuild.result"/>
  3443. <equals arg1="${exec.which.rpmbuild.result}" arg2="0"/>
  3444. <isset property="exec.which.rpmbuild.output"/>
  3445. <not><equals arg1="${exec.which.rpmbuild.output}" arg2=""/></not>
  3446. </and></not>
  3447. </condition>
  3448. </target>
  3449. <target name="-check-native-packager-external-tools" depends="-check-Inno-presence, -check-WiX-presence, -check-dpkg-presence, -check-rpmbuild-presence">
  3450. <property name="missing.Inno.message" value="JavaFX native packager requires external Inno Setup 5+ tools installed and included on PATH to create EXE installer. See http://www.jrsoftware.org/"/>
  3451. <property name="missing.WiX.message" value="JavaFX native packager requires external WiX 3.0+ tools installed and included on PATH to create MSI installer. See http://wix.sourceforge.net/"/>
  3452. <property name="missing.dpkg.message" value="JavaFX native packager requires Debian Packager tools to create DEB package, but dpkg could not be found."/>
  3453. <property name="missing.rpmbuild.message" value="JavaFX native packager requires RPMBuild to create RPM package, but rpmbuild could not be found."/>
  3454. <condition property="missing.Inno.WiX">
  3455. <and>
  3456. <isset property="missing.Inno"/>
  3457. <isset property="missing.WiX"/>
  3458. </and>
  3459. </condition>
  3460. <fail message="Error:${line.separator}${missing.Inno.message}${line.separator}${missing.WiX.message}" if="missing.Inno.WiX"/>
  3461. <fail message="Error:${line.separator}${missing.Inno.message}" if="missing.Inno"/>
  3462. <fail message="Error:${line.separator}${missing.WiX.message}" if="missing.WiX"/>
  3463. <fail message="Error:${line.separator}${missing.dpkg.message}" if="missing.dpkg"/>
  3464. <fail message="Error:${line.separator}${missing.rpmbuild.message}" if="missing.rpmbuild"/>
  3465. </target>
  3466. <!-- Project Run Support -->
  3467. <target name="-warn-of-preloader" depends="-check-project" if="preloader-app-no-workaround">
  3468. <fail message="Error:${line.separator}JavaFX 2 Preloader Project can not be executed directly.${line.separator}Please execute instead a JavaFX Application that uses the Preloader."/>
  3469. </target>
  3470. <target name="-mark-project-state-running">
  3471. <property name="project.state.running" value="true"/>
  3472. <echo message="project.state.running = ${project.state.running}" level="verbose"/>
  3473. </target>
  3474. <target name="-mark-project-state-debugging">
  3475. <property name="project.state.debugging" value="true"/>
  3476. <echo message="project.state.debugging = ${project.state.debugging}" level="verbose"/>
  3477. </target>
  3478. <target name="-mark-project-state-debugging-in-browser" depends="-mark-project-state-debugging">
  3479. <property name="project.state.debugging.in.browser" value="true"/>
  3480. <echo message="project.state.debugging.in.browser = ${project.state.debugging.in.browser}" level="verbose"/>
  3481. </target>
  3482. <target name="-mark-project-state-profiling">
  3483. <property name="project.state.profiling" value="true"/>
  3484. <echo message="project.state.profiling = ${project.state.profiling}" level="verbose"/>
  3485. </target>
  3486. <target name="-mark-project-needs-jnlp">
  3487. <property name="project.needs.jnlp" value="true"/>
  3488. <echo message="project.needs.jnlp = ${project.needs.jnlp}" level="verbose"/>
  3489. </target>
  3490. <!-- set property javafx.disable.concurrent.runs=true to disable runs from temporary directory -->
  3491. <target name="-check-concurrent-runs">
  3492. <condition property="disable-concurrent-runs">
  3493. <and>
  3494. <isset property="javafx.disable.concurrent.runs"/>
  3495. <equals arg1="${javafx.disable.concurrent.runs}" arg2="true" trim="true"/>
  3496. </and>
  3497. </condition>
  3498. <condition property="temp.run.jar" value="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}">
  3499. <isset property="disable-concurrent-runs"/>
  3500. </condition>
  3501. <condition property="temp.run.jnlp" value="${jfx.deployment.jnlp}">
  3502. <isset property="disable-concurrent-runs"/>
  3503. </condition>
  3504. <condition property="temp.run.html" value="${jfx.deployment.html}">
  3505. <isset property="disable-concurrent-runs"/>
  3506. </condition>
  3507. </target>
  3508. <target name="-create-temp-run-dir" depends="-check-concurrent-runs" unless="disable-concurrent-runs">
  3509. <echo message="Creating temp run dir" level="verbose"/>
  3510. <tempfile property="temp.run.dir" destDir="${basedir}${file.separator}${dist.dir}${file.separator}" prefix="run"/>
  3511. <echo message="temp.run.dir = ${temp.run.dir}" level="verbose"/>
  3512. <copy todir="${temp.run.dir}" includeemptydirs="true" overwrite="true">
  3513. <fileset dir="${basedir}${file.separator}${dist.dir}">
  3514. <exclude name="**${file.separator}bundles${file.separator}**"/>
  3515. <exclude name="**${file.separator}run*${file.separator}**"/>
  3516. </fileset>
  3517. </copy>
  3518. <property name="temp.run.jar" value="${temp.run.dir}${file.separator}${jfx.deployment.jar}"/>
  3519. <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
  3520. <property name="temp.run.jnlp" value="${temp.run.dir}${file.separator}${jfx.deployment.base}.jnlp"/>
  3521. <property name="temp.run.html" value="${temp.run.dir}${file.separator}${jfx.deployment.base}.html"/>
  3522. </target>
  3523. <target name="-remove-temp-run-dir" if="temp.run.dir">
  3524. <echo message="Removing temp run dir" level="verbose"/>
  3525. <delete dir="${temp.run.dir}" quiet="true" failonerror="false"/>
  3526. </target>
  3527. <target depends="init,compile,jar,-create-temp-run-dir" description="Run JavaFX project standalone." name="jfx-project-run">
  3528. <echo message="Executing ${temp.run.jar} using platform ${platform.java}"/>
  3529. <property name="run.jvmargs" value=""/>
  3530. <property name="run.jvmargs.ide" value=""/>
  3531. <java jar="${temp.run.jar}" dir="${work.dir}" fork="true" jvm="${platform.java}">
  3532. <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  3533. <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
  3534. <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
  3535. <jvmarg line="${run.jvmargs}"/>
  3536. <jvmarg line="${run.jvmargs.ide}"/>
  3537. <classpath>
  3538. <path path="${temp.run.jar}:${javac.classpath}"/>
  3539. </classpath>
  3540. <arg line="${application.args}"/>
  3541. <syspropertyset>
  3542. <propertyref prefix="run-sys-prop."/>
  3543. <mapper from="run-sys-prop.*" to="*" type="glob"/>
  3544. </syspropertyset>
  3545. </java>
  3546. <antcall target="-remove-temp-run-dir"/>
  3547. </target>
  3548. <target depends="init,compile,jar,-create-temp-run-dir,-debug-start-debugger" description="Debug JavaFX project standalone." name="jfx-project-debug">
  3549. <echo message="Executing ${temp.run.jar} using platform ${platform.java}"/>
  3550. <property name="run.jvmargs" value=""/>
  3551. <property name="run.jvmargs.ide" value=""/>
  3552. <java jar="${temp.run.jar}" dir="${work.dir}" fork="true" jvm="${platform.java}">
  3553. <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  3554. <jvmarg line="${debug-args-line}"/>
  3555. <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  3556. <jvmarg value="-Dglass.disableGrab=true"/>
  3557. <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
  3558. <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
  3559. <jvmarg line="${run.jvmargs}"/>
  3560. <jvmarg line="${run.jvmargs.ide}"/>
  3561. <classpath>
  3562. <path path="${temp.run.jar}:${javac.classpath}"/>
  3563. </classpath>
  3564. <arg line="${application.args}"/>
  3565. <syspropertyset>
  3566. <propertyref prefix="run-sys-prop."/>
  3567. <mapper from="run-sys-prop.*" to="*" type="glob"/>
  3568. </syspropertyset>
  3569. </java>
  3570. <antcall target="-remove-temp-run-dir"/>
  3571. </target>
  3572. <!-- Running/Debugging/Profiling Standalone -->
  3573. <target name="jfxsa-run" depends="-mark-project-state-running,-clean-if-config-changed,-check-jfx-runtime,-warn-of-preloader,jfx-project-run"/>
  3574. <target name="jfxsa-run-noscript" depends="-set-fallback-no-javascript, jfxsa-run"/>
  3575. <target name="jfxsa-debug" depends="-mark-project-state-debugging,-clean-if-config-changed,jar,-check-jfx-runtime,-warn-of-preloader,jfx-project-debug"/>
  3576. <target name="jfxsa-debug-noscript" depends="-set-fallback-no-javascript, jfxsa-debug"/>
  3577. <target name="jfxsa-profile" depends="-mark-project-state-profiling,-check-jfx-runtime,-warn-of-preloader,jfx-project-profile"/>
  3578. <target name="jfxsa-profile-noscript" depends="-set-fallback-no-javascript, jfxsa-profile"/>
  3579. <target name="-check-clean-if-config-changed" depends="-init-project">
  3580. <deploy-defines/>
  3581. <uptodate property="jfx.deployment.jar.newer.than.nbproject" targetfile="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}" >
  3582. <srcfiles dir="${basedir}${file.separator}nbproject" includes="**${file.separator}*"/>
  3583. </uptodate>
  3584. <echo message="jfx.deployment.jar.newer.than.nbproject = ${jfx.deployment.jar.newer.than.nbproject}" level="verbose"/>
  3585. <available file="${jfx.deployment.dir}${file.separator}${jfx.deployment.jar}" type="file" property="jfx.deployment.jar.exists"/>
  3586. <condition property="request.clean.due.to.config.change">
  3587. <and>
  3588. <isset property="jfx.deployment.jar.exists"/>
  3589. <not><isset property="jfx.deployment.jar.newer.than.nbproject"/></not>
  3590. </and>
  3591. </condition>
  3592. </target>
  3593. <target name="-clean-if-config-changed" depends="-check-clean-if-config-changed" if="request.clean.due.to.config.change">
  3594. <echo message="Config change detected. Invoking clean." level="verbose"/>
  3595. <antcall target="clean"/>
  3596. </target>
  3597. <target depends="-profile-check-1,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="jfx-project-profile" unless="profiler.info.jvmargs.agent">
  3598. <startprofiler/>
  3599. <antcall target="jfxsa-run"/>
  3600. </target>
  3601. <!-- Shared Debugging init -->
  3602. <target name="-init-debug-args">
  3603. <property name="version-output" value="java version &quot;${ant.java.version}"/>
  3604. <condition property="have-jdk-older-than-1.4">
  3605. <or>
  3606. <contains string="${version-output}" substring="java version &quot;1.0"/>
  3607. <contains string="${version-output}" substring="java version &quot;1.1"/>
  3608. <contains string="${version-output}" substring="java version &quot;1.2"/>
  3609. <contains string="${version-output}" substring="java version &quot;1.3"/>
  3610. </or>
  3611. </condition>
  3612. <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  3613. <istrue value="${have-jdk-older-than-1.4}"/>
  3614. </condition>
  3615. <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  3616. <os family="windows"/>
  3617. </condition>
  3618. <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  3619. <isset property="debug.transport"/>
  3620. </condition>
  3621. </target>
  3622. <!-- Running/Debugging/Profiling as WebStart -->
  3623. <target name="-check-jnlp-file-fx" depends="-swing-api-check" unless="fx-in-swing-app-workaround">
  3624. <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
  3625. <property name="jfx.deployment.jnlp" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.jnlp"/>
  3626. </target>
  3627. <target name="-check-jnlp-file-swing" depends="-swing-api-check" if="fx-in-swing-app-workaround">
  3628. <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
  3629. <property name="jfx.deployment.jnlp" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}_application.jnlp"/>
  3630. </target>
  3631. <target name="-check-jnlp-file" depends="-check-jnlp-file-fx,-check-jnlp-file-swing">
  3632. <condition property="jnlp-file-exists">
  3633. <available file="${jfx.deployment.jnlp}"/>
  3634. </condition>
  3635. <condition property="jnlp-file-exists+netbeans.home">
  3636. <and>
  3637. <isset property="jnlp-file-exists"/>
  3638. <isset property="netbeans.home"/>
  3639. </and>
  3640. </condition>
  3641. </target>
  3642. <target name="-resolve-jnlp-file" depends="-check-jnlp-file" unless="jnlp-file-exists">
  3643. <antcall target="jfx-deployment"/>
  3644. <antcall target="-check-jnlp-file"/>
  3645. </target>
  3646. <!-- set property javafx.enable.concurrent.external.runs=true to enable multiple runs of the same WebStart or Run-in-Browser project -->
  3647. <target name="-check-concurrent-jnlp-runs" depends="-resolve-jnlp-file">
  3648. <condition property="disable-concurrent-runs">
  3649. <not>
  3650. <and>
  3651. <isset property="javafx.enable.concurrent.external.runs"/>
  3652. <equals arg1="${javafx.enable.concurrent.external.runs}" arg2="true" trim="true"/>
  3653. </and>
  3654. </not>
  3655. </condition>
  3656. <condition property="temp.run.jnlp" value="${jfx.deployment.jnlp}">
  3657. <isset property="disable-concurrent-runs"/>
  3658. </condition>
  3659. </target>
  3660. <target name="-warn-concurrent-jnlp-runs" unless="disable-concurrent-runs">
  3661. <echo message="Note: Concurrent Run as WebStart enabled.${line.separator}Temporary directory ${temp.run.dir}${line.separator}will remain unused when WebStart execution has finished. Use project Clean to delete unused directories."/>
  3662. </target>
  3663. <target name="jfxws-run" if="jnlp-file-exists" depends="-mark-project-state-running,-clean-if-config-changed,-mark-project-needs-jnlp,-check-jdk-7u4or5-mac,jar,
  3664. -check-jfx-webstart,-resolve-jnlp-file,-check-jfx-runtime,-check-concurrent-jnlp-runs,-create-temp-run-dir,-warn-insufficient-signing"
  3665. description="Start JavaFX javaws execution">
  3666. <echo message="Executing ${temp.run.jnlp} using ${active.webstart.executable}"/>
  3667. <exec executable="${active.webstart.executable}">
  3668. <arg file="${temp.run.jnlp}"/>
  3669. </exec>
  3670. <antcall target="-warn-concurrent-jnlp-runs"/>
  3671. </target>
  3672. <target name="jfxws-debug" if="jnlp-file-exists+netbeans.home" depends="-mark-project-state-debugging,-clean-if-config-changed,-mark-project-needs-jnlp,
  3673. -check-jdk-7u4or5-mac,jar,-check-jfx-webstart,-resolve-jnlp-file,-check-jfx-runtime,-warn-insufficient-signing,
  3674. -debug-start-debugger,-debug-javaws-debuggee" description="Debug JavaFX javaws project in IDE"/>
  3675. <target name="-debug-javaws-debuggee" depends="-init-debug-args">
  3676. <echo message="Executing ${jfx.deployment.jnlp} in debug mode using ${active.webstart.executable}"/>
  3677. <exec executable="${active.webstart.executable}">
  3678. <env key="JAVAWS_VM_ARGS" value="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address} -Dglass.disableGrab=true"/>
  3679. <arg value="-wait"/>
  3680. <arg file="${jfx.deployment.jnlp}"/>
  3681. </exec>
  3682. </target>
  3683. <target name="-profile-check-1">
  3684. <property name="run.jvmargs.ide" value=""/>
  3685. <condition property="profiler.configured">
  3686. <or>
  3687. <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
  3688. <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
  3689. </or>
  3690. </condition>
  3691. </target>
  3692. <target if="jnlp-file-exists+netbeans.home" name="-profile-check-jnlp">
  3693. <antcall target="-profile-check-1"/>
  3694. </target>
  3695. <target name="-do-jfxws-profile" depends="-mark-project-state-profiling,-mark-project-needs-jnlp,
  3696. -check-jdk-7u4or5-mac,jar,-check-jfx-webstart,-resolve-jnlp-file,-check-jfx-runtime,-warn-insufficient-signing">
  3697. <echo message="Executing ${jfx.deployment.jnlp} in profile mode using ${active.webstart.executable}"/>
  3698. <property name="run.jvmargs.ide" value=""/>
  3699. <exec executable="${active.webstart.executable}">
  3700. <env key="JAVAWS_VM_ARGS" value="${run.jvmargs.ide}"/>
  3701. <arg value="-wait"/>
  3702. <arg file="${jfx.deployment.jnlp}"/>
  3703. </exec>
  3704. </target>
  3705. <target name="jfxws-profile" if="profiler.configured"
  3706. depends="-profile-check-1"
  3707. description="Profile JavaFX javaws project in IDE">
  3708. <startprofiler/>
  3709. <antcall target="-do-jfxws-profile"/>
  3710. </target>
  3711. <target name="jfxws-run-noscript" depends="-set-fallback-no-javascript, jfxws-run"/>
  3712. <target name="jfxws-debug-noscript" depends="-set-fallback-no-javascript, jfxws-debug"/>
  3713. <target name="jfxws-profile-noscript" depends="-set-fallback-no-javascript, jfxws-profile"/>
  3714. <!-- Running/Debugging/Profiling in Browser -->
  3715. <target name="-check-selected-browser-path" depends="-check-default-run-config">
  3716. <condition property="javafx.run.inbrowser.undefined">
  3717. <or>
  3718. <and>
  3719. <isset property="javafx.run.inbrowser"/>
  3720. <equals arg1="${javafx.run.inbrowser}" arg2="undefined"/>
  3721. </and>
  3722. <and>
  3723. <isset property="javafx.run.inbrowser.path"/>
  3724. <equals arg1="${javafx.run.inbrowser.path}" arg2="undefined"/>
  3725. </and>
  3726. </or>
  3727. </condition>
  3728. <condition property="javafx.run.inbrowser.path-exists">
  3729. <and>
  3730. <isset property="javafx.run.inbrowser.path"/>
  3731. <available file="${javafx.run.inbrowser.path}"/>
  3732. </and>
  3733. </condition>
  3734. <fail message="Error:${line.separator}Browser selection not recognizable from ${config} run configuration.${line.separator}Please go to Project Properties dialog, category Run, to select a valid browser." unless="javafx.run.inbrowser.path"/>
  3735. <fail message="Error:${line.separator}No browser defined in ${config} run configuration.${line.separator}Please verify in Tools->Options dialog that NetBeans recognizes a valid browser, then go to Project Properties dialog, category Run, to select a valid browser." if="javafx.run.inbrowser.undefined"/>
  3736. <fail message="Error:${line.separator}Browser ${javafx.run.inbrowser.path} referred from ${config} run configuration can not be found.${line.separator}(This can happen, e.g, when the JavaFX Project is transferred to another system.)${line.separator}Please go to Project Properties dialog, category Run, to select a valid browser." unless="javafx.run.inbrowser.path-exists"/>
  3737. </target>
  3738. <target name="-substitute-template-processed-html-file" depends="-check-project" if="html-template-available">
  3739. <deploy-process-template/>
  3740. </target>
  3741. <target name="-check-template-processed-html-file" depends="-substitute-template-processed-html-file">
  3742. <condition property="html-file-exists">
  3743. <and>
  3744. <isset property="html-template-available"/>
  3745. <available file="${javafx.run.htmltemplate.processed}"/>
  3746. </and>
  3747. </condition>
  3748. </target>
  3749. <target name="-set-template-processed-html-file" depends="-check-template-processed-html-file" if="html-file-exists">
  3750. <property name="jfx.deployment.html" location="${javafx.run.htmltemplate.processed}"/>
  3751. </target>
  3752. <target name="-set-html-file" depends="-set-template-processed-html-file" unless="html-file-exists">
  3753. <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
  3754. <property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
  3755. <condition property="html-file-exists">
  3756. <available file="${jfx.deployment.html}"/>
  3757. </condition>
  3758. <condition property="html-file-exists+netbeans.home">
  3759. <and>
  3760. <isset property="html-file-exists"/>
  3761. <isset property="netbeans.home"/>
  3762. </and>
  3763. </condition>
  3764. </target>
  3765. <!-- set property javafx.enable.concurrent.external.runs=true to enable multiple runs of the same WebStart or Run-in-Browser project -->
  3766. <target name="-check-concurrent-html-runs" depends="-set-html-file">
  3767. <condition property="disable-concurrent-runs">
  3768. <or>
  3769. <not>
  3770. <and>
  3771. <isset property="javafx.enable.concurrent.external.runs"/>
  3772. <equals arg1="${javafx.enable.concurrent.external.runs}" arg2="true" trim="true"/>
  3773. </and>
  3774. </not>
  3775. <and>
  3776. <isset property="html-template-available"/>
  3777. <available file="${javafx.run.htmltemplate.processed}"/>
  3778. </and>
  3779. </or>
  3780. </condition>
  3781. <condition property="temp.run.html" value="${jfx.deployment.html}">
  3782. <isset property="disable-concurrent-runs"/>
  3783. </condition>
  3784. </target>
  3785. <target name="-warn-concurrent-html-runs" unless="disable-concurrent-runs">
  3786. <echo message="Note: Concurrent Run in Browser enabled.${line.separator}Temporary directory ${temp.run.dir}${line.separator}will remain unused when execution in browser has finished. Use project Clean to delete unused directories."/>
  3787. </target>
  3788. <target name="jfxbe-run" if="html-file-exists" depends="-mark-project-state-running,-clean-if-config-changed,-mark-project-needs-jnlp,-check-jdk-7u4or5-mac,jar,
  3789. -check-selected-browser-path,-set-html-file,-check-jfx-runtime,-check-concurrent-html-runs,-create-temp-run-dir,-warn-insufficient-signing"
  3790. description="Start JavaFX execution in browser">
  3791. <echo message="Executing ${temp.run.html} using ${javafx.run.inbrowser}"/>
  3792. <echo message="(${javafx.run.inbrowser.path})"/>
  3793. <property name="javafx.run.inbrowser.arguments" value=""/>
  3794. <exec executable="${javafx.run.inbrowser.path}">
  3795. <arg line="${javafx.run.inbrowser.arguments}"/>
  3796. <arg file="${temp.run.html}"/>
  3797. </exec>
  3798. <antcall target="-warn-concurrent-html-runs"/>
  3799. </target>
  3800. <target name="jfxbe-debug" if="html-file-exists+netbeans.home" depends="-mark-project-state-debugging-in-browser,-init-debug-args,
  3801. clean,-debug-start-debugger,-mark-project-needs-jnlp,-check-jdk-7u4or5-mac,jar,
  3802. -check-selected-browser-path,-set-html-file,-check-jfx-runtime,-warn-insufficient-signing,
  3803. -debug-jfxbe-debuggee" description="Debug JavaFX project in browser">
  3804. <!-- after the session clean up the jnlp containing debug settings -->
  3805. <antcall target="clean"/>
  3806. </target>
  3807. <target name="-debug-jfxbe-debuggee" depends="-init-debug-args">
  3808. <echo message="Executing ${jfx.deployment.html} in debug mode using ${javafx.run.inbrowser}"/>
  3809. <echo message="(${javafx.run.inbrowser.path})"/>
  3810. <property name="javafx.run.inbrowser.arguments" value=""/>
  3811. <exec executable="${javafx.run.inbrowser.path}">
  3812. <arg line="${javafx.run.inbrowser.arguments}"/>
  3813. <env key="_JPI_VM_OPTIONS" value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
  3814. <arg file="${jfx.deployment.html}"/>
  3815. </exec>
  3816. </target>
  3817. <target if="html-file-exists+netbeans.home" name="-profile-check-html">
  3818. <antcall target="-profile-check-1"/>
  3819. </target>
  3820. <target name="-do-jfxbe-profile" depends="-mark-project-state-profiling,-mark-project-needs-jnlp,
  3821. -check-jdk-7u4or5-mac,jar,-check-selected-browser-path,-set-html-file,-check-jfx-runtime,-warn-insufficient-signing">
  3822. <echo message="Executing ${jfx.deployment.html} in profile mode using ${javafx.run.inbrowser}"/>
  3823. <echo message="(${javafx.run.inbrowser.path})"/>
  3824. <property name="run.jvmargs.ide" value=""/>
  3825. <property name="javafx.run.inbrowser.arguments" value=""/>
  3826. <exec executable="${javafx.run.inbrowser.path}">
  3827. <arg line="${javafx.run.inbrowser.arguments}"/>
  3828. <env key="_JPI_VM_OPTIONS" value="${run.jvmargs.ide}"/>
  3829. <arg file="${jfx.deployment.html}"/>
  3830. </exec>
  3831. </target>
  3832. <target name="jfxbe-profile" if="profiler.configured"
  3833. depends="-profile-check-html"
  3834. description="Profile JavaFX project in browser">
  3835. <startprofiler/>
  3836. <antcall target="-do-jfxbe-profile"/>
  3837. </target>
  3838. <target name="jfxbe-run-noscript" depends="-set-fallback-no-javascript, jfxbe-run"/>
  3839. <target name="jfxbe-debug-noscript" depends="-set-fallback-no-javascript, jfxbe-debug"/>
  3840. <target name="jfxbe-profile-noscript" depends="-set-fallback-no-javascript, jfxbe-profile"/>
  3841. </project>