-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use reflection for Gradle agent adapters #115
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`BuildCacheAdapter` and implementations have been replaced by `BuildCacheConfigurationAdapter`.
By using reflection for all property access, we now support configuring 3 different remote cache implementations with a single reflecting adapter: - org.gradle.caching.http.HttpBuildCache - com.gradle.develocity.agent.gradle.buildcache.DevelocityBuildCache - com.gradle.enterprise.gradleplugin.GradleEnterpriseBuildCache Also extracted out `ReflectionProperty` utility type for future reflecting adapters.
A single reflecting adapter handles both the com.gradle.enterprise and com.gradle.develocity types: - com.gradle.scan.plugin.BuildScanDataObfuscation - com.gradle.develocity.agent.gradle.scan.BuildScanDataObfuscationConfiguration
A single reflecting adapter handles both the com.gradle.enterprise and com.gradle.develocity types: - com.gradle.develocity.agent.gradle.scan.BuildScanCaptureConfiguration - com.gradle.scan.plugin.BuildScanExtension - Handles versions with `getCapture()` as well as older versions with `isCaptureTaskInputFiles()`
- Methods: tag(), value(), link() - Properties: termsOfUseUrl, termsOfUseAgree, uploadInBackground Now have a shared implementation for these methods across all DV/GE extension types.
- background() - buildFinished() Method invocation utilities needed to be updated to cope with overloaded methods like `background(Runnable)` and `background(Action)`.
This completes the migration of all functionality to reflection.
All adapter functions are now implemented via reflection, so casting to specific extension types is no longer required. This assists with compatibility in mixed-classloader environments. See gradle/develocity-ci-injectioni#37
erichaagdev
approved these changes
Mar 25, 2025
...lityApi/java/com/gradle/develocity/agent/gradle/adapters/BuildCacheConfigurationAdapter.java
Outdated
Show resolved
Hide resolved
...patibilityApi/java/com/gradle/develocity/agent/gradle/adapters/internal/ReflectionUtils.java
Show resolved
Hide resolved
...om/gradle/develocity/agent/gradle/adapters/shared/ReflectingBuildScanObfuscationAdapter.java
Show resolved
Hide resolved
...com/gradle/develocity/agent/gradle/adapters/enterprise/BuildScanCaptureExtensionAdapter.java
Outdated
Show resolved
Hide resolved
pshevche
approved these changes
Mar 26, 2025
erichaagdev
approved these changes
Mar 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In order to function correctly when the adapter and the DV plugin are loaded in different
classloaders, we now avoid casting to DV-plugin types when adapting.
By using reflection consistently for all adapting functionality, the Gradle adapter library
should be more robust in the face of different plugin versions and different classloaders.
When merged into the CCUD Gradle Plugin, this should fix gradle/develocity-ci-injection#37