Files
2026-05-25 11:17:16 -04:00

96 lines
3.2 KiB
Kotlin

/*
~ MIT License
~ Copyright (c) 2022-2023 Andre_601
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
*/
plugins {
id("java")
id("java-library")
id("com.diffplug.spotless") version "7.0.4"
id("com.gradleup.shadow") version "8.3.9"
eclipse
}
java { sourceCompatibility = JavaVersion.VERSION_17 }
group = "ch.andre601.advancedserverlist"
version = "4.0.0"
description = "Customize your MOTD"
val apiVersion by extra("v3.2.0")
val configVersion by extra(3)
subprojects {
apply(plugin = "java-library")
apply(plugin = "com.gradleup.shadow")
apply(plugin = "com.diffplug.spotless")
java {
sourceCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.GRAAL_VM)
}
}
tasks.named<ProcessResources>("processResources") {
val props =
mapOf(
"version" to rootProject.version.toString(),
"apiVersion" to rootProject.extra["apiVersion"],
"configVersion" to rootProject.extra["configVersion"],
"description" to rootProject.description
)
inputs.properties(props)
filesMatching(listOf("plugin.yml", "paper-plugin.yml", "config.yml", "version.properties")) { expand(props) }
from("${rootProject.projectDir}/LICENSE") { into("/") }
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>().configureEach {
archiveClassifier.set("shadow")
exclude("META-INF/*.SF", "META-INF/*.RSA")
minimize()
}
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.addAll(listOf("-parameters", "-Xlint:deprecation"))
options.encoding = "UTF-8"
options.isFork = true
}
tasks.build {
dependsOn(tasks.spotlessApply, tasks.shadowJar)
}
spotless {
java {
removeUnusedImports()
palantirJavaFormat()
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) }
target("*.gradle.kts")
}
}
}
tasks.jar { enabled = false }