Skip to content

Commit

Permalink
Allow overriding eclipse formatter config file
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Sep 4, 2024
1 parent 4d41ff3 commit e07fafe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ plugins {
id("com.diffplug.spotless")
}

interface SpotlessConventionsPluginExtension {
val eclipseFormatterConfigFile: RegularFileProperty
}

val extension = project.extensions.create<SpotlessConventionsPluginExtension>("spotlessConventions")

extension.eclipseFormatterConfigFile.convention(rootProject.layout.projectDirectory.file("buildSrc/formatterConfig.xml"))

spotless {
java {
target("**/*.java")
Expand All @@ -20,7 +28,7 @@ spotless {
importOrder()
removeUnusedImports()

eclipse().configFile(rootProject.file("buildSrc/formatterConfig.xml"))
eclipse().configFile(extension.eclipseFormatterConfigFile)

trimTrailingWhitespace()
endWithNewline()
Expand Down
4 changes: 4 additions & 0 deletions java-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,8 @@ tasks.withType<Jar> {
"checksum"("algorithm" to "sha-512", "file" to archiveFile.get(), "fileext" to ".sha512")
}
}
}

spotlessConventions {
eclipseFormatterConfigFile = rootProject.file("buildSrc/formatterConfig-generated.xml")
}

0 comments on commit e07fafe

Please sign in to comment.