runningcode / gradle-doctor

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

Unable to disable caching for some task #150

Closed Tijean closed 3 years ago

Tijean commented 3 years ago

It got this error message:

| The following operations were slower to pull from the cache than to rerun:                           |
| XXXXX:dataBindingMergeDependencyArtifactsDebug                                                      |

So i tried

tasks.named("<dataBindingMergeDependencyArtifactsDebug>").configure {
    outputs.cacheIf { false }
}

But it failed because the task doesn't exist. I did confirm it by printing the tasks.

So i tried to put an hook inside the whenTaskAdded, but I still got the error message.

tasks.whenTaskAdded { task ->
    task.configure{outputs.cacheIf { task.name !=  'dataBindingMergeDependencyArtifactsDebug'}}
}

Any solution for this? This task is a major pain for us and finding a way to reduce it would help us a lot.

runningcode commented 3 years ago

can you do this with tasks.withType and pass the task class?

Tijean commented 3 years ago

Did try

tasks.withType(com.android.build.gradle.internal.tasks.databinding.DataBindingMergeDependencyArtifactsTask_Decorated.class)
tasks.withType(com.android.build.gradle.internal.tasks.databinding.DataBindingMergeDependencyArtifactsTask.class)

and both are empty.

runningcode commented 3 years ago

Hi, thanks for reporting.

Being able to disable caching of an individual task is not related to the Gradle Doctor plugin. Let's troubleshoot how to disable this task on the Gradle Forums: https://discuss.gradle.org/ or the Gradle community slack https://gradle.com/slack-invite

Thanks