You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spotless gradle is super slow and doesn't appear to respect the -PspotlessFiles flag #557
Using id "com.diffplug.gradle.spotless" version "3.28.1"
I'm seeing a spotlessApply, which it thinks is cached, taking over a minute.
For this build I also ran it with the -PspotlessFiles=build.gradle flag, which I would think should cut down on the time to run but it's still taking over a minute. The only thing that changed was a single white space.
Your build time is long because your targets are all **/*.xx. It would be a lot faster if it were instead src/xx/**/*.xx or *.xx. The time is being consumed in giant directory traversals looking for .xx files, then again in another giant traversal to look for .yy files, and so on.
With -PspotlessFiles, you're not specifying the target, you're just filtering it. So it still has to resolve every directory traversal, and then see if any of those files String#matches(String) the regex that you've passed (might want to escape the . by the way).
What are you using -PspotlessFiles for? Would #511 work for you?
So interesting find, Changing the way I bring in the plugin, it's now running in under 10 seconds. Using the older classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.28.1 has helped.
I don't know why changing the way the dependency is imoported drastically changes run times.
#511 would roughly work, it looks like that's an open issue. They're trying to more or less achieve the same thing I am, and that Spotless only runs on files that have changed since the last commit.
If you change back to the “slow” way, is it still slow? Or are they the same speed now? There’s a lot of caching going on, I wouldn’t expect any speed difference between the two approaches.
Happy to reopen if you find more info, but I suspect that implementing #511 is going to be the final solution to this, -PspotlessFiles has proven to be tricky for people to use.
Activity
nedtwigg commentedon Apr 22, 2020
Your build time is long because your targets are all
**/*.xx. It would be a lot faster if it were insteadsrc/xx/**/*.xxor*.xx. The time is being consumed in giant directory traversals looking for.xxfiles, then again in another giant traversal to look for.yyfiles, and so on.With
-PspotlessFiles, you're not specifying the target, you're just filtering it. So it still has to resolve every directory traversal, and then see if any of those filesString#matches(String)the regex that you've passed (might want to escape the.by the way).What are you using
-PspotlessFilesfor? Would #511 work for you?dphart commentedon Apr 22, 2020
So interesting find, Changing the way I bring in the plugin, it's now running in under 10 seconds. Using the older
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.28.1has helped.I don't know why changing the way the dependency is imoported drastically changes run times.
#511 would roughly work, it looks like that's an open issue. They're trying to more or less achieve the same thing I am, and that Spotless only runs on files that have changed since the last commit.
nedtwigg commentedon Apr 22, 2020
If you change back to the “slow” way, is it still slow? Or are they the same speed now? There’s a lot of caching going on, I wouldn’t expect any speed difference between the two approaches.
nedtwigg commentedon Apr 28, 2020
Happy to reopen if you find more info, but I suspect that implementing #511 is going to be the final solution to this,
-PspotlessFileshas proven to be tricky for people to use.