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

Non-reproducible behavior around dependency verification with Spotless plugin #815

Closed
JLLeitschuh opened this issue Mar 11, 2021 · 5 comments

Comments

@JLLeitschuh
Copy link
Member

See: gradle/gradle#16500

@nedtwigg
Copy link
Member

Seems like this is becoming an issue for more people, so I'll outline some fixes.

Easy surface fix

One thing which might work is to switch from detached configurations to named configurations.

Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps);
config.setDescription(mavenCoords.toString());
config.setTransitive(withTransitives);
return config.resolve();

I would do this by generating a name like spotless<Hash> using GradleProvisioner.Request::hashCode. This is pretty easy to try, and it might completely fix the issues linked above.

Hard deep fix

A harder thing to do is to rip up the entire FormatterStep abstraction to somehow add a way to expose the maven coordinates needed by that FormatterStep. This would be a major effort, but would unblock #834, #724, and maybe #644 too.

This deeper fix should be slower than what we're doing now. Rather than resolving google-java-format (or whatever) one time in the root project, we would be resolving it over and over in every subproject. But what we are doing now seems to be swimming upstream from Gradle, so maybe it would actually be faster.

Implementing

Doing the easy fix is easy, but it's not gonna make the top of my todo. If anyone wants to submit a PR, I'd be happy to merge and release.

Doing the deeper fix is hard. If somebody wants to try, by all means feel free to take a shot. If you build something that works and fixes all the problems, I'll be happy to merge and release quickly. But there will certainly be lots of breaking changes in the lib and lib-extra projects, and probably lots of getting stuck. I'll try to help you get unstuck, but I can't make any SLA guarantees :)

@nedtwigg
Copy link
Member

In plugin-gradle 5.12.4, I implemented the shallow fix. We'll see if that solves the immediate issue...

@JLLeitschuh
Copy link
Member Author

Rather than resolving google-java-format (or whatever) one time in the root project, we would be resolving it over and over in every subproject. But what we are doing now seems to be swimming upstream from Gradle, so maybe it would actually be faster.

I have a hunch that Gradle's heavy use of caching won't have a huge impact on performance.

@nedtwigg
Copy link
Member

nedtwigg commented Nov 7, 2021

@nedtwigg
Copy link
Member

nedtwigg commented Nov 9, 2021

According to my testing, fixed by gradle/gradle#18915

@nedtwigg nedtwigg closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants