Skip to content

Dynamic Feature Module Manifest Placeholder Invalidates Build Cache #137

@stemas

Description

@stemas

Describe the bug
The Gordon Gradle plugin creates a temporary file named PLACEHOLDER_DYNAMIC_MODULE_MANIFEST as a placeholder for the dynamicFeatureModuleManifest input property of GordonTestTask. However, because this is created as a temporary file, its name changes with each Gradle daemon process, which invalidates incremental builds and the build cache unnecessarily.

Impact
Build cache is invalidated on every daemon restart
Incremental builds don't work correctly
CI/CD pipelines and local development experience degraded performance

To Reproduce

  1. Apply Gordon to an Android [app|library|feature] module.
  2. no special setup
  3. Run the following gradle task with these arguments: "--no-daemon"
  4. All Tests are executed again without any change to the Tests or Code

Expected behavior
The second run of Gordon should not run any tests but be up-to-date instead.

Additional context
Workaround:

afterEvaluate {
    @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
    tasks.withType<com.banno.gordon.GordonTestTask>().configureEach {
        if(dynamicFeatureModuleManifest.get().asFile.name.startsWith("PLACEHOLDER_DYNAMIC_MODULE_MANIFEST")) {
            val placeholder = File(rootProject.layout.buildDirectory.get().asFile, "MY_PLACEHOLDER_DYNAMIC_MODULE_MANIFEST").apply { parentFile.mkdirs(); createNewFile() }
            dynamicFeatureModuleManifest.set(placeholder)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions