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

Build path is recorded in JavaFX Controls module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • jfx21
    • javafx
    • x86_64
    • linux_ubuntu

      The class 'com.sun.javafx.css.parser.Css2Bin' in the JavaFX Graphics module saves the absolute path of its '.css' input file in the corresponding '.bss' output file, which is then included in the JavaFX Controls module. Storing the absolute paths of source files in the build output makes it difficult to reproduce the build on another system or in a sub-directory of a developer's home directory.

      SYSTEM / OS / JAVA RUNTIME INFORMATION

      The following build tools were used:

      - cmake version 3.26.3
      - gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
      - OpenJDK Runtime Environment (build 19.0.2+7-44)
      - Apache Ant(TM) version 1.10.13 compiled on January 4 2023

      STEPS TO REPRODUCE

      Clone two copies of a JavaFX repository that includes the changes for JDK-8264449, "Enable reproducible builds with SOURCE_DATE_EPOCH," such as the following example:

        $ git clone --branch allow-reproducible-builds https://github.com/jgneff/jfx.git jfx1
        $ git clone --branch allow-reproducible-builds https://github.com/jgneff/jfx.git jfx2

      Change to the first project directory 'jfx1' and run the build scripts shown later in the SOURCE section:

        $ cd jfx1
        $ . ~/bin/jfxbuild.env
        $ ~/bin/develop.sh

      Then run the same build scripts in the second project directory 'jfx2':

        $ cd ../jfx2
        $ . ~/bin/jfxbuild.env
        $ ~/bin/develop.sh

      EXPECTED RESULTS

      When the builds complete, each of the following commands should produce no output:

      $ cd ..
      $ diff -qr jfx1/build1 jfx1/build2
      $ diff -qr jfx2/build1 jfx2/build2
      $ diff -qr jfx1/build1 jfx2/build1

      ACTUAL RESULT

      Instead, the command comparing the builds in 'jfx1' and 'jfx2' show differences in the JavaFX Controls module:

      $ diff -qr jfx1/build1 jfx2/build1
      Files jfx1/build1/compile.args and jfx2/build1/compile.args differ
      Files jfx1/build1/jmods/javafx.controls.jmod and jfx2/build1/jmods/javafx.controls.jmod differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/caspian/caspian.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/caspian/caspian.bss differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/caspian/fxvk.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/caspian/fxvk.bss differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/blackOnWhite.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/blackOnWhite.bss differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/modena.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/modena.bss differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/whiteOnBlack.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/whiteOnBlack.bss differ
      Files jfx1/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/yellowOnBlack.bss and jfx2/build1/modular-sdk/modules/javafx.controls/com/sun/javafx/scene/control/skin/modena/yellowOnBlack.bss differ
      Files jfx1/build1/modulesourcepath.args and jfx2/build1/modulesourcepath.args differ
      Files jfx1/build1/publications/javafx.controls-linux.jar and jfx2/build1/publications/javafx.controls-linux.jar differ
      Files jfx1/build1/run.args and jfx2/build1/run.args differ
      Files jfx1/build1/run.java.policy and jfx2/build1/run.java.policy differ
      Files jfx1/build1/sdk/lib/javafx.controls.jar and jfx2/build1/sdk/lib/javafx.controls.jar differ
      Files jfx1/build1/testcompile.args and jfx2/build1/testcompile.args differ
      Files jfx1/build1/test.java.policy and jfx2/build1/test.java.policy differ
      Files jfx1/build1/testrun.args and jfx2/build1/testrun.args differ
      Files jfx1/build1/tmp/javadoc/javadoc.options and jfx2/build1/tmp/javadoc/javadoc.options differ

      The actual artifacts that differ are shown by:

      $ diff -qr jfx1/build1 jfx2/build1 | grep -e '\.jar' -e '\.jmod'
      Files jfx1/build1/jmods/javafx.controls.jmod and jfx2/build1/jmods/javafx.controls.jmod differ
      Files jfx1/build1/publications/javafx.controls-linux.jar and jfx2/build1/publications/javafx.controls-linux.jar differ
      Files jfx1/build1/sdk/lib/javafx.controls.jar and jfx2/build1/sdk/lib/javafx.controls.jar differ

      SOURCE CODE FOR AN EXECUTABLE TEST CASE

      Source the file 'jfxbuild.env' to set the environment variables:

      -----------
      #!/bin/bash
      # Sets up the environment for building JavaFX
      syspath=/usr/sbin:/usr/bin:/sbin:/bin

      export CMAKE_HOME=$HOME/opt/cmake-3.26.3-linux-x86_64
      export JAVA_HOME=$HOME/opt/jdk-19.0.2
      export ANT_HOME=$HOME/opt/apache-ant-1.10.13

      SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
      export SOURCE_DATE_EPOCH

      # JDK_HOME and PATH are required by the build
      export JDK_HOME=$JAVA_HOME
      export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$CMAKE_HOME/bin:$syspath
      -----------

      Invoke the file 'develop.sh' to run the two builds and the unit tests:

      -----------
      #!/bin/bash
      # Creates two developer builds and runs unit tests
      trap exit INT TERM
      set -o errexit

      dir1=build1
      dir2=build2

      if [ -d $dir1 ] || [ -d $dir2 ]; then
          printf "Target directories exist: %s %s\n" $dir1 $dir2 >&2
          exit 1
      fi

      gradle () (
          set -o xtrace
          bash gradlew --no-daemon "$@"
      )

      printf "SOURCE_DATE_EPOCH=%s\n" "$SOURCE_DATE_EPOCH"
      for dir in $dir1 $dir2; do
          gradle cleanAll
          gradle sdk jmods javadoc
          mv build "$dir"
      done
      gradle sdk jmods javadoc test -x :web:test
      -----------

      WORKAROUND

      None.

            jgneff John Neffenger
            jgneff John Neffenger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: