diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0bfea9f..0000000 --- a/build.gradle +++ /dev/null @@ -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", "") - } - } - } - } - -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..ad0ba24 --- /dev/null +++ b/build.gradle.kts @@ -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().configureEach { + options.encoding = "UTF-8" + } + withType().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("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() + } + } + } + } + +} \ No newline at end of file diff --git a/core-bukkit/build.gradle b/core-bukkit/build.gradle deleted file mode 100644 index f843912..0000000 --- a/core-bukkit/build.gradle +++ /dev/null @@ -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 - } -} diff --git a/core-bukkit/build.gradle.kts b/core-bukkit/build.gradle.kts new file mode 100644 index 0000000..f695c7e --- /dev/null +++ b/core-bukkit/build.gradle.kts @@ -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" + } +} diff --git a/core-bungeecord/build.gradle b/core-bungeecord/build.gradle deleted file mode 100644 index b1862df..0000000 --- a/core-bungeecord/build.gradle +++ /dev/null @@ -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 - } -} diff --git a/core-bungeecord/build.gradle.kts b/core-bungeecord/build.gradle.kts new file mode 100644 index 0000000..4b1cb76 --- /dev/null +++ b/core-bungeecord/build.gradle.kts @@ -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" + } +} diff --git a/core-common/build.gradle b/core-common/build.gradle deleted file mode 100644 index 07d9e4e..0000000 --- a/core-common/build.gradle +++ /dev/null @@ -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() -} diff --git a/core-common/build.gradle.kts b/core-common/build.gradle.kts new file mode 100644 index 0000000..7cc655a --- /dev/null +++ b/core-common/build.gradle.kts @@ -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" + } +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index fabdccb..0000000 --- a/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -rootProject.name = 'hamster-core' -include 'core-common' -include 'core-bukkit' -include 'core-bungeecord' - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..1f8540f --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,4 @@ +rootProject.name = "hamster-core" +include("core-common") +include("core-bukkit") +include("core-bungeecord")