Skip to content

Commit

Permalink
build: use multi-version for fabric 1.21.1/4
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jan 12, 2025
1 parent c31a382 commit 23fc30c
Show file tree
Hide file tree
Showing 22 changed files with 198 additions and 63 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ jobs:
changelog: ${{ github.event.head_commit.message }}
distro-names: |
paper
fabric-1.21.1
fabric-1.21.4
distro-groups: |
paper
fabric
fabric
distro-descriptions: |
Paper
Fabric 1.21.1
Fabric 1.21.4
files: |
target/HuskHomes-Paper-${{ env.version_name }}.jar
target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.1.jar
target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.4.jar
- name: 'Spigot: Publish to Modrinth & Hangar 🚰'
uses: WiIIiam278/mc-publish@hangar
Expand Down Expand Up @@ -108,7 +112,35 @@ jobs:
1.21.2
1.21.4
java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
- name: 'Fabric 1.21.1: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
if: success() || failure()
with:
modrinth-id: J6U9o3JG
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 849217
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
dependencies: |
fabric-api | requires | *
dynmap | suggests | *
bluemap | suggests | *
pl3xmap | suggests | *
luckperms | suggests | *
plan | suggests | *
impactor | suggests | *
placeholder-api | suggests | *
files-primary: target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.1.jar
name: HuskHomes (Fabric) v${{ env.version_name }}
version: ${{ env.version_name }}
version-type: alpha
changelog: ${{ github.event.head_commit.message }}
loaders: |
fabric
game-versions: |
1.21.1
java: 21
- name: 'Fabric 1.21.4: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
if: success() || failure()
with:
Expand Down
33 changes: 32 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ jobs:
changelog: ${{ github.event.release.body }}
distro-names: |
paper
fabric-1.21.1
fabric-1.21.4
distro-groups: |
paper
fabric
fabric
distro-descriptions: |
Paper
Fabric 1.21.1
Fabric 1.21.4
files: |
target/HuskHomes-Paper-${{ github.event.release.tag_name }}.jar
target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.1.jar
target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.4.jar
- name: 'Spigot: Publish to Modrinth & Hangar 🚰'
uses: WiIIiam278/mc-publish@hangar
Expand Down Expand Up @@ -96,7 +100,34 @@ jobs:
1.21.2
1.21.4
java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
- name: 'Fabric 1.21.1: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: J6U9o3JG
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 849217
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
dependencies: |
fabric-api | requires | *
dynmap | suggests | *
bluemap | suggests | *
pl3xmap | suggests | *
luckperms | suggests | *
plan | suggests | *
impactor | suggests | *
placeholder-api | suggests | *
files-primary: target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.1.jar
name: HuskHomes (Fabric) v${{ github.event.release.tag_name }}
version: ${{ github.event.release.tag_name }}
version-type: release
changelog: ${{ github.event.release.body }}
loaders: |
fabric
game-versions: |
1.21.1
java: 21
- name: 'Fabric 1.21.4: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: J6U9o3JG
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Translations of the plugin locales are welcome to help make the plugin more acce
- [bStats](https://bstats.org/plugin/bukkit/HuskHomes/8430) — View plugin metrics

---
© [William278](https://william278.net/), 2023. Licensed under the Apache-2.0 License.
© [William278](https://william278.net/), 2025. Licensed under the Apache-2.0 License.
32 changes: 24 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'io.github.goooler.shadow' version '8.1.8'
id 'org.cadixdev.licenser' version '0.6.1' apply false
id 'fabric-loom' version "$fabric_loom_version" apply false
id 'gg.essential.multi-version.root' apply false
id 'org.ajoberstar.grgit' version '5.3.0'
id 'maven-publish'
id 'java'
Expand Down Expand Up @@ -57,6 +58,10 @@ publishing {
}

allprojects {
if (project.name == 'fabric') {
return
}

apply plugin: 'io.github.goooler.shadow'
apply plugin: 'org.cadixdev.licenser'
apply plugin: 'java'
Expand Down Expand Up @@ -90,7 +95,6 @@ allprojects {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.4'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.4'

testCompileOnly 'org.jetbrains:annotations:26.0.1'
}

Expand All @@ -113,14 +117,26 @@ allprojects {
}

subprojects {
// Ignore root fabric project (no jars)
if (project.name == 'fabric') {
return
}

// Project naming
version rootProject.version
archivesBaseName = "${rootProject.name}-${project.name.capitalize()}"
def name = "$rootProject.name"
if (rootProject != project.parent) {
name += "-${project.parent.name.capitalize()}"
} else {
name += "-${project.name.capitalize()}"
}
archivesBaseName = name

// Fabric-specific configuration
if (['fabric'].contains(project.name)) {
if (project.parent?.name?.equals('fabric')) {
apply plugin: 'fabric-loom'
compileJava.options.release.set 21
version += "+mc.${fabric_minecraft_version}"
version += "+mc.${project.name}"
}

jar {
Expand All @@ -133,7 +149,7 @@ subprojects {
}

// API publishing
if (['common', 'bukkit', 'fabric'].contains(project.name)) {
if (['common', 'bukkit'].contains(project.name) || project.parent?.name?.equals('fabric')) {
java {
withSourcesJar()
withJavadocJar()
Expand Down Expand Up @@ -173,12 +189,12 @@ subprojects {
}
}

if (['fabric'].contains(project.name)) {
if (project.parent?.name?.equals('fabric')) {
publications {
mavenJavaFabric(MavenPublication) {
"mavenJavaFabric_${project.name.replace('.', '_')}"(MavenPublication) {
groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes-fabric'
version = "$rootProject.version+${fabric_minecraft_version}"
version = "$rootProject.version+$project.name"
artifact remapJar
artifact sourcesJar
artifact javadocJar
Expand Down
Empty file added fabric/1.21.1/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions fabric/1.21.1/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.1+build.3:v2

fabric_loader_version=0.16.9
fabric_api_version=0.114.0+1.21.1
fabric_permissions_api_version=0.3.1
fabric_adventure_platform_version=5.14.1
fabric_impactor_api_version=5.3.0
fabric_placeholder_api_version=2.4.1+1.21
Empty file added fabric/1.21.4/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions fabric/1.21.4/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.4+build.4:v2

fabric_loader_version=0.16.9
fabric_api_version=0.113.0+1.21.4
fabric_permissions_api_version=0.3.3
fabric_adventure_platform_version=6.2.0
fabric_impactor_api_version=5.3.0
fabric_placeholder_api_version=2.5.1+1.21.3
45 changes: 22 additions & 23 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'fabric-loom' version "$fabric_loom_version"
id 'gg.essential.multi-version'
id 'gg.essential.defaults'
}

apply plugin: 'fabric-loom'
loom.serverOnlyMinecraftJar()

repositories {
Expand All @@ -12,29 +12,41 @@ repositories {
}

dependencies {
minecraft "com.mojang:minecraft:${fabric_minecraft_version}"
mappings "net.fabricmc:yarn:${fabric_yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"

modImplementation include("net.kyori:adventure-platform-fabric:${fabric_adventure_platform_version}")
modImplementation include("me.lucko:fabric-permissions-api:${fabric_permissions_api_version}")
modImplementation include("eu.pb4:placeholder-api:${fabric_placeholder_api_version}")
modImplementation include("net.impactdev.impactor.api:economy:${fabric_impactor_api_version}")
modCompileOnly "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"

implementation include('org.apache.commons:commons-pool2:2.12.0')
implementation include("redis.clients:jedis:$jedis_version")
implementation include("org.xerial:sqlite-jdbc:$sqlite_driver_version")
implementation include("com.mysql:mysql-connector-j:$mysql_driver_version")
implementation include("org.mariadb.jdbc:mariadb-java-client:$mariadb_driver_version")
implementation include("org.xerial:sqlite-jdbc:$sqlite_driver_version")
implementation include("redis.clients:jedis:$jedis_version")
implementation include("com.h2database:h2:$h2_driver_version")

compileOnly 'org.jetbrains:annotations:26.0.1'
compileOnly 'org.projectlombok:lombok:1.18.36'

annotationProcessor 'org.projectlombok:lombok:1.18.36'

shadow project(path: ":common")
implementation include(project(path: ":common"))
project(":common").configurations.api.dependencies.each { dependency ->
if (dependency.name in ['cloplib-common', 'gson']) { // skip because it already exists (e.g. in cloplib-fabric)
return
}
include(dependency)
}
}

processResources {
filesMatching(Arrays.asList("fabric.mod.json")) {
expand([
version: version,
fabric_loader_version: fabric_loader_version,
fabric_minecraft_version: project.name,
])
}
}

shadowJar {
Expand All @@ -44,19 +56,6 @@ shadowJar {
exclude('net.fabricmc:.*')
exclude('net.kyori:.*')
exclude '/mappings/*'

relocate 'org.apache.commons.io', 'net.william278.huskhomes.libraries.commons.io'
relocate 'org.apache.commons.text', 'net.william278.huskhomes.libraries.commons.text'
relocate 'org.apache.commons.lang3', 'net.william278.huskhomes.libraries.commons.lang3'
relocate 'de.themoep', 'net.william278.huskhomes.libraries'
relocate 'org.jetbrains', 'net.william278.huskhomes.libraries'
relocate 'org.intellij', 'net.william278.huskhomes.libraries'
relocate 'com.zaxxer', 'net.william278.huskhomes.libraries'
relocate 'net.william278.paginedown', 'net.william278.huskhomes.libraries.paginedown'
relocate 'net.william278.desertwell', 'net.william278.huskhomes.libraries.desertwell'
relocate 'de.exlll', 'net.william278.huskhomes.libraries'
relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml'
relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson'
}

remapJar {
Expand Down
10 changes: 10 additions & 0 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
loom.platform=fabric

essential.defaults.loom=1
essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.16.9

org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.configureoncommand=true
org.gradle.parallel.threads=4
org.gradle.jvmargs=-Xmx8G
1 change: 1 addition & 0 deletions fabric/mainProject
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21.4
11 changes: 11 additions & 0 deletions fabric/root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id("gg.essential.multi-version.root")
}

preprocess {
def fabric12104 = createNode("1.21.4", 12104, "yarn")
def fabric12101 = createNode("1.21.1", 12101, "yarn")

strictExtraMappings.set(true)
fabric12101.link(fabric12104, null)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.kyori.adventure.audience.Audience;
//#if MC==12104
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
//#else
//$$ import net.kyori.adventure.platform.fabric.FabricServerAudiences;
//#endif
import net.minecraft.entity.Entity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
Expand Down Expand Up @@ -95,8 +99,12 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
.orElseThrow(() -> new RuntimeException("Failed to get Mod Container"));
private final Map<String, Boolean> permissions = Maps.newHashMap();

private MinecraftServer minecraftServer;
//#if MC==12104
private MinecraftServerAudiences audiences;
//#else
//$$ private FabricServerAudiences audiences;
//#endif
private MinecraftServer minecraftServer;

private final Set<SavedUser> savedUsers = Sets.newHashSet();
private final Set<UUID> currentlyOnWarmup = Sets.newConcurrentHashSet();
Expand Down Expand Up @@ -140,7 +148,11 @@ public void onInitializeServer() {

private void onEnable(@NotNull MinecraftServer server) {
this.minecraftServer = server;
//#if MC==12104
this.audiences = MinecraftServerAudiences.of(minecraftServer);
//#else
//$$ this.audiences = FabricServerAudiences.of(minecraftServer);
//#endif
this.enable();
}

Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"depends": {
"fabricloader": ">=${fabric_loader_version}",
"minecraft": ">=${fabric_minecraft_version}",
"minecraft": "${fabric_minecraft_version}",
"fabric-api": "*"
},
"suggests": {
Expand Down
10 changes: 1 addition & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,4 @@ h2_driver_version=2.3.232
postgresql_driver_version=42.7.4

# Fabric settings
fabric_loom_version=1.8-SNAPSHOT
fabric_minecraft_version=1.21.4
fabric_loader_version=0.16.9
fabric_yarn_mappings=1.21.4+build.2
fabric_api_version=0.112.0+1.21.4
fabric_permissions_api_version=0.3.3
fabric_adventure_platform_version=6.1.0
fabric_impactor_api_version=5.2.4-SNAPSHOT
fabric_placeholder_api_version=2.5.1+1.21.3
fabric_loom_version=1.9-SNAPSHOT
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading

0 comments on commit 23fc30c

Please sign in to comment.