Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8204519

fx:deploy ignores verbose attribute

XMLWordPrintable

    • x86
    • os_x

      A DESCRIPTION OF THE PROBLEM :
      The fx:deploy ANT task does not always pass-on the value of its verbose attribute to the underlying javapackager implementation. I.e. class com.sun.javafx.tools.ant.DeployFXTask should always invoke
        deployParams.setVerbose(verbose);
      in its execute method instead of only in one of its isModular branches.
      As a result, no debug output is available and the temporary directory with all the configuration files is not retained. This makes debugging problems with building DMG bundles on macOS very, very difficult.

      REGRESSION : Last worked in version 8u172

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached ANT build script on macOS 10.12.x with JDK 10.0.1.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Lots of debug output, temporary directory with configuration files is retained.
      ACTUAL -
      No debug output, temporary directory is deleted once the task finishes.

      ---------- BEGIN SOURCE ----------
      <project
       name="test"
       default="all"
       xmlns:fx="javafx:com.sun.javafx.tools.ant">

        <target
         name="-init">
          <property
           name="tgt.dir"
           value="${basedir}/tgt"/>
          <property
           name="src.dir"
           value="${tgt.dir}/generated-sources"/>
          <property
           name="bin.dir"
           value="${tgt.dir}/classes"/>
        </target>

        <target
         name="-create"
         depends="-init">
          <mkdir dir="${src.dir}/test"/>
          <echo file="${src.dir}/test/Main.java">package test;

      import java.awt.Dimension;
      import java.awt.EventQueue;
      import javax.swing.JFrame;
      import javax.swing.JLabel;
      import javax.swing.JPanel;

      public class Main {
          private Main() {}

          public static void main( String[] args ) {
              EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      new Main().start();
                  }
              });
          }

          void start() {
              JPanel contentPane = new JPanel();
              contentPane.setPreferredSize(new Dimension(480, 360));
              contentPane.add(new JLabel("Hello World!"));

              JFrame frame = new JFrame(getClass().getName());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(contentPane);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
          }
      }
      </echo>
        </target>

        <target
         name="-compile"
         depends="-create">
          <mkdir dir="${bin.dir}"/>
          <javac
           includeantruntime="false"
           destdir="${bin.dir}"
           srcdir="${src.dir}"/>
        </target>

        <target
         name="-bundle"
         depends="-compile">
          <jar
           basedir="${bin.dir}"
           destfile="${tgt.dir}/main.jar">
            <manifest>
              <attribute
               name="Main-Class"
               value="test.Main"/>
            </manifest>
          </jar>
        </target>

        <target
         name="all"
         depends="-bundle">
          <property
           name="java.lib.dir"
           value="${java.home}/lib"/>
          <property
           name="javafx.ant.lib"
           value="${java.lib.dir}/ant-javafx.jar"/>
          <available
           file="${javafx.ant.lib}"
           property="javafx.ant.lib.exists"/>
          <fail unless="javafx.ant.lib.exists">Could not locate JavaFX ANT tasks.</fail>

          <taskdef
           resource="com/sun/javafx/tools/ant/antlib.xml"
           uri="javafx:com.sun.javafx.tools.ant"
           classpath="${javafx.ant.lib}"/>

          <fx:deploy
           verbose="true"
           nativeBundles="dmg"
           outdir="${tgt.dir}"
           outfile="Main">
            <fx:application
             id="test.Main"
             version="0.1"
             name="Main"
             mainClass="test.Main"/>
            <fx:bundleArgument
             arg="mac.signing-key-user-name"
             value="DoNotSign"/>
            <fx:resources>
              <fx:fileset
               dir="${tgt.dir}">
                <include name="main.jar"/>
              </fx:fileset>
            </fx:resources>
          </fx:deploy>
        </target>

      </project>
      ---------- END SOURCE ----------

      FREQUENCY : always


            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: