From 4782f17f6bac00f27de683cf13d00e5466edc0d5 Mon Sep 17 00:00:00 2001 From: MiniDay <372403923@qq.com> Date: Tue, 12 Mar 2024 02:28:20 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E5=B0=86=20nashorn=20=E6=89=93?= =?UTF-8?q?=E5=8C=85=E7=9A=84=E7=89=88=E6=9C=AC=E4=B8=8E=E4=B8=8D=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=88=86=E4=B8=BA=E4=B8=A4=E4=B8=AA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1ec05b6..d21d37b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "cn.hamster3.mc.plugin" -version = "1.0.1" +version = "1.0.2" description = "为Minecraft服务器导入 OpenJDK Nashorn 引擎来执行 JavaScript 脚本" val shade = configurations.create("shade") @@ -26,33 +26,40 @@ dependencies { compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") // https://mvnrepository.com/artifact/org.openjdk.nashorn/nashorn-core - implementation("org.openjdk.nashorn:nashorn-core:15.0") - shade("org.openjdk.nashorn:nashorn-core:15.0") + implementation("org.openjdk.nashorn:nashorn-core:15.4") + shade("org.openjdk.nashorn:nashorn-core:15.4") } tasks { - withType().configureEach { - options.encoding = "UTF-8" - } - withType().configureEach { - from(rootProject.file("LICENSE")) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 withSourcesJar() } - jar { - archiveBaseName = "HamsterScript" - destinationDirectory = rootProject.layout.buildDirectory - - from(shade.map { if (it.isDirectory) it else zipTree(it) }) - } processResources { filesMatching("plugin.yml") { expand(project.properties) } duplicatesStrategy = DuplicatesStrategy.EXCLUDE } + val shadeJar = create("shadeJar") { + archiveBaseName = "HamsterScript" + archiveClassifier = "all" + destinationDirectory = rootProject.layout.buildDirectory + from(shade.map { if (it.isDirectory) it else zipTree(it) }) + } + jar { + archiveBaseName = "HamsterScript" + destinationDirectory = rootProject.layout.buildDirectory + } + withType().configureEach { + options.encoding = "UTF-8" + } + withType().configureEach { + from(rootProject.file("LICENSE")) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + build { + dependsOn(shadeJar) + } }