build: 优化构建脚本

This commit is contained in:
2024-08-09 01:23:54 +08:00
parent fe2e658c50
commit 3dab447178
2 changed files with 9 additions and 11 deletions

View File

@@ -24,27 +24,26 @@ dependencies {
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
} }
tasks { java {
java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar() withSourcesJar()
} }
tasks {
processResources { processResources {
filesMatching("plugin.yml") { filesMatching("plugin.yml") {
expand(project.properties) expand(project.properties)
} }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} }
jar { withType<JavaCompile> {
destinationDirectory = rootProject.layout.buildDirectory
}
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
withType<Jar>().configureEach { withType<Jar> {
archiveBaseName = "HamsterScript" archiveBaseName = "HamsterScript"
from(rootProject.file("LICENSE")) from(rootProject.file("LICENSE"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDirectory = rootProject.layout.buildDirectory
} }
} }

View File

@@ -1,2 +1 @@
rootProject.name = "hamster-script" rootProject.name = "hamster-script"