JDK-8297042 : gradle -PBUILD_SDK_FOR_TEST=false fails with gradle 7.6
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: jfx20
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-11-15
  • Updated: 2023-10-12
  • Resolved: 2022-11-16
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
jfx20 b08Fixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Description
To reproduce, run the following using gradle 7.6 RC3:

$ gradle sdk
$ gradle --info -PBUILD_SDK_FOR_TEST=false test

<==-----------> 15% CONFIGURING [3s]> IDLE
FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\kcr\javafx\jfx-kcr\jfx\rt\build.gradle' line: 615

* What went wrong:
A problem occurred evaluating root project 'rt'.
> No signature of method: org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.useFilter() is applicable for argument types: (build_32ube911nql8mvr8torfp363j$_run_closure1) values: [build_32ube911nql8mvr8torfp363j$_run_closure1@1679a7fe]


By way of background, setting the gradle "-PBUILD_SDK_FOR_TEST=false" flag can be used when running tests to avoid a complete build of the sdk. This flag is only partially effective, since building and running the tests unconditionally depend on the shims, which in turn depend on the module classes, even when "BUILD_SDK_FOR_TEST" is false. It does speed up the build somewhat in that it won't rebuild any of the native code

Comments
Changeset: 6cc9c4d1 Author: Kevin Rushforth <kcr@openjdk.org> Date: 2022-11-16 13:03:13 +0000 URL: https://git.openjdk.org/jfx/commit/6cc9c4d1b9a46432f1568a54d7dcdf51e224559b
16-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jfx/pull/949 Date: 2022-11-15 14:21:12 +0000
15-11-2022

The root cause is that `gradle.taskGraph.useFilter` is not public API, but is an implementation detail that happened to "work" up until recently, but stopped working some time between gradle 7.3 and gradle 7.6. I say "worked" in quotes, because there is effectively no difference in what gets run because of the dependency on the shims. The simple fix is to remove the following logic from build.gradle, which was added by JDK-8166662 back in the JDK 9 time frame. Removing this part of the logic has no perceived impact, and will allow us to update to gradle 7.6 when the GA is released. -// All "classes" and "jar" tasks and their dependencies would be disabled -// when running with DO_BUILD_SDK_FOR_TEST=false as they're unneeded for running tests -if (!DO_BUILD_SDK_FOR_TEST) { - gradle.taskGraph.useFilter({ task -> !task.name.equals("classes") && !task.name.equals("jar") }) -} Longer term, I will file an Enhancement to add a new mode that cleanly separates build from test (the current approach is insufficient).
15-11-2022