Skip to content

Running kspCommonMainKotlinMetadata twice turns generated files into directories #2230

@eygraber

Description

@eygraber

Tested with 2.1.0-RC2-1.0.28 and 2.0.21-1.0.28.

Using https://github.com/eygraber/kotlin-inject/tree/ksp2, if you run ./gradlew :integration-tests:module:kspCommonMainKotlinMetadata it succeeds, and there are two generated Kotlin files under integration-tests/module/build/generated/ksp/metadata/commonMain/kotlin/me/tatarka/inject/test/module

If you then run it again, it fails with:

e: [ksp] java.io.FileNotFoundException: /home/eli/workspace/kotlin-inject/integration-tests/module/build/generated/ksp/metadata/commonMain/kotlin/me/tatarka/inject/test/module/InjectExternalParentComponent.kt (Is a directory)

and all of the files under integration-tests/module/build/generated/ksp/metadata/commonMain/kotlin/me/tatarka/inject/test/module are directories.

Running the task again after the failure succeeds.

Adding the following to integration-tests/module/build.gradle.kts prints false during the run that the task fails, indicating that it is probably something in the task that is changing the file into a directory:

tasks.all {
    if(name == "kspCommonMainKotlinMetadata") {
        doFirst {
            println("!!!!!!!!!!!!!!!${File("/home/eli/workspace/kotlin-inject/integration-tests/module/build/generated/ksp/metadata/commonMain/kotlin/me/tatarka/inject/test/module/InjectExternalParentComponent.kt").isDirectory}")
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions