2022-10-29 17:17:02 +00:00
|
|
|
import cc.tweaked.gradle.CCTweakedPlugin
|
2022-10-22 16:47:39 +00:00
|
|
|
import cc.tweaked.gradle.LicenseHeader
|
|
|
|
import com.diffplug.gradle.spotless.FormatExtension
|
|
|
|
import com.diffplug.spotless.LineEnding
|
|
|
|
import java.nio.charset.StandardCharsets
|
|
|
|
|
|
|
|
plugins {
|
2022-10-22 19:47:47 +00:00
|
|
|
`java-library`
|
2022-10-22 16:47:39 +00:00
|
|
|
jacoco
|
2022-10-22 19:47:47 +00:00
|
|
|
checkstyle
|
2022-10-22 16:47:39 +00:00
|
|
|
id("com.diffplug.spotless")
|
|
|
|
}
|
|
|
|
|
2022-10-22 19:47:47 +00:00
|
|
|
java {
|
|
|
|
toolchain {
|
2022-10-29 17:17:02 +00:00
|
|
|
languageVersion.set(CCTweakedPlugin.JAVA_VERSION)
|
2022-10-22 19:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven("https://squiddev.cc/maven") {
|
|
|
|
name = "SquidDev"
|
|
|
|
content {
|
|
|
|
includeGroup("org.squiddev")
|
|
|
|
includeGroup("cc.tweaked")
|
|
|
|
// Things we mirror
|
|
|
|
includeGroup("com.blamejared.crafttweaker")
|
|
|
|
includeGroup("commoble.morered")
|
|
|
|
includeGroup("maven.modrinth")
|
|
|
|
includeGroup("mezz.jei")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
|
|
checkstyle(libs.findLibrary("checkstyle").get())
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configure default JavaCompile tasks with our arguments.
|
|
|
|
sourceSets.all {
|
|
|
|
tasks.named(compileJavaTaskName, JavaCompile::class.java) {
|
|
|
|
// Processing just gives us "No processor claimed any of these annotations", so skip that!
|
|
|
|
options.compilerArgs.addAll(listOf("-Xlint", "-Xlint:-processing"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile::class.java).configureEach {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
finalizedBy("jacocoTestReport")
|
|
|
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events("skipped", "failed")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JacocoReport::class.java).configureEach {
|
|
|
|
reports.xml.required.set(true)
|
|
|
|
reports.html.required.set(true)
|
|
|
|
}
|
|
|
|
|
2022-10-22 16:47:39 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|