Skip to content

Fix Gradle configuration cache support #169

Open
Karn wants to merge 1 commit intomozilla:masterfrom
Karn:karn--fix-configuration-cache
Open

Fix Gradle configuration cache support #169
Karn wants to merge 1 commit intomozilla:masterfrom
Karn:karn--fix-configuration-cache

Conversation

@Karn
Copy link

@Karn Karn commented Feb 14, 2026

Move all Project access out of @TaskAction methods into task properties set at configuration time. This enables Gradle's configuration cache by ensuring tasks don't reference the Project graph during execution. This should partially fix #114 (exception is when exec is set).

Changes include:

  • Make CargoBuildTask and GenerateToolchainsTask abstract with injected ExecOperations and FileSystemOperations services
  • Add @Input/@Internal properties for all values previously read from CargoExtension and Project at execution time
  • Make NDK, Toolchain, Features, and FeatureSpec implement Serializable
  • Warn of configuration cache incompatibility when the cargo.exec closure is set

This commit was co-authored by Claude Opus 4.6 (please let me know if this is a concern), but I've reviewed the changes myself, and done testing via local maven publishing with an existing project that supports a configuration cache.

  • with and without the --no-configuration-cache flags, and
  • with and without an exec block.

I'm happy to expand testing to additional cases I might have missed.

  Move all Project access out of @TaskAction methods into task properties
  set at configuration time. This enables Gradle's configuration cache by
  ensuring tasks don't reference the Project graph during execution.

  - Make CargoBuildTask and GenerateToolchainsTask abstract with injected
    ExecOperations and FileSystemOperations services
  - Add @Input/@internal properties for all values previously read from
    CargoExtension and Project at execution time
  - Make Ndk, Toolchain, Features, and FeatureSpec implement Serializable
  - Warn when cargo.exec closure is set (not compatible with config cache)
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.

Support Gradle Configuration Caching

1 participant