build: 将 nashorn 打包的版本与不打包分为两个版本的文件
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "cn.hamster3.mc.plugin"
|
group = "cn.hamster3.mc.plugin"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
description = "为Minecraft服务器导入 OpenJDK Nashorn 引擎来执行 JavaScript 脚本"
|
description = "为Minecraft服务器导入 OpenJDK Nashorn 引擎来执行 JavaScript 脚本"
|
||||||
|
|
||||||
val shade = configurations.create("shade")
|
val shade = configurations.create("shade")
|
||||||
@@ -26,33 +26,40 @@ dependencies {
|
|||||||
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.openjdk.nashorn/nashorn-core
|
// https://mvnrepository.com/artifact/org.openjdk.nashorn/nashorn-core
|
||||||
implementation("org.openjdk.nashorn:nashorn-core:15.0")
|
implementation("org.openjdk.nashorn:nashorn-core:15.4")
|
||||||
shade("org.openjdk.nashorn:nashorn-core:15.0")
|
shade("org.openjdk.nashorn:nashorn-core:15.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<JavaCompile>().configureEach {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
withType<Jar>().configureEach {
|
|
||||||
from(rootProject.file("LICENSE"))
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
}
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
jar {
|
|
||||||
archiveBaseName = "HamsterScript"
|
|
||||||
destinationDirectory = rootProject.layout.buildDirectory
|
|
||||||
|
|
||||||
from(shade.map { if (it.isDirectory) it else zipTree(it) })
|
|
||||||
}
|
|
||||||
processResources {
|
processResources {
|
||||||
filesMatching("plugin.yml") {
|
filesMatching("plugin.yml") {
|
||||||
expand(project.properties)
|
expand(project.properties)
|
||||||
}
|
}
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
|
val shadeJar = create<Jar>("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<JavaCompile>().configureEach {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
withType<Jar>().configureEach {
|
||||||
|
from(rootProject.file("LICENSE"))
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
}
|
||||||
|
build {
|
||||||
|
dependsOn(shadeJar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user