Skip to content

Conversation

@tnj
Copy link
Member

@tnj tnj commented Jul 9, 2025

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

  • Enhanced BuildService Parameters: Extended the existing HttpClient BuildService to receive AGP version and plugin
    version through parameters instead of static access, eliminating configuration-time reads
  • Provider API Migration: Converted all environment variable and system property access to use Gradle's Provider API
    with proper forUseAtConfigurationTime() handling for Gradle 6.x compatibility
  • Static State Elimination: Removed static AGP version caching in AndroidGradlePlugin and updated BrowserUtils to
    accept Provider parameters instead of direct system access
  • Task Configuration: Updated all tasks to use Provider chains for extension values and added missing @Input/@Output
    annotations for proper serialization
  • Environment Handling: Deferred all environment checks (browser detection, file system operations) to task execution
    time using Provider mapping

Testing

  • Added comprehensive ConfigurationCacheSpec test suite verifying all plugin functionality
  • Added BrowserUtilsConfigurationCacheSpec for environment handling tests

tnj and others added 6 commits July 2, 2025 16:51
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>
@tnj tnj linked an issue Jul 9, 2025 that may be closed by this pull request
tnj and others added 3 commits July 9, 2025 17:07
- 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>
task.dependsOn(Constants.uploadAabTaskName(deployment.name))
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[spotless] reported by reviewdog 🐶

Suggested change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration Cache Incompatibility in DeployGate Gradle Plugin configuration-cache enabled builds are not supported yet

2 participants