runningcode / gradle-doctor

The right prescription for your Gradle build.
http://runningcode.github.io/gradle-doctor
Apache License 2.0
723 stars 47 forks source link

Could not create task ':sharedComposables:clean'. #166

Closed ColtonIdle closed 2 years ago

ColtonIdle commented 2 years ago

After upgrading to latest I get a ton of messages that all have the same caused by message.

Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':sharedComposables:clean'.

sharedComposables is a KMM module that houses my shared android and desktop code. Gradle in general is a place that I flounder. Not sure how best to move forward.

ColtonIdle commented 2 years ago

Also, if I try to disable it (it's not in the configuration docs, but I'm guessing the configuration name) it doesn't let me?

Screen Shot 2021-08-10 at 2 57 51 PM
ColtonIdle commented 2 years ago

Here's the full error message actually

================ Gradle Doctor Prescriptions ================
| Adding dependencies to the clean task could cause unexpected build outcomes.                         |
| Please remove the dependency from task ':sharedComposables:clean' on the following tasks: [provider(task 'clea |
| nAllTests', interface org.gradle.api.Task)].                                                         |
| See github.com/gradle/gradle/issues/2488 for more information.                                       |
====================================================
runningcode commented 2 years ago

Hi, thanks for reporting this. Does it work if you follow the Kotlin example in the documentation on how to set this property? https://runningcode.github.io/gradle-doctor/configuration/

Click the Kotlin tab to see the documentation in kotlin.

runningcode commented 2 years ago

Can you tell me more about the cleanAllTests task? Is that a task that you have written and wired to clean?

ColtonIdle commented 2 years ago

@runningcode thanks. I swear I looked for the config earlier and I didn't see it.

I added this

doctor {
    disallowCleanTaskDependencies.set(false)
}

and I'm able to build now!

Can you tell me more about the cleanAllTests task? Is that a task that you have written and wired to clean?

This isn't anything that I added. Maybe it comes with KMM?

Screen Shot 2021-08-11 at 9 54 00 AM
ColtonIdle commented 2 years ago

Okay. I found a project that you can repro with if you'd like

Checkout the jb compose multiplatform project

https://github.com/JetBrains/compose-jb/tree/master/templates/multiplatform-template

add this to the root

plugins { id("com.osacky.doctor") version "0.7.1" }

Hit run and you get

Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':common:clean'.

runningcode commented 2 years ago

Thanks for reporting and the repro case @ColtonIdle. I've found out where this is happening in KGP: https://github.com/JetBrains/kotlin/blob/3df45f9651c1b902f86b30a32f18b6d5d7d79520/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/testing/internal/KotlinTestsRegistry.kt#L107

This is not a good practice. I will discuss what to do about this.

ColtonIdle commented 2 years ago

Yay! We did it!

runningcode commented 2 years ago

Closing since this was a bug in KGP.