-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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 #16500
Comments
Spotless resolves all dependencies (including for formatters used in subprojects) in the root project. The legacy chain which leads to this is:
A All built-in Spotless tasks can be serialized, but some custom steps containing arbitrary closures cannot. In this way users can "opt-out" of fast up-to-date checks if the benefit of custom closures are worth it. So I'm guessing that the build in question uses a This design arose organically from something that worked well in Gradle 2.x, which has been adapted over time so that our users have never had to change their Spotless blocks even as Gradle improved/strict-ified the underlying infrastructure. This design is an obstacle to supporting Configuration Cache, so we may have to give up on resolving dependencies from buildscript repositories, and instead declare If our weirdness was helpful in exposing a corner-case that you care about, then you're welcome! Or if it's a corner-case which you would prefer to just make illegal, that's fine too, and we can eventually adapt to it :) |
Thanks @nedtwigg for the explanation! There are a few things here:
|
I'm confident that Spotless isn't downloading stuff that the user isn't asking for. Spotless integrates with a huge number of versions of a large number of formatters (which is why we bother to download deps dynamically at all). If we were accidentally downloading all of them willy-nilly it would be as slow as our full test suite, which is very very slow because of so many deps. Are you sure the string We will probably eventually use project-space resolution for the purpose of Configuration Cache, but it ought to be strictly slower than the current approach, unless maybe you do inter-project memoization for subprojects which request the same deps, in which case it will be the same speed. That's all that we are doing - inter-project memoization of dep resolution. We're doing it because we had no other choice, but it's a speedup regardless.
I use it a lot! I've discussed this with other Gradle folks - it's incredibly useful to be able to specify a function as an up-to-dateable input. So it'll definitely stick around, but either way it sounds like it isn't the main thing happening here.
Ah, perhaps a reprise of #11752. It looks like the way we download dependencies is triggering a race-condition in gradle's dep resolution. If you'd like another example, this test is ignored because resolving arbitrary dependencies has worked and broken back and forth between different gradle versions: diffplug/spotless#429 Gradle has APIs for |
This might be fixed in Spotless |
Issue: #16500 Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
Issue: #16500 Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
In the Gradle build, when I execute
:file-watching:check
(using commita6ca78d99a8ec4448b4eb1ee802ab763bce40b43
) I sometimes get a passing build, but sometimes it fails with a dependency verification issue (that is wrapped in a snapshotting error message because of #13276 (comment), but that's besides the point):Adding a few empty lines to one of the source files (
DefaultFileWatcherRegistry
) caused the build to pass after a failure, too.It looks like Spotless does something strange wrt adding dependencies during execution time in here:
https://github.com/diffplug/spotless/blob/gradle/5.10.2/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java#L63-L84
...but nothing that says the result should be non-deterministic.
cc: @gradle/execution
The text was updated successfully, but these errors were encountered: