diff build.xml @ 25:3129d0e24086 pre-big-reorg

Use ant tasks, not <exec>.
author David Barts <n5jrn@me.com>
date Thu, 23 Jan 2020 20:46:59 -0800
parents 14049bc97a7c
children 8aa2dfac27eb
line wrap: on
line diff
--- a/build.xml	Thu Jan 23 19:25:17 2020 -0800
+++ b/build.xml	Thu Jan 23 20:46:59 2020 -0800
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="ClipMan" default="help" basedir=".">
+<project name="ClipMan" default="help" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
   <!-- import all environment variables as env.* -->
   <property environment="env"/>
 
@@ -19,7 +19,13 @@
 
   <!-- define the kotlin task -->
   <property name="kotlin.lib" value="${env.KOTLIN_HOME}/libexec/lib"/>
-  <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
+  <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
+           classpath="${kotlin.lib}/kotlin-ant.jar"/>
+
+  <!-- define the package-building tasks -->
+  <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
+           uri="javafx:com.sun.javafx.tools.ant"
+           classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/>
 
   <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property -->
   <scriptdef language="javascript" name="toLowerCase">
@@ -98,50 +104,38 @@
     <attribute name="type"/>
     <element name="args"/>
     <sequential>
-      <exec executable="${env.JRE_HOME}/bin/javapackager" dir="${basedir}">
-        <env key="JAVA_HOME" value="${env.JRE_HOME}"/>
-        <arg value="-deploy"/>
-        <arg value="-Bruntime=${env.JRE_HOME}"/>
-        <arg value="-description"/> <arg value="ClipMan, a clipboard manager."/>
-        <arg value="-native"/> <arg value="@{type}"/>
-        <arg value="-srcfiles"/> <arg value="${jar.name}"/>
-        <arg value="-outdir"/> <arg value="${basedir}"/>
-        <arg value="-outfile"/> <arg value="${app.name}"/>
-        <arg value="-appclass"/> <arg value="${app.entry}"/>
-        <arg value="-name"/> <arg value="${app.name}"/>
-        <arg value="-title"/> <arg value="${app.name}"/>
-        <arg value="-vendor"/> <arg value="David Barts &lt;n5jrn@me.com&gt;"/>
-        <arg value="-nosign"/>
+      <fx:deploy nativeBundles="@{type}" outdir="${basedir}" outfile="${app.name}"
+        signBundle="false">
+        <fx:application mainClass="${app.entry}" name="${app.name}" toolkit="swing"
+          version="1.0"/>
+        <fx:info description="ClipMan, a clipboard manager." title="${app.name}"
+          vendor="David Barts &lt;n5jrn@me.com&gt;"/>
+        <fx:resources>
+          <fx:fileset dir="${basedir}" includes="${lc.app.name}.jar"/>
+        </fx:resources>
+        <fx:bundleArgument arg="runtime" value="${env.JRE_HOME}"/>
         <args/>
-      </exec>
-    </sequential>
+      </fx:deploy>
+      </sequential>
   </macrodef>
 
-  <target name="dmg" depends="jar" description="Create MacOS app bundle.">
-    <bundle type="dmg">
+  <target name="macapp" depends="jar" description="Create MacOS app bundle.">
+    <bundle type="image">
       <args>
-        <arg value="-BjvmOptions=-Xdock:name=${app.name}"/>
+        <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/>
       </args>
     </bundle>
   </target>
 
-  <target name="pkg" depends="jar" description="Create MacOS app bundle.">
-    <bundle type="pkg">
-      <args>
-        <arg value="-BjvmOptions=-Xdock:name=${app.name}"/>
-      </args>
-    </bundle>
+  <target name="app" depends="jar" description="Create app bundle.">
+    <bundle type="image"/>
   </target>
 
-  <target name="rpm" depends="jar" description="Create MacOS app bundle.">
+  <target name="rpm" depends="jar" description="Create RPM package.">
     <bundle type="rpm"/>
   </target>
 
-  <target name="exe" depends="jar" description="Create MacOS app bundle.">
-    <bundle type="exe"/>
-  </target>
-
-  <target name="deb" depends="jar" description="Create MacOS app bundle.">
+  <target name="deb" depends="jar" description="Create Debian package.">
     <bundle type="deb"/>
   </target>