From d516736d217c359f487257e9be8d27b0347189b9 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 30 Apr 2025 14:40:57 -0700 Subject: [PATCH] Use resource-factory instead of processResources for fabric & velocity meta --- .gitignore | 3 ++ fabric/build.gradle.kts | 36 +++++++++++++----- fabric/src/main/resources/fabric.mod.json | 37 ------------------- gradle/libs.versions.toml | 5 +++ paper/build.gradle.kts | 5 +-- velocity/build.gradle.kts | 23 +++++++----- .../src/main/resources/velocity-plugin.json | 26 ------------- 7 files changed, 51 insertions(+), 84 deletions(-) delete mode 100644 fabric/src/main/resources/fabric.mod.json delete mode 100644 velocity/src/main/resources/velocity-plugin.json diff --git a/.gitignore b/.gitignore index cbc0ab5c..676ac5be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Compiled class file *.class +# Kotlin temp files +.kotlin/ + # Log file *.log diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 8344d079..a6a21987 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,9 +1,11 @@ +import xyz.jpenilla.resourcefactory.fabric.Environment import java.util.function.Predicate import kotlin.io.path.invariantSeparatorsPathString plugins { id("carbon.shadow-platform") id("quiet-fabric-loom") + alias(libs.plugins.resource.factory.fabric.convention) } val shade: Configuration by configurations.creating @@ -56,6 +58,31 @@ dependencies { runtimeDownload(libs.checkerQual) } +fabricModJson { + id = rootProject.name.lowercase() + name = rootProject.name + version = project.version.toString() + description = project.description + author("Draycia") + author("jmp") + contact { + homepage = GITHUB_REPO_URL + sources = GITHUB_REPO_URL + issues = "$GITHUB_REPO_URL/issues" + } + license("GPLv3") + environment = Environment.ANY + mainEntrypoint("net.draycia.carbon.fabric.CarbonFabricBootstrap") + mixin("carbonchat.mixins.json") + depends("fabricloader", ">=" + libs.versions.fabricLoader.get()) + depends("fabric-api", "*") + depends("cloud", "*") + depends("adventure-platform-fabric", "*") + depends("minecraft", libs.versions.minecraft.get()) + depends("luckperms", ">=5.0.0") + suggests("miniplaceholders", "*") +} + carbonPlatform { productionJar = tasks.remapJar.flatMap { it.archiveFile } } @@ -73,15 +100,6 @@ tasks { relocateGuice() relocateDependency("org.checkerframework") } - processResources { - replace("fabric.mod.json", mapOf( - "modId" to rootProject.name.lowercase(), - "name" to rootProject.name, - "version" to project.version, - "description" to project.description, - "github_url" to GITHUB_REPO_URL - )) - } runServer { dependsOn(shadowJar) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json deleted file mode 100644 index fb1fded5..00000000 --- a/fabric/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "schemaVersion": 1, - "id": "${modId}", - "version": "${version}", - "name": "${name}", - "description": "${description}", - "authors": [ - "Draycia", - "jmp" - ], - "contact": { - "homepage": "${github_url}", - "sources": "${github_url}", - "issues": "${github_url}/issues" - }, - "license": "GPLv3", - "environment": "*", - "entrypoints": { - "main": [ - "net.draycia.carbon.fabric.CarbonFabricBootstrap" - ] - }, - "mixins": [ - "carbonchat.mixins.json" - ], - "depends": { - "fabricloader": ">=0.16.5", - "fabric": "*", - "cloud": "*", - "adventure-platform-fabric": "*", - "minecraft": ">=1.21 <=1.21.1", - "luckperms": ">=5.0.0" - }, - "suggests": { - "miniplaceholders": "*" - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3fc13b6a..87cf97ad 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,10 @@ sponge-gradle = { id = "org.spongepowered.gradle.plugin", version = "2.3.0" } hangar-publish = { id = "io.papermc.hangar-publish-plugin", version = "0.1.3" } indra-publishing-sonatype = { id = "net.kyori.indra.publishing.sonatype", version.ref = "indra" } javadoc-links = { id = "org.incendo.cloud-build-logic.javadoc-links", version = "0.0.16" } +resource-factory-paper-convention = { id = "xyz.jpenilla.resource-factory-paper-convention", version.ref = "resource-factory" } +resource-factory-bukkit-convention = { id = "xyz.jpenilla.resource-factory-bukkit-convention", version.ref = "resource-factory" } +resource-factory-velocity-convention = { id = "xyz.jpenilla.resource-factory-velocity-convention", version.ref = "resource-factory" } +resource-factory-fabric-convention = { id = "xyz.jpenilla.resource-factory-fabric-convention", version.ref = "resource-factory" } [versions] indra = "3.1.3" @@ -11,6 +15,7 @@ pluginYml = "0.5.3" mod-publish-plugin = "0.8.4" gremlin = "0.0.7" runTask = "2.3.1" +resource-factory = "1.2.1" adventure = "4.17.0" cloud = "2.0.0" diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index 7baaea96..4ae63a59 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -3,9 +3,8 @@ import xyz.jpenilla.runpaper.task.RunServer plugins { id("carbon.shadow-platform") - id("xyz.jpenilla.resource-factory") version "1.2.1" - id("xyz.jpenilla.resource-factory-paper-convention") version "1.2.1" - id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.2.1" + alias(libs.plugins.resource.factory.paper.convention) + alias(libs.plugins.resource.factory.bukkit.convention) id("xyz.jpenilla.run-paper") id("carbon.permissions") id("carbon.configurable-plugins") diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index 7a79996b..01511471 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -3,6 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { id("carbon.shadow-platform") id("xyz.jpenilla.run-velocity") + alias(libs.plugins.resource.factory.velocity.convention) } val bstats: Configuration by configurations.creating @@ -24,6 +25,19 @@ dependencies { compileOnly("javax.inject:javax.inject:1") } +velocityPluginJson { + id = rootProject.name.lowercase() + main = "net.draycia.carbon.velocity.CarbonVelocityBootstrap" + name = rootProject.name + version = project.version.toString() + description = project.description + url = GITHUB_REPO_URL + authors = listOf("Draycia", "jmp") + dependency("luckperms", false) + dependency("miniplaceholders", true) + dependency("signedvelocity", true) +} + gremlin { defaultJarRelocatorDependencies.set(true) } @@ -65,15 +79,6 @@ tasks { github("MiniPlaceholders", "MiniPlaceholders", libs.versions.miniplaceholders.get(), "MiniPlaceholders-Velocity-${libs.versions.miniplaceholders.get()}.jar") } } - processResources { - replace("velocity-plugin.json", mapOf( - "id" to rootProject.name.lowercase(), - "name" to rootProject.name, - "version" to project.version, - "description" to project.description, - "url" to GITHUB_REPO_URL - )) - } } publishMods.modrinth { diff --git a/velocity/src/main/resources/velocity-plugin.json b/velocity/src/main/resources/velocity-plugin.json deleted file mode 100644 index e545afd2..00000000 --- a/velocity/src/main/resources/velocity-plugin.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "id": "${id}", - "name": "${name}", - "version": "${version}", - "description": "${description}", - "url": "${url}", - "authors": [ - "Draycia", - "jmp" - ], - "dependencies": [ - { - "id": "luckperms", - "optional": false - }, - { - "id": "miniplaceholders", - "optional": true - }, - { - "id": "signedvelocity", - "optional": true - } - ], - "main": "net.draycia.carbon.velocity.CarbonVelocityBootstrap" -}