build: 优化依赖
This commit is contained in:
@@ -16,9 +16,9 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// 对于 Bukkit 插件
|
// 对于 Bukkit 插件
|
||||||
compileOnly "cn.hamster3.mc.plugin:core-bukkit:1.0.0"
|
compileOnly "cn.hamster3.mc.plugin:core-bukkit:+"
|
||||||
// 对于 BungeeCord 插件
|
// 对于 BungeeCord 插件
|
||||||
compileOnly "cn.hamster3.mc.plugin:core-bungeecord:1.0.0"
|
compileOnly "cn.hamster3.mc.plugin:core-bungeecord:+"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ version = "1.1.0-SNAPSHOT"
|
|||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply {
|
apply {
|
||||||
plugin("java")
|
plugin("java-library")
|
||||||
plugin("maven-publish")
|
plugin("maven-publish")
|
||||||
plugin("com.github.johnrengelman.shadow")
|
plugin("com.github.johnrengelman.shadow")
|
||||||
}
|
}
|
||||||
@@ -25,50 +25,31 @@ subprojects {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:+")
|
||||||
// https://mvnrepository.com/artifact/org.projectlombok/lombok
|
// https://mvnrepository.com/artifact/org.projectlombok/lombok
|
||||||
compileOnly("org.projectlombok:lombok:1.18.28")
|
compileOnly("org.projectlombok:lombok:+")
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.28")
|
annotationProcessor("org.projectlombok:lombok:+")
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
// withJavadocJar()
|
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<JavaCompile>() {
|
withType<JavaCompile> {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
}
|
||||||
withType<Jar>() {
|
withType<Jar> {
|
||||||
from(rootProject.file("LICENSE"))
|
from(rootProject.file("LICENSE"))
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
jar {
|
|
||||||
archiveClassifier = "dev"
|
|
||||||
}
|
|
||||||
javadoc {
|
|
||||||
options.jFlags("-Dfile.encoding=utf8")
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
options.quiet()
|
|
||||||
val o: StandardJavadocDocletOptions = options as StandardJavadocDocletOptions
|
|
||||||
o.addStringOption("Xdoclint:none", "-quiet")
|
|
||||||
o.links(
|
|
||||||
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0",
|
|
||||||
"https://javadoc.io/doc/com.google.code.gson/gson/2.8.0",
|
|
||||||
"http://milkbowl.github.io/VaultAPI",
|
|
||||||
"https://bukkit.windit.net/javadoc"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveClassifier = ""
|
|
||||||
relocate("net.kyori", "cn.hamster3.mc.plugin.core.lib.net.kyori")
|
relocate("net.kyori", "cn.hamster3.mc.plugin.core.lib.net.kyori")
|
||||||
relocate("com.zaxxer.hikari", "cn.hamster3.mc.plugin.core.lib.com.zaxxer.hikari")
|
relocate("com.zaxxer.hikari", "cn.hamster3.mc.plugin.core.lib.com.zaxxer.hikari")
|
||||||
relocate("de.tr7zw.changeme.nbtapi", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi")
|
relocate("de.tr7zw.changeme.nbtapi", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi")
|
||||||
relocate("de.tr7zw.annotations", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi.annotations")
|
relocate("de.tr7zw.annotations", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi.annotations")
|
||||||
destinationDirectory = rootProject.buildDir
|
|
||||||
}
|
}
|
||||||
build {
|
build {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
|
@@ -1,41 +1,24 @@
|
|||||||
evaluationDependsOn(":core-common")
|
evaluationDependsOn(":core-common")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
|
api(project(":core-common")) { isTransitive = false }
|
||||||
compileOnly("net.milkbowl.vault:VaultAPI:1.7") {
|
compileOnly("org.spigotmc:spigot-api:+")
|
||||||
isTransitive = false
|
|
||||||
}
|
implementation("de.tr7zw:item-nbt-api:+")
|
||||||
compileOnly("org.black_ixx:playerpoints:2.1.3") {
|
compileOnly("net.milkbowl.vault:VaultAPI:+") { isTransitive = false }
|
||||||
isTransitive = false
|
compileOnly("org.black_ixx:playerpoints:+") { isTransitive = false }
|
||||||
}
|
|
||||||
|
|
||||||
implementation(project(":core-common")) {
|
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
implementation("de.tr7zw:item-nbt-api:2.11.2")
|
|
||||||
val adventureVersion = property("adventure_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
||||||
implementation("net.kyori:adventure-platform-bukkit:${adventureVersion}") {
|
api("net.kyori:adventure-platform-bukkit:4+") {
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
}
|
}
|
||||||
val adventureSerializerVersion = property("adventure_serializer_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
||||||
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
|
api("net.kyori:adventure-text-minimessage:4+") {
|
||||||
|
exclude(module = "adventure-api")
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
implementation("com.zaxxer:HikariCP:4+") {
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
exclude(group = "com.google.code.gson")
|
|
||||||
}
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
|
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
}
|
|
||||||
|
|
||||||
val hikariVersion = property("HikariCP_version")
|
|
||||||
implementation("com.zaxxer:HikariCP:${hikariVersion}") {
|
|
||||||
exclude(group = "org.slf4j")
|
exclude(group = "org.slf4j")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +29,10 @@ tasks {
|
|||||||
expand(project.properties)
|
expand(project.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withType<Jar>() {
|
withType<Jar> {
|
||||||
archiveBaseName = "HamsterCore-Bukkit"
|
archiveBaseName = "HamsterCore-Bukkit"
|
||||||
}
|
}
|
||||||
|
shadowJar {
|
||||||
|
destinationDirectory = rootProject.buildDir
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -99,22 +99,22 @@ public final class CoreBukkitAPI extends CoreAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Gson getGson() {
|
public @NotNull Gson getGson() {
|
||||||
return gson;
|
return gson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Gson getHumanGson() {
|
public @NotNull Gson getHumanGson() {
|
||||||
return humanGson;
|
return humanGson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExecutorService getExecutorService() {
|
public @NotNull ExecutorService getExecutorService() {
|
||||||
return executorService;
|
return executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScheduledExecutorService getScheduledExecutorService() {
|
public @NotNull ScheduledExecutorService getScheduledExecutorService() {
|
||||||
return scheduledExecutorService;
|
return scheduledExecutorService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,34 +1,20 @@
|
|||||||
evaluationDependsOn(":core-common")
|
evaluationDependsOn(":core-common")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT")
|
api(project(":core-common")) { isTransitive = false }
|
||||||
|
compileOnly("net.md-5:bungeecord-api:+")
|
||||||
|
|
||||||
implementation(project(":core-common")) {
|
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
val adventureVersion = property("adventure_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
||||||
implementation("net.kyori:adventure-platform-bungeecord:${adventureVersion}") {
|
api("net.kyori:adventure-platform-bungeecord:4+") {
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
}
|
}
|
||||||
val adventureSerializerVersion = property("adventure_serializer_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
||||||
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
|
api("net.kyori:adventure-text-minimessage:4+") {
|
||||||
|
exclude(module = "adventure-api")
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
implementation("com.zaxxer:HikariCP:4+") {
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
exclude(group = "com.google.code.gson")
|
|
||||||
}
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
|
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
}
|
|
||||||
|
|
||||||
val hikariVersion = property("HikariCP_version")
|
|
||||||
implementation("com.zaxxer:HikariCP:${hikariVersion}") {
|
|
||||||
exclude(group = "org.slf4j")
|
exclude(group = "org.slf4j")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,7 +25,10 @@ tasks {
|
|||||||
expand(project.properties)
|
expand(project.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withType<Jar>() {
|
withType<Jar> {
|
||||||
archiveBaseName = "HamsterCore-BungeeCord"
|
archiveBaseName = "HamsterCore-BungeeCord"
|
||||||
}
|
}
|
||||||
|
shadowJar {
|
||||||
|
destinationDirectory = rootProject.buildDir
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,22 +91,22 @@ public final class CoreBungeeAPI extends CoreAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Gson getGson() {
|
public @NotNull Gson getGson() {
|
||||||
return gson;
|
return gson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Gson getHumanGson() {
|
public @NotNull Gson getHumanGson() {
|
||||||
return humanGson;
|
return humanGson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExecutorService getExecutorService() {
|
public @NotNull ExecutorService getExecutorService() {
|
||||||
return executorService;
|
return executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScheduledExecutorService getScheduledExecutorService() {
|
public @NotNull ScheduledExecutorService getScheduledExecutorService() {
|
||||||
return scheduledExecutorService;
|
return scheduledExecutorService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,29 +4,19 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||||
compileOnly("com.google.code.gson:gson:2.8.0")
|
compileOnly("com.google.code.gson:gson:2.8.0")
|
||||||
|
|
||||||
val adventureVersion = property("adventure_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
|
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
|
||||||
implementation("net.kyori:adventure-platform-api:${adventureVersion}") {
|
api("net.kyori:adventure-platform-api:4+") {
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
}
|
|
||||||
val adventureSerializerVersion = property("adventure_serializer_version")
|
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
|
||||||
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
|
api("net.kyori:adventure-text-serializer-gson:4.13+") {
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
|
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
|
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<Jar>() {
|
withType<Jar> {
|
||||||
archiveBaseName = "HamsterCore-Common"
|
archiveBaseName = "HamsterCore-Common"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package cn.hamster3.mc.plugin.core.common.api;
|
package cn.hamster3.mc.plugin.core.common.api;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.platform.AudienceProvider;
|
import net.kyori.adventure.platform.AudienceProvider;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -12,12 +13,9 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public abstract class CoreAPI {
|
public abstract class CoreAPI {
|
||||||
|
@Getter
|
||||||
protected static CoreAPI instance;
|
protected static CoreAPI instance;
|
||||||
|
|
||||||
public static CoreAPI getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public abstract AudienceProvider getAudienceProvider();
|
public abstract AudienceProvider getAudienceProvider();
|
||||||
|
|
||||||
@@ -32,20 +30,24 @@ public abstract class CoreAPI {
|
|||||||
/**
|
/**
|
||||||
* @return GSON 工具
|
* @return GSON 工具
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public abstract Gson getGson();
|
public abstract Gson getGson();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return GSON 工具,会使用格式化输出、且解析中包含null参数
|
* @return GSON 工具,会使用格式化输出、且解析中包含null参数
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public abstract Gson getHumanGson();
|
public abstract Gson getHumanGson();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 异步线程池
|
* @return 异步线程池
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public abstract ExecutorService getExecutorService();
|
public abstract ExecutorService getExecutorService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 调度器线程池
|
* @return 调度器线程池
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public abstract ScheduledExecutorService getScheduledExecutorService();
|
public abstract ScheduledExecutorService getScheduledExecutorService();
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1 @@
|
|||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
adventure_version=4.3.0
|
|
||||||
adventure_serializer_version=4.14.0
|
|
||||||
HikariCP_version=4.0.3
|
|
||||||
|
Reference in New Issue
Block a user