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

Wishlist: produce copypastable suggestions #342

Open
climategadgets opened this issue Apr 18, 2024 · 2 comments
Open

Wishlist: produce copypastable suggestions #342

climategadgets opened this issue Apr 18, 2024 · 2 comments

Comments

@climategadgets
Copy link

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
Copy link
Owner

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

@climategadgets
Copy link
Author

climategadgets commented Apr 18, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants