-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathjunitbuild.spotless-conventions.gradle.kts
50 lines (42 loc) · 1.4 KB
/
junitbuild.spotless-conventions.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
plugins {
id("com.diffplug.spotless")
}
val license: License by rootProject.extra
spotless {
format("misc") {
target("*.gradle.kts", "buildSrc/**/*.gradle.kts", "*.gitignore")
targetExclude("buildSrc/build/**")
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
format("documentation") {
target("*.adoc", "*.md", "src/**/*.adoc", "src/**/*.md")
targetExclude("**/build", "**/target")
trimTrailingWhitespace()
endWithNewline()
}
pluginManager.withPlugin("java") {
val configDir = rootProject.layout.projectDirectory.dir("gradle/config/eclipse")
val importOrderConfigFile = configDir.file("junit-eclipse.importorder")
val javaFormatterConfigFile = configDir.file("junit-eclipse-formatter-settings.xml")
java {
licenseHeaderFile(license.headerFile, "(package|import|open|module) ")
importOrderFile(importOrderConfigFile)
val fullVersion = requiredVersionFromLibs("eclipse")
val majorMinorVersion = "([0-9]+\\.[0-9]+).*".toRegex().matchEntire(fullVersion)!!.let { it.groups[1]!!.value }
eclipse(majorMinorVersion).configFile(javaFormatterConfigFile)
trimTrailingWhitespace()
endWithNewline()
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
kotlin {
targetExclude("**/src/test/resources/**")
ktlint(requiredVersionFromLibs("ktlint"))
licenseHeaderFile(license.headerFile)
trimTrailingWhitespace()
endWithNewline()
}
}
}