fladle icon indicating copy to clipboard operation
fladle copied to clipboard

Fix flankAuth task compatibility with Gradle configuration cache (#381)

Open runningcode opened this issue 4 months ago • 1 comments

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:

  1. Project serialization: FlankJavaExec.kt was using project.layout.buildDirectory which requires serializing the entire Project object, violating configuration cache requirements
  2. Incompatible task registration: The flankAuth task registration in FladlePluginDelegate.kt was not using configuration cache compatible patterns

Solution

Changes Made

  1. FlankJavaExec.kt (line 20)

    • Changed from using project.layout.buildDirectory to projectLayout.buildDirectory.dir("fladle/$configName")
    • This avoids Project serialization by using the injected ProjectLayout instead
  2. 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
  3. 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

runningcode avatar Aug 30 '25 18:08 runningcode

Great! Can you ship it?

emartynov avatar Nov 17 '25 11:11 emartynov