runningcode / gradle-doctor

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

Wishlist: produce copypastable suggestions #342

Open climategadgets opened 2 months ago

climategadgets commented 2 months ago

Existing Behavior

A pretty clear warning message is produced (trimmed for readability):

=============================== Gradle Doctor Prescriptions
| The following operations were slower to pull from the cache than to rerun:
| :...:generateGitProperties
| Consider disabling caching them.                                                                     |
| For more information see: https://runningcode.github.io/gradle-doctor/slower-from-cache/

Desired Behavior

It would be nice if the output contained a block of code that could be directly copypasted into the Gradle build file, to save an extra step of figuring out intermediaries (in this case, <taskname>, but other prescriptions will have different targets that are likely already available to Gradle Doctor internally).

runningcode commented 2 months ago

That sounds great. Do you have a suggestion on how can this be achieved?

climategadgets commented 2 months ago

Well... Let me see:

It should be simple, then, to modify the prescription so it reads something like this:

| The following operations were slower to pull from the cache than to rerun:
| :...:generateGitProperties| Consider disabling caching them.
| Add this block into your Gradle build file to achieve this:
tasks.named("<GenerateGitPropertiesTask>").configure {
    outputs.cacheIf { false }
}
| For more information see: https://runningcode.github.io/gradle-doctor/slower-from-cache/

Does that sound right?