Daemon auto-provisioning downloads toolchain from provided url #29166
+2,820
−675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The
Daemon toolchain auto-provisioning mechanism
is part ofPhase 2
oftoolchain support for Gradle Daemon
, where the motivation behind it and other technical details can be found on the public spec document. ThisPR adds the capability for the auto-provisioning mechanism to download the toolchain given the specified url on the
gradle/gradle-daemon-jvm.properties
, supporting as well local files.Here is the summary about the changes:
SecureFileDownloader
fromresources-http
on the Launcher by creating an abstraction forSecureFileDownloader.createExternalResource
calledExternalResourceFactory
allowing to have two different implementations for daemon and tasks toolchain, since this last one is using many services outside of the scope of the LauncherJavaToolchainQueryService
and its dependencies fromtoolchain-jvm
totoolchain-jvm-shared
so it can be reused from the launcherJavaToolchainQueryService
at a higher level #24353Global
andProject
for now since it requires a major refactor to keep justGlobal
, allowing to reuse this from the Launcher. The same approach has been taken forFileResourceListener
whereEventScope
now allows an array of scopes similar toServiceScope
to be able to supportFileResourceConnector
for local file urlsDaemonJavaToolchainQueryService
implementation by reusing theJavaToolchainQueryService
from the LauncherJavaToolchainSpec
calledDaemonJvmToolchainSpec
allowing to create it based onPropertyFactory
which is available on the Launcher. This is required forJavaToolchainQueryService.findMatchingToolchain
ProgressLoggerFactory
to display the downloading progress for the toolchainHttpResourceAccessor
instead ofUrlExternalResource
since the last one doesn’t return the metadata containing the file nameAbstractProgressLoggingHandler.ProgressLoggingInputStream
moved to separate file so it can be reusedProgressLoggingInputSteamListener
toProgressLoggingInputStream
to capture read operation progress instead of build specificResourceOperation
ToolchainDownloadProgressListener
which is responsible for sending proper everts to display downloading toolchain progress on theCLI
andTAPI
:DefaultToolingImplementationLoader
was modified to includeDownload
progress related events forTAPI
since this was causing them to be ignored due toclassloader
conflict causing forDefaultFileDownloadStartEvent
:NOTE: This change was built on top of #29022 to avoid merge conflicts.
Tests
Demo
Simple demo exposing how auto-provisioning mechanism download the daemon toolchain from the specified url or from a local file. Note that the error is because of missing installation part, which will be addressed separately
Daemon.toolchain.downloaded.by.auto-provisioning.mechanism.mov
Screen.Recording.2024-05-28.at.15.28.54.mov
Contributor Checklist
<subproject>/src/integTest
) to verify changes from a user perspective<subproject>/src/test
) to verify logic./gradlew sanityCheck
./gradlew <changed-subproject>:quickTest