-
Notifications
You must be signed in to change notification settings - Fork 459
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
Using a kotlin closure for custom
step no longer works in Gradle plugin
#2387
Comments
So Groovy Closures take this codepath spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java Lines 458 to 461 in 8219f37
And Kotlin takes this one spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java Lines 484 to 488 in 8219f37
spotless/lib/src/main/java/com/diffplug/spotless/FormatterFunc.java Lines 27 to 28 in 8219f37
I suppose this workaround should work java {
custom("Refuse wildcard imports", object : Serializable, FormatterFunc {
override fun apply(input: String) : String {
if (input.contains("*;\n")) {
throw GradleException("No wildcard imports allowed.")
}
}
})
} but it's not great... Gradle jumped through a bunch of hoops to make the Groovy Closure serialization work, I wonder if they have any tricks up their sleeve for Kotlin script... |
Thanks @nedtwigg, your workaround (with a |
We had this issue as well on Mockito. Thanks for the workaround. I wonder if making |
#3571) Bumps [com.diffplug.spotless:spotless-plugin-gradle](https://github.com/diffplug/spotless) from 6.25.0 to 7.0.1. - [Release notes](https://github.com/diffplug/spotless/releases) - [Changelog](https://github.com/diffplug/spotless/blob/main/CHANGES.md) - [Commits](diffplug/spotless@gradle/6.25.0...gradle/7.0.1) --- updated-dependencies: - dependency-name: com.diffplug.spotless:spotless-plugin-gradle dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Workaround for spotless 7.0.0 bug See diffplug/spotless#2387 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Brice Dutheil <[email protected]>
Using a kotlin closure for
custom
step no longer works in Gradle pluginGradle 8.12
7.0.0 and 7.0.1
Mac/latest
gradlew spotless[Apply/Check] --stacktrace
The text was updated successfully, but these errors were encountered: