#31659 Add support for relative java installation paths for Daemon toolchain#32869
Conversation
Signed-off-by: Madalin Valceleanu <vmadalin@google.com> (cherry picked from commit cf5f11231c4ed229bf7859d04267697838861619)
cf5f112 to
c701334
Compare
|
It feels odd to me to support relative paths here. Obviously, the relative path needs to be calculated relative to some path, but which one? You could argue a number of base paths are equally relevant including:
The CWD probably does not make much sense, but in what case does the path of the project make sense? Do we really want to support/promote the pattern where JDKs are installed relative to the project? This seems to tie in builds tightly to a certain directory structure of a given machine, which seems unwise |
|
we have use cases of projects setup exactly like that. Now that we have the right scope for those services, this gives a clear contract - that should be documented:
|
|
Looks like I approved and merged this a bit too eagerly. This is not working as intended. When running Gradle inside the So I will be reverting those changes. |
Created #32894 to re-enable it after addressing the missed scenario that somehow I still missed it despite validating with composite builds and using |
Context
This was reported on #31659 and in addition represents a misalignment between
Daemon toolchainandtasks/project toolchainwhere the last one already supports relative paths, while for Daemon toolchain fails with the following exception message:For
Daemon toolchaintheDaemonClientToolchainServicesend up instantiatingLocationListInstallationSupplierusing the providedFileResolverbeingIdentityFileResolverclass this is because on Launcher context most of the services aren't available. However, theIdentityFileResolverdoesn't support relative paths and insteadBaseDirFileResolvershould be used instead which requires thebaseDirto resolve the relative path. To obtain project dirctory from the launcher context theBuildLayoutParameters.currentDiris used being this aligned with how projectgradle-daemon-jvm.propertiesare read as a criteria for the Daemon JVM.NOTE: All of this aligns with the task/project toolchain behavior for custom toolchain when
org.gradle.java.installations.pathsis defined underGRADLE_HOMEinstead of the project.Tests
Contributor Checklist
<subproject>/src/integTest) to verify changes from a user perspective.<subproject>/src/test) to verify logic../gradlew sanityCheck../gradlew <changed-subproject>:quickTest.