mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-25 22:53:22 +00:00
![Jonathan Coates](/assets/img/avatar_default.png)
It's more verbose as the default license plugin doesn't support multiple license headers. However, it also gives us some other goodies (namely formatting Kotlin and removing unused imports), so worth doing.
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
import cc.tweaked.gradle.LicenseHeader
|
|
import com.diffplug.gradle.spotless.FormatExtension
|
|
import com.diffplug.spotless.LineEnding
|
|
import java.nio.charset.StandardCharsets
|
|
|
|
plugins {
|
|
java
|
|
jacoco
|
|
id("com.diffplug.spotless")
|
|
}
|
|
|
|
spotless {
|
|
encoding = StandardCharsets.UTF_8
|
|
lineEndings = LineEnding.UNIX
|
|
|
|
fun FormatExtension.defaults() {
|
|
endWithNewline()
|
|
trimTrailingWhitespace()
|
|
indentWithSpaces(4)
|
|
}
|
|
|
|
val licenser = LicenseHeader.create(
|
|
api = file("config/license/api.txt"),
|
|
main = file("config/license/main.txt"),
|
|
)
|
|
|
|
java {
|
|
defaults()
|
|
addStep(licenser)
|
|
removeUnusedImports()
|
|
}
|
|
|
|
val ktlintConfig = mapOf(
|
|
"disabled_rules" to "no-wildcard-imports",
|
|
"ij_kotlin_allow_trailing_comma" to "true",
|
|
"ij_kotlin_allow_trailing_comma_on_call_site" to "true",
|
|
)
|
|
|
|
kotlinGradle {
|
|
defaults()
|
|
ktlint().editorConfigOverride(ktlintConfig)
|
|
}
|
|
|
|
kotlin {
|
|
defaults()
|
|
ktlint().editorConfigOverride(ktlintConfig)
|
|
}
|
|
}
|