From 322348ebecc4412971c2bea7d3a625bde10b3b85 Mon Sep 17 00:00:00 2001 From: Erdragh Date: Thu, 12 Oct 2023 00:20:37 +0200 Subject: [PATCH 1/2] simplify dependency setup for publishing --- gradle/publishing/curseforge.gradle | 12 ++++++++---- gradle/publishing/modrinth.gradle | 12 ++++++++---- gradle/publishing/publishing.gradle | 13 +++++++++++++ gradle/publishing/publishing.properties | 1 + 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/gradle/publishing/curseforge.gradle b/gradle/publishing/curseforge.gradle index ab98455..8f9fae4 100644 --- a/gradle/publishing/curseforge.gradle +++ b/gradle/publishing/curseforge.gradle @@ -10,10 +10,14 @@ curseforge { addGameVersion(minecraft_version) relations { - requiredDependency("fabric-api") - requiredDependency("fabric-language-kotlin") - requiredDependency("forge-config-api-port-fabric") - optionalDependency("roughly-enough-items") + for (dependency in (depends as List)) { + var optionalDep = dependency.endsWith("?") + if (optionalDep) { + optionalDependency(dependency.replace("?", "")) + } else { + requiredDependency(dependency) + } + } } // https://github.com/mraliscoder/plasmo-voice/blob/41243bc77589d975acde5385dd86414b1c92a2a8/fabric/build.gradle.kts#L173 diff --git a/gradle/publishing/modrinth.gradle b/gradle/publishing/modrinth.gradle index aead8c5..687c95e 100644 --- a/gradle/publishing/modrinth.gradle +++ b/gradle/publishing/modrinth.gradle @@ -10,10 +10,14 @@ modrinth { gameVersions = [ minecraft_version ] loaders = ["fabric"] dependencies { - required.project "fabric-api" - required.project "fabric-language-kotlin" - required.project "forge-config-api-port" - optional.project "rei" + for (dependency in (depends as List)) { + var optionalDep = dependency.endsWith("?") + if (optionalDep) { + optional.project(dependency.replace("?", "")) + } else { + required.project(dependency) + } + } } } diff --git a/gradle/publishing/publishing.gradle b/gradle/publishing/publishing.gradle index 1822183..bf12897 100644 --- a/gradle/publishing/publishing.gradle +++ b/gradle/publishing/publishing.gradle @@ -4,6 +4,8 @@ ext /*-ra properties*/ { Properties properties = new Properties() properties.load(new FileInputStream(file("gradle/publishing/publishing.properties"))) + depends = ((String) properties.get("dependencies"))?.split("; *") + properties.forEach ((k, v) -> set(k, v)) version_valid = versionValidForPublishing(version) @@ -30,6 +32,17 @@ tasks.register("printVersion") { println(version) } +tasks.register("printDependencies") { + for (dependency in (depends as List)) { + var optionalDep = dependency.endsWith("?") + if (optionalDep) { + println("optional: " + dependency); + } else { + println("required: " + dependency); + } + } +} + static String makeName(String version, String minecraftVersion, String displayName) { String projectVersion = "v" + version.split("-build")[0].replace("-", ".") String rawPatch = System.getenv("PATCH_NUMBER") diff --git a/gradle/publishing/publishing.properties b/gradle/publishing/publishing.properties index 8d104da..274c9ee 100644 --- a/gradle/publishing/publishing.properties +++ b/gradle/publishing/publishing.properties @@ -2,3 +2,4 @@ modrinth_id = 4Q5DgkRU curseforge_id = 833210 release_type = release changelog_file = CHANGELOG.md +dependencies = ad-astra;fabric-api;forge-config-api-port From 3313bb0f01e82828d228c091ffe709fea502fffe Mon Sep 17 00:00:00 2001 From: Erdragh Date: Thu, 12 Oct 2023 00:23:42 +0200 Subject: [PATCH 2/2] add missing dependencies to fabric json --- src/main/resources/fabric.mod.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 1d6926c..78cca9b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,7 +29,8 @@ "fabricloader": ">=${loader_version}", "fabric": "*", "minecraft": "1.18.2", - "ad_astra": ">=1.0.9" + "ad_astra": ">=1.0.9", + "forgeconfigapiport": ">=3.2.4" }, "accessWidener": "per_aspera.accesswidener" }