Skip to content

Commit

Permalink
refactor: Fabric 1.20.4, Sponge API v10, Java 17, Platform APIs (#562)
Browse files Browse the repository at this point in the history
* deps: bump dependencies

* refactor: bukkit 1.17.1, Sponge v10, fabric 1.20.4

* refactor: release platform-specific API modules

* fix: checkstyle javadoc comment

* docs: update API docs

* docs: mention API platforms in events api docs
  • Loading branch information
WiIIiam278 authored Feb 12, 2024
1 parent c0e079c commit f8ad215
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 153 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
hangar-id: William278/HuskHomes
hangar-token: ${{ secrets.HANGAR_API_KEY }}
hangar-version-type: Alpha
files-primary: target/HuskHomes-Plugin-*.jar
files-primary: target/HuskHomes-Paper-*.jar
name: HuskHomes (Spigot) v${{ env.version_name }}
version: ${{ env.version_name }}
version-type: alpha
Expand All @@ -67,12 +67,11 @@ jobs:
paper
folia
game-versions: |
1.16.5
1.17.1
1.18.2
1.19.4
1.20.2
java: 16
1.20.4
java: 17
- name: 'Sponge: Publish to Modrinth 🧽'
uses: WiIIiam278/mc-publish@hangar
if: success() || failure()
Expand All @@ -91,8 +90,8 @@ jobs:
loaders: |
sponge
game-versions: |
1.16.5
java: 16
1.19.4
java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
if: success() || failure()
Expand All @@ -117,14 +116,14 @@ jobs:
loaders: |
fabric
game-versions: |
1.20.2
1.20.4
java: 17
- name: 'Upload GitHub Artifacts 📦'
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: HuskHomes
path: |
target/HuskHomes-Plugin-*.jar
target/HuskHomes-Paper-*.jar
target/HuskHomes-Sponge-*.jar
target/HuskHomes-Fabric-*.jar
15 changes: 7 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
plan | suggests | *
hangar-id: William278/HuskHomes
hangar-token: ${{ secrets.HANGAR_API_KEY }}
files-primary: target/HuskHomes-Plugin-*.jar
files-primary: target/HuskHomes-Paper-*.jar
name: HuskHomes (Spigot) v${{ github.event.release.tag_name }}
version: ${{ github.event.release.tag_name }}
version-type: release
Expand All @@ -55,12 +55,11 @@ jobs:
paper
folia
game-versions: |
1.16.5
1.17.1
1.18.2
1.19.4
1.20.2
java: 16
1.20.4
java: 17
- name: 'Sponge: Publish to Modrinth 🧽'
uses: WiIIiam278/mc-publish@hangar
with:
Expand All @@ -78,8 +77,8 @@ jobs:
loaders: |
sponge
game-versions: |
1.16.5
java: 16
1.19.4
java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
with:
Expand All @@ -103,13 +102,13 @@ jobs:
loaders: |
fabric
game-versions: |
1.20.2
1.20.4
java: 17
- name: 'Upload GitHub Artifacts 📦'
uses: actions/upload-artifact@v4
with:
name: HuskHomes
path: |
target/HuskHomes-Plugin-*.jar
target/HuskHomes-Paper-*.jar
target/HuskHomes-Sponge-*.jar
target/HuskHomes-Fabric-*.jar
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/HuskHomes/ci.yml?branch=master&logo=github"/>
</a>
<a href="https://repo.william278.net/#/releases/net/william278/huskhomes/">
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes?color=00fb9a&name=Maven&prefix=v" />
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes/huskhomes-common?color=00fb9a&name=Maven&prefix=v" />
</a>
<a href="https://discord.gg/tVYhJfyDWG">
<img src="https://img.shields.io/discord/818135932103557162.svg?label=&logo=discord&logoColor=fff&color=7389D8&labelColor=6A7EC2" />
Expand Down
159 changes: 97 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,45 @@ ext {
set 'mariadb_driver_version', mariadb_driver_version.toString()
}

publishing {
repositories {
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
maven {
name = "william278-releases"
url = "https://repo.william278.net/releases"
credentials {
username = System.getenv("RELEASES_MAVEN_USERNAME")
password = System.getenv("RELEASES_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
maven {
name = "william278-snapshots"
url = "https://repo.william278.net/snapshots"
credentials {
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}

allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
apply plugin: 'checkstyle'
apply plugin: 'java'

compileJava.options.encoding = 'UTF-8'
compileJava.options.release.set 16
compileJava.options.release.set 17
javadoc.options.encoding = 'UTF-8'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')

Expand Down Expand Up @@ -59,9 +90,9 @@ allprojects {
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}

license {
Expand All @@ -74,97 +105,102 @@ allprojects {
toolVersion = '10.12.0'
}

test {
useJUnitPlatform()
}

processResources {
filesMatching(['**/*.json', '**/*.yml']) {
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
tokens: rootProject.ext.properties
}
}

}

subprojects {
version rootProject.version
archivesBaseName = "${rootProject.name}-${project.name.capitalize()}"
compileJava.options.encoding = 'UTF-8'

jar {
from '../LICENSE'
}

test {
useJUnitPlatform()
}

if (['paper', 'fabric'].contains(project.name)) {
compileJava.options.release.set 17
shadowJar {
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}

if (['bukkit', 'paper', 'plugin', 'fabric', 'sponge'].contains(project.name)) {
shadowJar {
// API publishing
if (['common', 'bukkit', 'fabric', 'sponge'].contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
}
sourcesJar {
destinationDirectory.set(file("$rootDir/target"))
}
javadocJar {
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}
shadowJar.dependsOn(sourcesJar, javadocJar)

if (['bukkit'].contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
}
sourcesJar {
destinationDirectory.set(file("$rootDir/target"))
}
javadocJar {
destinationDirectory.set(file("$rootDir/target"))
}
shadowJar.dependsOn(sourcesJar, javadocJar)

publishing {
repositories {
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
maven {
name = "william278-releases"
url = "https://repo.william278.net/releases"
credentials {
username = System.getenv("RELEASES_MAVEN_USERNAME")
password = System.getenv("RELEASES_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
publishing {
if (['common'].contains(project.name)) {
publications {
mavenJavaCommon(MavenPublication) {
groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes-common'
version = "$rootProject.version"
artifact shadowJar
artifact sourcesJar
artifact javadocJar
}
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
maven {
name = "william278-snapshots"
url = "https://repo.william278.net/snapshots"
credentials {
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
}

if (['bukkit'].contains(project.name)) {
publications {
mavenJavaBukkit(MavenPublication) {
groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes-bukkit'
version = "$rootProject.version"
artifact shadowJar
artifact sourcesJar
artifact javadocJar
}
}
}

if (['fabric'].contains(project.name)) {
publications {
mavenJava(MavenPublication) {
groupId = 'net.william278'
artifactId = 'huskhomes'
mavenJavaBukkit(MavenPublication) {
groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes-fabric'
version = "$rootProject.version"
artifact shadowJar
artifact sourcesJar
artifact javadocJar
}
}
}

if (['sponge'].contains(project.name)) {
publications {
mavenJavaBukkit(MavenPublication) {
groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes-sponge'
version = "$rootProject.version"
artifact shadowJar
artifact sourcesJar
artifact javadocJar
}
}
}
}

jar.dependsOn shadowJar
clean.delete "$rootDir/target"
}

jar.dependsOn shadowJar
clean.delete "$rootDir/target"
}

logger.lifecycle("Building HuskHomes ${version} by William278")
Expand All @@ -182,5 +218,4 @@ def versionMetadata() {
return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
}

}
12 changes: 7 additions & 5 deletions bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies {
implementation 'me.lucko:commodore:2.2'
implementation 'net.kyori:adventure-platform-bukkit:4.3.2'

compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:24.1.0'
compileOnly 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
compileOnly 'net.william278:annotaml:2.0.5'
Expand All @@ -18,13 +18,13 @@ dependencies {
exclude group: 'org.spigotmc', module: 'spigot-api'
}

testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:1.5.2'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.17:1.13.0'
testImplementation 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
testImplementation 'net.kyori:adventure-platform-bukkit:4.3.2'
testImplementation 'org.apache.commons:commons-text:1.11.0'
testImplementation 'redis.clients:jedis:' + jedis_version
testImplementation 'org.xerial:sqlite-jdbc:' + sqlite_driver_version
testImplementation 'com.mysql:mysql-connector-j:' + mysql_driver_version
testImplementation "redis.clients:jedis:${jedis_version}"
testImplementation "org.xerial:sqlite-jdbc:${sqlite_driver_version}"
testImplementation "com.mysql:mysql-connector-j:${mysql_driver_version}"
}

shadowJar {
Expand All @@ -50,4 +50,6 @@ shadowJar {
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore'

minimize()
}
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public boolean isDependencyLoaded(@NotNull String name) {

@Override
public void onDisable() {
HuskHomesAPI.unregister();
if (this.eventListener != null) {
this.eventListener.handlePluginDisable();
}
Expand Down Expand Up @@ -483,11 +484,6 @@ && getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE) {
}
}

@NotNull
public AudienceProvider getAudiences() {
return audiences;
}

@NotNull
public GracefulScheduling getScheduler() {
return paperLib.scheduling();
Expand Down
Loading

0 comments on commit f8ad215

Please sign in to comment.