Skip to content

Commit

Permalink
[feature] Bump version to 2.2.3, No longer including dependent classes
Browse files Browse the repository at this point in the history
  • Loading branch information
huanmeng-qwq committed Oct 17, 2024
1 parent 01d01b8 commit 283d1d2
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 70 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ Lightweight Inventory API for Bukkit(Paper/Folia/Spigot) plugins, with 1.8.8 to
<dependencies>
<dependency>
<groupId>com.huanmeng-qwq</groupId>
<artifactId>Bukkit-Gui</artifactId>
<version>2.2.2</version>
<artifactId>bukkit-gui</artifactId>
<version>2.2.3</version>
</dependency>

<!--Kotlin DSL-->

<dependency>
<groupId>com.huanmeng-qwq</groupId>
<artifactId>Bukkit-Gui-kotlin-dsl</artifactId>
<version>2.2.2</version>
<artifactId>bukkit-gui-kotlin-dsl</artifactId>
<version>2.2.3</version>
</dependency>
</dependencies>
```
Expand All @@ -81,9 +81,9 @@ repositories {
}
dependencies {
implementation 'com.huanmeng-qwq:Bukkit-Gui:2.2.2'
implementation 'com.huanmeng-qwq:bukkit-gui:2.2.3'
// Kotlin DSL
implementation 'com.huanmeng-qwq:Bukkit-Gui-kotlin-dsl:2.2.2'
implementation 'com.huanmeng-qwq:bukkit-gui-kotlin-dsl:2.2.3'
}
shadowJar {
Expand Down
55 changes: 55 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import org.gradle.api.JavaVersion
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.kotlin.dsl.`java-library`
import org.gradle.kotlin.dsl.repositories

plugins {
`java-library`
`kotlin-dsl`
}

allprojects {
apply(plugin = "java-library")

repositories {
mavenLocal()
maven {
url = uri("https://oss.sonatype.org/content/groups/public/")
}

maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

maven {
url = uri("https://repo1.maven.org/maven2/")
}

maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}

group = "com.huanmeng-qwq"
version = "2.2.3"

java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}

tasks.withType<Javadoc>() {
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}

}
8 changes: 6 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
plugins {
// Support convention plugins written in Kotlin. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
`kotlin-dsl`
}

repositories {
// Use the plugin portal to apply community plugins in convention plugins.
gradlePluginPortal()
}

dependencies {
implementation(libs.indra)
implementation("cl.franciscosolis.sonatype-central-upload:cl.franciscosolis.sonatype-central-upload.gradle.plugin:1.0.3")
compileOnly(files(libs::class.java.protectionDomain.codeSource.location))
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
register("libs") {
from(files("../gradle/libs.versions.toml")) // include from parent project
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import groovy.util.Node
import groovy.util.NodeList

plugins {
`maven-publish`
`java-library`
id("net.kyori.indra")
id("net.kyori.indra.publishing")
id("cl.franciscosolis.sonatype-central-upload")
}

indra {
github("huanmeng-qwq", "Gui") {
ci(true)
}
mitLicense()

javaVersions {
target(8)
minimumToolchain(17)
}

configurePublications {
pom {
url = "https://github.com/huanmeng-qwq/Gui"
description = "Lightweight Inventory API for Bukkit Development"
developers {
developer {
id = "huanmeng-qwq"
name = "huanmeng_qwq"
email = "huanmeng@huanmeng-qwq.com"
}
}
withXml {
project.configurations.compileOnly.get().allDependencies.forEach { dep ->
((asNode().get("dependencies") as NodeList)[0] as Node).appendNode("dependency").apply {
appendNode("groupId", dep.group)
appendNode("artifactId", dep.name)
appendNode("version", dep.version)
appendNode("scope", "provided")
}
}
}
}
}
}

tasks.withType<JavaCompile>().configureEach {
options.compilerArgs = mutableListOf("-Xlint:-deprecation,-unchecked")
}

fun read(str: String?): String? {
if (str == null) {
return null
}
try {
val file = File(str).let {
if (!it.exists()) {
return@let File(uri(str))
}
it
}
if (file.exists()) {
return file.readText(Charsets.UTF_8)
}
} catch (_: Exception) {
}
return str
}

val cleanUpload by tasks.creating(Delete::class) {
setDelete(project.files(project.layout.buildDirectory.dir("sonatype-central-upload")))
}

tasks.sonatypeCentralUpload {
// gradle sonatypeCentralUpload -PCENTRAL_USERNAME=<username> -PCENTRAL_PASSWORD=<password> -PCENTRAL_PRIVATE_KEY=<privateKey> -PCENTRAL_PRIVATE_KEY_PWD=<privateKeyPwd> -PCENTRAL_PUBLIC_KEY=<publicKey>
val centralUsername = read(System.getenv("MAVEN_USERNAME") ?: findProperty("CENTRAL_USERNAME")?.toString())
val centralPassword = read(System.getenv("MAVEN_PASSWORD") ?: findProperty("CENTRAL_PASSWORD")?.toString())
val privateKey = read(System.getenv("MAVEN_PRIVATE_KEY") ?: findProperty("CENTRAL_PRIVATE_KEY")?.toString())
val privateKeyPwd =
read(System.getenv("MAVEN_PRIVATE_KEY_PWD") ?: findProperty("CENTRAL_PRIVATE_KEY_PWD")?.toString())
val publicKey = read(System.getenv("MAVEN_PUBLIC_KEY") ?: findProperty("CENTRAL_PUBLIC_KEY")?.toString())
dependsOn(tasks.build, tasks.generatePomFileForMavenPublication, cleanUpload)
this.username = centralUsername
this.password = centralPassword
this.publishingType = "MANUAL"
this.signingKey = privateKey
this.signingKeyPassphrase = privateKeyPwd
this.publicKey = publicKey
archives = project.layout.buildDirectory.dir("libs").get().asFileTree
pom = file(project.layout.buildDirectory.file("publications/maven/pom-default.xml"))
}

tasks.test {
onlyIf { !gradle.startParameter.taskNames.contains("sonatypeCentralUpload") }
}

project.afterEvaluate {
tasks.findByName("shadowJar")?.apply {
onlyIf { !gradle.startParameter.taskNames.contains("sonatypeCentralUpload") }
}
}
15 changes: 6 additions & 9 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
plugins {
id("com.huanmeng-qwq.java-conventions")
id("me.huanmeng.gui.publish-conventions")
}

dependencies {
api("net.kyori:adventure-api:4.14.0")
api("net.kyori:adventure-platform-bukkit:4.3.1")
api("net.kyori:adventure-text-serializer-legacy:4.14.0")
api("org.bstats:bstats-bukkit:3.0.2")
implementation("net.kyori:adventure-api:4.14.0")
implementation("net.kyori:adventure-platform-bukkit:4.3.1")
implementation("net.kyori:adventure-text-serializer-legacy:4.14.0")
implementation("org.bstats:bstats-bukkit:3.0.2")
compileOnly("org.spigotmc:spigot-api:1.19.2-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.1.0")
}

description = "Bukkit-Gui"
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public GuiManager(@NonNull JavaPlugin plugin, boolean registerListener) {
this.plugin = plugin;
this.audiences = BukkitAudiences.create(plugin);
if (!Boolean.getBoolean("gui.disable-bStats")) {
metrics = new Metrics(plugin, 18670, "2.2.2");
metrics = new Metrics(plugin, 18670, "2.2.3");
}
if (registerListener) {
Bukkit.getPluginManager().registerEvents(new BukkitEventListener(this), plugin);
Expand Down
12 changes: 12 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[versions]
adventure = "4.14.0"
adventure-bukkit = "4.3.1"
bstats = "3.0.2"
[libraries]

adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
adventure-bukkit = { group = "net.kyori", name = "adventure-platform-bukkit", version.ref = "adventure-bukkit" }
adventure-text-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
bstats = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }

indra = { module = "net.kyori:indra-common", version = "3.1.3" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 8 additions & 5 deletions kotlin-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.huanmeng-qwq.java-conventions")
`kotlin-dsl`
id("me.huanmeng.gui.publish-conventions")
kotlin("jvm")
}

dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib:2.0.0")
api(project(":Bukkit-Gui"))
implementation(project(":bukkit-gui"))
compileOnly("org.spigotmc:spigot-api:1.19.2-R0.1-SNAPSHOT")
}

description = "Bukkit-Gui-kotlin-dsl"
kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
}
16 changes: 12 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

rootProject.name = "Bukkit-Gui-pom"
include(":Bukkit-Gui")
include(":Bukkit-Gui-kotlin-dsl")
project(":Bukkit-Gui").projectDir = file("core")
project(":Bukkit-Gui-kotlin-dsl").projectDir = file("kotlin-dsl")
include(":bukkit-gui")
include(":bukkit-gui-kotlin-dsl")
project(":bukkit-gui").apply {
projectDir = file("core")
}
project(":bukkit-gui-kotlin-dsl").apply {
projectDir = file("kotlin-dsl")
}

0 comments on commit 283d1d2

Please sign in to comment.