Add Gradle Configuration Cache Support#272
Merged
Merged
Conversation
Implement full Configuration Cache compatibility for the DeployGate plugin to improve build performance and enable caching of task configuration. Changes: - Add endpoint property to upload tasks to eliminate project access during execution - Replace @internal with @nested annotations for proper input tracking - Use Gradle logging instead of System.out for Configuration Cache compliance - Defer file operations from configuration to execution time - Add endpoint configuration to DeployGateExtension with default value - Update task configuration to capture endpoint for browser opening This enables faster incremental builds and better build reproducibility when using Gradle's Configuration Cache feature. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace direct project.deploygate access with Provider API - Remove static state from GradleCompat and use provider-based approach - Pass AGP version through BuildService parameters instead of static access - Replace Config.shouldOpenAppDetailAfterUpload() with Provider-based approach - Add proper @Input/@output annotations to task properties - Fix eager property access in task getDescription() methods - Maintain backward compatibility with Gradle 6.7.1+ - Preserve variant name display in task descriptions BREAKING CHANGE: None - all changes maintain backward compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated PackageAppTaskCompat to accept AGP version as a parameter for APK and AAB info retrieval. - Modified AndroidGradlePlugin to remove static AGP version caching and introduced version string parameterization. - Enhanced HttpClient to include plugin version details in HTTP headers. - Refactored BrowserUtils to support configuration cache with ProviderFactory, ensuring environment checks are deferred. - Improved LoginTask and UploadArtifactTask to utilize ProviderFactory for browser opening logic. - Added ConfigurationCacheSpec to validate plugin compatibility with Gradle's configuration cache feature. - Created TestHelper and TaskTestHelper classes to streamline test setup and reduce boilerplate code. - Implemented BrowserUtilsConfigurationCacheSpec to ensure provider-based methods work correctly without direct system access. - Updated UploadArtifactTaskSpec to utilize new input parameter handling and provider factory integration.
- Add missing @input and @InputFile annotations to AabInfo and ApkInfo interfaces - Fix BrowserUtils to use forUseAtConfigurationTime() wrapper for Provider access - Add release build type configuration to ConfigurationCacheSpec tests - Prevent browser from actually opening during BrowserUtilsConfigurationCacheSpec tests All tests now pass successfully with configuration cache enabled. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix BrowserUtilsSpec to mock hasBrowserLegacy instead of hasBrowser The openBrowser(String) method delegates to legacy implementation - Fix BrowserUtilsConfigurationCacheSpec provider chain test Use mock providers instead of actual environment access to avoid configuration time provider evaluation issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix BrowserUtilsSpec test by mocking CI environment check - Update BrowserUtilsConfigurationCacheSpec to use parameterized tests with mock providers - Fix UploadArtifactTask to remove extra .get() call on Boolean value 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
tnj
commented
Apr 9, 2026
| } | ||
| } | ||
|
|
||
| static boolean shouldOpenAppDetailAfterUpload() { |
Member
Author
There was a problem hiding this comment.
Replaced with openBrowserAfterUpload property in UploadArtifactTask
isInternalSigningConfigData / hasOutputsHandlerApiOnPackageApplication compared major and minor independently (major >= 8 && minor >= N), which breaks once AGP's major version increments. For example AGP 9.x reports a minor < 3, so it incorrectly took the legacy signingConfigData / variantOutputs code paths that no longer exist on modern PackageAndroidArtifact. Use VersionString's semantic comparison (>= 8.3.0 / >= 8.1.0) instead. Add a unit test that locks in the major-version-bump behavior (AGP 9.x/10.x), and extend the acceptance test matrix up to AGP 8.13.0 with their minimum Gradle versions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…env parsing - UploadArtifactTask: give `endpoint` (DEPLOYGATE_ROOT) and `openBrowserAfterUpload` (false) conventions so a task that isn't fully wired (manual creation, tests) does not throw at `endpoint.get()` — which the `revision == 1` branch can reach even when openBrowser is disabled. - DeployGatePlugin: parse DEPLOYGATE_OPEN_BROWSER as common truthy tokens (1/true/yes/on). `String#toBoolean()` accepted only "true" (silently ignoring 1/yes), and a plain non-empty check would wrongly enable it for "false". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
satsukies
requested changes
Jun 3, 2026
satsukies
left a comment
Member
There was a problem hiding this comment.
Thank you for working!
Please check my comments.
…st helpers - GradleCompat.forUseAtConfigurationTime: restore the Gradle-version check (call only below 7.0) instead of try/catch, which invoked the deprecated-on-7.4+ method and emitted warnings on Gradle 7.x/8.x. - Remove unused TestHelper and TaskTestHelper (no callers) and the dead TestHelper import in UploadArtifactTaskSpec. - DEPLOYGATE_OPEN_BROWSER: preserve the original Groovy truthiness (any non-empty value enables it) instead of an allow-list, keeping the behavior unchanged. - CHANGELOG: note configuration cache support. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Resolve the AGP version eagerly inside AndroidGradlePlugin.ifPresent (where AGP is guaranteed applied) and pass the plain String plus the buildDirectory Provider into createApkInfoProvider/createAabInfoProvider. The apkInfo/aabInfo task-input provider chains no longer capture the Project, fixing the latent configuration-cache violation on the variant artifact path. - Make the implicit `deployment` in the variant configure blocks explicit as `task.deployment` to remove the confusing Groovy-delegate resolution. Behavior is unchanged (verified by the acceptance suite, incl. the skipAssemble cases). Verified with the example app on Gradle 6.7.1 + AGP 4.2.0: the configuration cache entry is stored and reused with no problems for the variant upload tasks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
satsukies
approved these changes
Jun 8, 2026
satsukies
left a comment
Member
There was a problem hiding this comment.
Thank you for making some fixes. LGTM
Comment on lines
+31
to
+42
| /** | ||
| * Handle forUseAtConfigurationTime compatibility. | ||
| * | ||
| * {@code Provider#forUseAtConfigurationTime()} is only required to read providers at | ||
| * configuration time on Gradle 6.x. It was deprecated in Gradle 7.4 (so calling it on 7.0+ | ||
| * emits a deprecation warning) and removed in Gradle 9.0. We therefore only invoke it on | ||
| * Gradle below 7.0 and return the provider untouched otherwise. | ||
| * | ||
| * ref: https://github.com/gradle/gradle/issues/15600 | ||
| */ | ||
| static <T> Provider<T> forUseAtConfigurationTime(Provider<T> provider) { | ||
| if (getVersion().major >= 7) { | ||
| // removed since 7.0 ref: https://github.com/gradle/gradle/issues/15600 | ||
| if (GradleVersion.current().baseVersion >= GradleVersion.version("7.0")) { |
Member
There was a problem hiding this comment.
Nice. The reason is clear in the block comments.
Member
Author
|
Thanks, I'll merge it with #283 |
This file contains hidden or 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
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.
This fixes #148 and #270
This PR adds full support for Gradle's configuration cache feature to the DeployGate plugin, enabling faster builds through cached configuration reuse.
Changes
HttpClientBuildService to receive AGP version and pluginversion through parameters instead of static access, eliminating configuration-time reads
with proper
forUseAtConfigurationTime()handling for Gradle 6.x compatibilityAndroidGradlePluginand updatedBrowserUtilstoaccept Provider parameters instead of direct system access
@Input/@Outputannotations for proper serialization
time using Provider mapping
Testing
ConfigurationCacheSpectest suite verifying all plugin functionalityBrowserUtilsConfigurationCacheSpecfor environment handling tests