-
Notifications
You must be signed in to change notification settings - Fork 110
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
Provide a mechanism to configure the source sets to which Java Format is applied #425
Comments
Unfortunately, Spring Java Format doesn't know anything about AOT and nor should it. Creating that knowledge would introduce a cycle between Java Format (which would have to know about the AOT plugin and source set created by Spring Boot) and Spring Boot (which uses Spring Java Format). Instead, I would recommend that you avoid this either as you have shown above or in the same way as other projects have done in the past. For example, the AOT smoke tests update the start parameters to exclude the unwanted tasks from execution. |
I've just remembered that Framework adds an annotation to AOT-generated classes to indicate that they've been generated and wondered if we could use this to skip the source when checking it. Unfortunately, this isn't a general-purpose annotation but That said, the Checkstyle configuration already has some knowledge of Framework types so maybe it's not a concern. |
I think we should provide a mechanism to configure the sources sets to which Java Format is applied. That could then either be used manually in projects that both apply Java Format and use AOT or perhaps we can explore ways of somehow doing it automatically. For example, Spring Boot's Gradle Plugin could react to the combination of Java Format and AOT by configuring Java Format to ignore the |
I think a |
If I create a project that uses
io.spring.javaformat
and also the needed Boot and other plugins to support AOT compilation, then./gradlew check
and./gradlew format
fail. This ticket focuses on making./gradlew check
work.Spring JavaFormat seems to scan the AOT-generated directories for formatting and checkstyle issues resulting in the following error on a vanilla AOT project that also uses JavaFormat:
Running checkFormat is not ideal against AOT sources since they don't follow the formatting guidelines. Also, I don't need to ensure that they follow my checkstyle rules.
I can fix this by disabling the corresponding tasks:
It seems the ideal would be that these tasks not exist, but I'm not sure what is reasonable to change.
For additional context, this comes up in the Spring Security Samples project, where we use JavaFormat to keep the samples uniform. When we recently added an AOT sample, we ran into this behavior.
The text was updated successfully, but these errors were encountered: