Update spotless and fix license check (#227)

This commit is contained in:
Jason Penilla 2023-11-29 17:10:27 -08:00 committed by GitHub
parent 4e97731a49
commit fc0ead8047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 13 deletions

View file

@ -1,9 +1,10 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
idea
id("org.gradle.kotlin.kotlin-dsl")
id("net.kyori.indra.licenser.spotless")
}
java {
@ -70,18 +71,11 @@ tasks.jar {
}
}
tasks.register("format") {
group = "formatting"
description = "Formats source code according to project style"
dependsOn(tasks.spotlessApply)
}
// The following is to work around https://github.com/diffplug/spotless/issues/1599
// Ensure the ktlint step is before the license header step
indraSpotlessLicenser {
licenseHeaderFile(rootProject.file("license/copyright.txt"))
newLine(true)
}
spotless {
plugins.apply("com.diffplug.spotless")
extensions.configure<SpotlessExtension> {
val overrides = mapOf(
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_filename" to "disabled",
@ -99,6 +93,18 @@ spotless {
}
}
plugins.apply("net.kyori.indra.licenser.spotless")
extensions.configure<IndraSpotlessLicenserExtension> {
licenseHeaderFile(rootProject.file("license/copyright.txt"))
newLine(true)
}
tasks.register("format") {
group = "formatting"
description = "Formats source code according to project style"
dependsOn(tasks.named("spotlessApply"))
}
idea {
module {
isDownloadSources = true

View file

@ -33,7 +33,7 @@ diffpatch = "codechicken:DiffPatch:1.5.0.29"
# Gradle
gradle-licenser = "net.kyori:indra-licenser-spotless:3.1.3"
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.22.0"
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.23.1"
gradle-shadow = "com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.1.2"
gradle-plugin-kotlin = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin" }