fladle
fladle copied to clipboard
Fix flankAuth task compatibility with Gradle configuration cache (#381)
Problem
Issue #381 reported that the flankAuth task was not compatible with Gradle's configuration cache, causing serialization errors when the configuration cache was enabled.
Root Cause
The issue was caused by two main problems:
-
Project serialization: FlankJavaExec.kt was using
project.layout.buildDirectorywhich requires serializing the entire Project object, violating configuration cache requirements - Incompatible task registration: The flankAuth task registration in FladlePluginDelegate.kt was not using configuration cache compatible patterns
Solution
Changes Made
-
FlankJavaExec.kt (line 20)
- Changed from using
project.layout.buildDirectorytoprojectLayout.buildDirectory.dir("fladle/$configName") - This avoids Project serialization by using the injected ProjectLayout instead
- Changed from using
-
FladlePluginDelegate.kt (lines 25-33)
- Updated flankAuth task registration to use configuration cache compatible approach
- Used local variables to capture configuration and directory references
- Restored proper directory creation using doFirst block with configuration cache safe operations
-
ConfigurationCacheTest.kt (lines 108, 113)
- Updated test assertions to match the new expected behavior
- Verified that configuration cache entries are properly stored and reused
Testing
- All 5 configuration cache tests now pass (100% success rate)
- flankAuth task successfully stores and reuses configuration cache
- Real testing confirms proper OAuth authentication flow starts
- No Project serialization errors
Verification
The fix has been thoroughly tested:
- Configuration cache tests all pass
- flankAuth task works correctly with configuration cache enabled
- OAuth authentication flow functions as expected
- No regression in existing functionality
Fixes #381
Great! Can you ship it?