build: 将构建脚本转换成 kotlin 语言
This commit is contained in:
96
build.gradle
96
build.gradle
@@ -1,96 +0,0 @@
|
||||
//file:noinspection GrDeprecatedAPIUsage
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.johnrengelman.shadow' version '7+'
|
||||
}
|
||||
|
||||
group 'cn.hamster3.mc.plugin'
|
||||
version '1.0.0-SNAPSHOT'
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://maven.airgame.net/maven-public/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
// https://mvnrepository.com/artifact/org.projectlombok/lombok
|
||||
compileOnly 'org.projectlombok:lombok:1.18.28'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.28'
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
// withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.setEncoding("UTF-8")
|
||||
}
|
||||
|
||||
tasks.withType(Jar).configureEach {
|
||||
from([rootProject.file("LICENSE")])
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
}
|
||||
|
||||
jar {
|
||||
classifier = 'dev'
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.quiet()
|
||||
options.setEncoding("UTF-8")
|
||||
options.jFlags("-Dfile.encoding=utf8")
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
options.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 {
|
||||
classifier = ''
|
||||
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 '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'
|
||||
destinationDir(rootProject.buildDir)
|
||||
}
|
||||
tasks.build.dependsOn(shadowJar)
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from project.components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
|
||||
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
|
||||
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
|
||||
credentials {
|
||||
username = rootProject.properties.getOrDefault("maven_username", "")
|
||||
password = rootProject.properties.getOrDefault("maven_password", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
102
build.gradle.kts
Normal file
102
build.gradle.kts
Normal file
@@ -0,0 +1,102 @@
|
||||
//file:noinspection GrDeprecatedAPIUsage
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
id("com.github.johnrengelman.shadow") version "8+"
|
||||
}
|
||||
|
||||
group = "cn.hamster3.mc.plugin"
|
||||
version = "1.0.0-SNAPSHOT"
|
||||
|
||||
subprojects {
|
||||
apply {
|
||||
plugin("java")
|
||||
plugin("maven-publish")
|
||||
plugin("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://maven.airgame.net/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
// https://mvnrepository.com/artifact/org.projectlombok/lombok
|
||||
compileOnly("org.projectlombok:lombok:1.18.28")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.28")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<JavaCompile>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
withType<Jar>().configureEach {
|
||||
from(rootProject.file("LICENSE"))
|
||||
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 {
|
||||
archiveClassifier = ""
|
||||
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("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")
|
||||
destinationDirectory = rootProject.buildDir
|
||||
}
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
val releasesRepoUrl = uri("https://maven.airgame.net/maven-releases/")
|
||||
val snapshotsRepoUrl = uri("https://maven.airgame.net/maven-snapshots/")
|
||||
|
||||
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
|
||||
|
||||
credentials {
|
||||
username = rootProject.properties.getOrDefault("maven_username", "").toString()
|
||||
password = rootProject.properties.getOrDefault("maven_password", "").toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
setArchivesBaseName("HamsterCore-Bukkit")
|
||||
|
||||
evaluationDependsOn(':core-common')
|
||||
|
||||
dependencies {
|
||||
//noinspection VulnerableLibrariesLocal
|
||||
compileOnly 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT'
|
||||
|
||||
compileOnly 'net.milkbowl.vault:VaultAPI:1.7' transitive false
|
||||
compileOnly 'org.black_ixx:playerpoints:2.1.3' transitive false
|
||||
|
||||
implementation project(":core-common") transitive false
|
||||
//noinspection GradlePackageUpdate
|
||||
implementation "com.zaxxer:HikariCP:${HikariCP_version}" exclude group: 'org.slf4j'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bukkit
|
||||
implementation "net.kyori:adventure-platform-bukkit:${adventure_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
||||
implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" 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:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
implementation "de.tr7zw:item-nbt-api:2.11.2"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("plugin.yml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
52
core-bukkit/build.gradle.kts
Normal file
52
core-bukkit/build.gradle.kts
Normal file
@@ -0,0 +1,52 @@
|
||||
evaluationDependsOn(":core-common")
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("net.milkbowl.vault:VaultAPI:1.7") {
|
||||
isTransitive = false
|
||||
}
|
||||
compileOnly("org.black_ixx:playerpoints:2.1.3") {
|
||||
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
|
||||
implementation("net.kyori:adventure-platform-bukkit:${adventureVersion}") {
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "com.google.code.gson")
|
||||
}
|
||||
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")
|
||||
}
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
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")
|
||||
}
|
||||
|
||||
//noinspection GradlePackageUpdate
|
||||
implementation("com.zaxxer:HikariCP:${property("HikariCP_version")}") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
processResources {
|
||||
filesMatching("plugin.yml") {
|
||||
expand(project.properties)
|
||||
}
|
||||
}
|
||||
shadowJar {
|
||||
archiveBaseName = "HamsterCore-Bukkit"
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
setArchivesBaseName("HamsterCore-BungeeCord")
|
||||
|
||||
evaluationDependsOn(':core-common')
|
||||
|
||||
dependencies {
|
||||
//noinspection VulnerableLibrariesLocal
|
||||
compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT'
|
||||
|
||||
implementation project(":core-common") transitive false
|
||||
//noinspection GradlePackageUpdate
|
||||
implementation "com.zaxxer:HikariCP:${HikariCP_version}" exclude group: 'org.slf4j'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
||||
implementation "net.kyori:adventure-platform-bungeecord:${adventure_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
||||
implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" 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:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("bungee.yml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
45
core-bungeecord/build.gradle.kts
Normal file
45
core-bungeecord/build.gradle.kts
Normal file
@@ -0,0 +1,45 @@
|
||||
evaluationDependsOn(":core-common")
|
||||
|
||||
dependencies {
|
||||
compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT")
|
||||
|
||||
implementation(project(":core-common")) {
|
||||
isTransitive = false
|
||||
}
|
||||
val adventureVersion = property("adventure_version")
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
||||
implementation("net.kyori:adventure-platform-bungeecord:${adventureVersion}") {
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "com.google.code.gson")
|
||||
}
|
||||
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")
|
||||
}
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
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")
|
||||
}
|
||||
|
||||
//noinspection GradlePackageUpdate
|
||||
implementation("com.zaxxer:HikariCP:${property("HikariCP_version")}") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
processResources {
|
||||
filesMatching("bungee.yml") {
|
||||
expand(project.properties)
|
||||
}
|
||||
}
|
||||
shadowJar {
|
||||
archiveBaseName = "HamsterCore-BungeeCord"
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
setArchivesBaseName("HamsterCore-Common")
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||
//noinspection GradlePackageUpdate
|
||||
//noinspection VulnerableLibrariesLocal
|
||||
compileOnly 'com.google.code.gson:gson:2.8.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
|
||||
implementation "net.kyori:adventure-platform-api:${adventure_version}" exclude group: 'org.jetbrains'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
|
||||
implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" 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:${adventure_serializer_version}" exclude group: 'org.jetbrains'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
36
core-common/build.gradle.kts
Normal file
36
core-common/build.gradle.kts
Normal file
@@ -0,0 +1,36 @@
|
||||
@file:Suppress("VulnerableLibrariesLocal")
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||
//noinspection GradlePackageUpdate
|
||||
//noinspection VulnerableLibrariesLocal
|
||||
compileOnly("com.google.code.gson:gson:2.8.0")
|
||||
val adventureVersion = property("adventure_version")
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
|
||||
implementation("net.kyori:adventure-platform-api:${adventureVersion}") {
|
||||
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")
|
||||
}
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
shadowJar {
|
||||
archiveBaseName = "HamsterCore-Common"
|
||||
}
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
rootProject.name = 'hamster-core'
|
||||
include 'core-common'
|
||||
include 'core-bukkit'
|
||||
include 'core-bungeecord'
|
||||
|
4
settings.gradle.kts
Normal file
4
settings.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
rootProject.name = "hamster-core"
|
||||
include("core-common")
|
||||
include("core-bukkit")
|
||||
include("core-bungeecord")
|
Reference in New Issue
Block a user