| 1 |
import com.diffplug.gradle.spotless.SpotlessApply |
| 2 |
import com.diffplug.gradle.spotless.SpotlessCheck |
| 3 |
import com.diffplug.spotless.LineEnding |
| 4 |
|
| 5 |
plugins { |
| 6 |
id("com.diffplug.spotless") |
| 7 |
} |
| 8 |
|
| 9 |
val license: License by rootProject.extra |
| 10 |
|
| 11 |
spotless { |
| 12 |
|
| 13 |
format("misc") { |
| 14 |
target("*.gradle.kts", "buildSrc/**/*.gradle.kts", "*.gitignore") |
| 15 |
targetExclude("buildSrc/build/**") |
| 16 |
indentWithTabs() |
| 17 |
trimTrailingWhitespace() |
| 18 |
endWithNewline() |
| 19 |
} |
| 20 |
|
| 21 |
format("documentation") { |
| 22 |
target("*.adoc", "*.md", "src/**/*.adoc", "src/**/*.md") |
| 23 |
targetExclude("**/build", "**/target") |
| 24 |
trimTrailingWhitespace() |
| 25 |
endWithNewline() |
| 26 |
} |
| 27 |
|
| 28 |
pluginManager.withPlugin("java") { |
| 29 |
|
| 30 |
val configDir = rootProject.layout.projectDirectory.dir("gradle/config/eclipse") |
| 31 |
val importOrderConfigFile = configDir.file("junit-eclipse.importorder") |
| 32 |
val javaFormatterConfigFile = configDir.file("junit-eclipse-formatter-settings.xml") |
| 33 |
|
| 34 |
java { |
| 35 |
licenseHeaderFile(license.headerFile, "(package|import|open|module) ") |
| 36 |
importOrderFile(importOrderConfigFile) |
| 37 |
eclipse().configFile(javaFormatterConfigFile) |
| 38 |
trimTrailingWhitespace() |
| 39 |
endWithNewline() |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { |
| 44 |
kotlin { |
| 45 |
targetExclude("**/src/test/resources/**") |
| 46 |
ktlint(requiredVersionFromLibs("ktlint")) |
| 47 |
licenseHeaderFile(license.headerFile) |
| 48 |
trimTrailingWhitespace() |
| 49 |
endWithNewline() |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
// https://github.com/diffplug/spotless/issues/1644 |
| 54 |
lineEndings = LineEnding.UNIX // or any other except GIT_ATTRIBUTES |
| 55 |
} |
| 56 |
|
| 57 |
tasks { |
| 58 |
withType<SpotlessApply>().configureEach { |
| 59 |
notCompatibleWithConfigurationCache("https://github.com/diffplug/spotless/issues/644") |
| 60 |
} |
| 61 |
withType<SpotlessCheck>().configureEach { |
| 62 |
notCompatibleWithConfigurationCache("https://github.com/diffplug/spotless/issues/644") |
| 63 |
} |
| 64 |
} |