gradle-doctor
gradle-doctor copied to clipboard
Wishlist: produce copypastable suggestions
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).
That sounds great. Do you have a suggestion on how can this be achieved?
Well... Let me see:
- Gradle Doctor is already able to figure out which component is misbehaving (
generateGitProperties), and how exactly (faster to rerun than to extract from the cache) - I don't know enough about Gradle to be 100% sure, but I would guess that there's a short traversable path from the user visible task name to its class,
GenerateGitPropertiesTask - The solution is already documented at https://runningcode.github.io/gradle-doctor/slower-from-cache/
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?