Closed
Description
Spotless supports many formatters, and they have many transitive dependencies. We write most integration code using reflection, so that we don't have to reconcile the conflicting transitive dependencies of every formatter we support.
An easier-to-use, but harder-to-setup method is to create a custom source set with compileOnly
dependencies. e.g src/main/java-scalafmt
. We're happy to accept piecemeal PR's which do this for any formatter that a contributor is interested in - no need to convert everything.
When contributing a PR of this sort, there is no need to worry about older versions of the formatter - we can always use the old reflection code to maintain support for these old versions if necessary.
Completed examples:
- ktlint Convert ktlint integration to use a compile-only sourceset. #1012
- palantir-java-format 0d83dca
- sortPom Added support for Maven POM sorting/formatting #946
- ktfmt Implemented max lines width changing support for Kotlin ktfmt formatter for Gradle plugin. #1145
- diktat Convert diktat integration to use a compile-only sourceset #1190
- scalafmt Convert scalafmt integration to use a compile-only sourceset #1283
- gson Convert Gson integration to compile-only source set #1510
- googleJavaFormat Convert GJF to compile only dependency #1630
- gherkin Feature/gherkin #1649