Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task ':explodeCodeSource' uses this output of task ':kspKotlin' without declaring an explicit or implicit dependency #1185

Open
Mrkchv opened this issue May 3, 2024 · 3 comments
Labels
blocked-by-gradle Blocked due to issue with Gradle itself bug Something isn't working more information needed toolchain:kotlin

Comments

@Mrkchv
Copy link

Mrkchv commented May 3, 2024

Plugin version
1.31.0

Gradle version
8.4

JDK version
17

Kotlin and Kotlin Gradle Plugin (KGP) version
1.9.20

Android Gradle Plugin (AGP) version
8.3.2

Describe the bug
After bumping to 1.31.0 we get this error:

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app:kspGoogleDebugKotlin' (type 'KspTaskJvm').
  - Gradle detected a problem with the following location: '/Users/Developer/StudioProjects/mobilebank-android/app/build/generated/ksp/googleDebug'.
    
    Reason: Task ':app:explodeCodeSourceGoogleDebug' uses this output of task ':app:kspGoogleDebugKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':app:kspGoogleDebugKotlin' as an input of ':app:explodeCodeSourceGoogleDebug'.
      2. Declare an explicit dependency on ':app:kspGoogleDebugKotlin' from ':app:explodeCodeSourceGoogleDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:kspGoogleDebugKotlin' from ':app:explodeCodeSourceGoogleDebug' using Task#mustRunAfter.
    
For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

We can specify the dependency of the :explodeCodeSource task on :kspKotlin as follows and it will work:

allprojects.forEach { project ->
        project.tasks.withType<CodeSourceExploderTask>().configureEach {
            dependsOn(*project.tasks.withType<KspTaskJvm>().toTypedArray())
        }
}

Before bumping to 1.31.0 we used 1.25.0 and did not get the error. The error occurs on versions higher than 1.29.0.

@autonomousapps
Copy link
Owner

Thanks for the issue. Do you have a minimal reproducer?

@autonomousapps autonomousapps added bug Something isn't working more information needed labels May 4, 2024
@Mrkchv
Copy link
Author

Mrkchv commented May 6, 2024

@autonomousapps Unfortunately I cannot share the code of our project. I also tried to make a test project, but I didn't get the error. Perhaps the logs will be useful project_health_debug_log.txt.zip

@autonomousapps
Copy link
Owner

My working assumption is that this is another instance of this Gradle bug, except that you say this only appears on 1.30.0 and higher. A reproducer would be very useful.

@autonomousapps autonomousapps added the blocked-by-gradle Blocked due to issue with Gradle itself label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-gradle Blocked due to issue with Gradle itself bug Something isn't working more information needed toolchain:kotlin
Projects
None yet
Development

No branches or pull requests

2 participants