JDK-8307082 : Build path is recorded in JavaFX Controls module
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: jfx21
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2023-04-28
  • Updated: 2024-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Relates :  
Description
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.

Comments
It would be good to find a solution that also fixes the related problem identified by Armin Schrenk on the mailing list, linked below: Bug using binary stylesheets: Loading relative @font-face paths are converted to absolute ones https://mail.openjdk.org/pipermail/openjfx-dev/2023-March/039374.html
02-05-2023

[~jgneff] Thanks for catching this bug. I changed the fix version to "tbd" (rather than jfx22), since it would be good to fix this in jfx21. I also raised the priority to P3. In addition to the problem of reproducibility, it is a bad idea to record absolute build paths in build artifacts.
28-04-2023