-
Notifications
You must be signed in to change notification settings - Fork 357
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
gradlew reformat takes 25 seconds even for back-to-back executions #3735
Comments
I agree it takes too long. The problem is that it calls run-google-java-format, which itself makes multiple passes over every file. The best way for you to improve this would be to upvote or comment on google/google-java-format#5. run-google-java-format has a hard-coded list of known type annotations, and it ought to be straightforward for google-java-format to take this approach as well. To avoid re-checking, run-google-java-format could cache the hash of each file that is correctly annotated, and avoid any work for such a file. That would address your concern. Feel free to open a pull request. (I don't encounter this problem because I don't run |
A slightly different angle might be to use https://github.com/autostyle/autostyle or https://github.com/diffplug/spotless to drive the formatter. Then incremental processing will be done by Gradle. Thanks for the pointers though. |
Can autostyle and spotless call out to an external formatter? If their default formatting is wrong for type annotations (as that of google-java-format is), they would need to invoke run-google-java-format. If they can do so, that would be a worthwhile integration to write. If they cannot do so, then run-google-java-format (currently written in Python) could be re-implemented as a plugin to one of them. (Is autostyle a hard fork of spotless? The README doesn't state the relationship between them.) |
Most of the formatters are external. I guess run-google-java-format could be plugged.
It is. Here's background: autostyle/autostyle#20 (comment) |
Build scan: https://scans.gradle.com/s/v3h4b4q56gj42/timeline
It would be nice if
./gradlew reformat
was incremental.The text was updated successfully, but these errors were encountered: