diff --git a/build.gradle b/build.gradle index bf7a41d24..b03398b14 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,20 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "1.5+" apply false + id "io.github.pacifistmc.forgix" version "1.2.9" + id "me.shedaniel.unified-publishing" version "0.1.+" } - - architectury { minecraft = rootProject.minecraft_version } +forgix { + group = "whocraft.tardis_refined" + mergedJarName = "$rootProject.jar_name-mc$project.minecraft_version-v${rootProject.mod_version}.jar" + outputDir = "build/libs" +} + subprojects { apply plugin: "dev.architectury.loom" @@ -24,8 +30,48 @@ subprojects { } implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' } -} + build.finalizedBy(mergeJars) + assemble.finalizedBy(mergeJars) +} +if (System.getenv("curseforge") != null && System.getenv("modrinth") != null) { + unifiedPublishing { + project { + displayName = "Tardis Refined - mc${rootProject.minecraft_version}-v${rootProject.mod_version}" + releaseType = "release" + changelog = new File("${rootProject.projectDir}/changelog.md").text + gameVersions = ["$rootProject.minecraft_version"] + mainPublication project.layout.file(project.provider { + new File("${project.projectDir}/build/libs/$rootProject.jar_name-mc$project.minecraft_version-v${rootProject.mod_version}.jar") + }) + gameLoaders = ["fabric", "neoforge"] + relations { + optional { + curseforge = "immersive-portals-mod" + modrinth = "immersiveportals" + } + } + + var CURSE_API_KEY = project.findProperty("curseforge") ?: System.getenv("curseforge") ?: "" + if (CURSE_API_KEY != "") { + curseforge { + token = CURSE_API_KEY + id = "782697" + gameVersions.addAll "Java 17", "$rootProject.minecraft_version" + } + } + + var MODRINTH_TOKEN = project.findProperty("modrinth") ?: System.getenv("modrinth") ?: "" + if (MODRINTH_TOKEN != "") { + modrinth { + token = MODRINTH_TOKEN + id = "nqVt6aES" + version = "$project.version" + } + } + } + } +} allprojects { apply plugin: "java" @@ -65,7 +111,12 @@ allprojects { } } -task publishMeEverywhere(){ - dependsOn ':forge:publishUnified' - dependsOn ':fabric:publishUnified' +tasks.mergeJars.dependsOn(tasks.build) + +tasks.register('publishMeEverywhere') { + dependsOn tasks.mergeJars, tasks.publishUnified +} + +tasks.publishUnified { + mustRunAfter tasks.mergeJars } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 67e145abc..5e8c02d33 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" - id "me.shedaniel.unified-publishing" version "0.1.+" } architectury { @@ -13,48 +12,6 @@ loom { } // - -if (System.getenv("curseforge") != null && System.getenv("modrinth") != null) { - unifiedPublishing { - project { - displayName = "[Fabric] Tardis Refined - $project.version" - releaseType = "release" - changelog = new File("${rootProject.projectDir}/changelog.md").text - gameVersions = ["$rootProject.minecraft_version"] - mainPublication tasks.remapJar - gameLoaders = ["fabric"] - relations { - depends { - curseforge = "fabric-api" - modrinth = "fabric-api" - } - optional { - curseforge = "immersive-portals-mod" - modrinth = "immersiveportals" - } - } - - var CURSE_API_KEY = project.findProperty("curseforge") ?: System.getenv("curseforge") ?: "" - if (CURSE_API_KEY != "") { - curseforge { - token = CURSE_API_KEY - id = "782697" - gameVersions.addAll "Java 17", "$rootProject.minecraft_version" - } - } - - var MODRINTH_TOKEN = project.findProperty("modrinth") ?: System.getenv("modrinth") ?: "" - if (MODRINTH_TOKEN != "") { - modrinth { - token = MODRINTH_TOKEN - id = "nqVt6aES" - version = "fabric-$project.version" - } - } - } - } -} - configurations { common shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. diff --git a/forge/build.gradle b/forge/build.gradle index 038716f7c..73ce6b351 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" - id "me.shedaniel.unified-publishing" version "0.1.+" } architectury { platformSetupLoomIde() @@ -15,46 +14,10 @@ sourceSets { } } -if (System.getenv("curseforge") != null && System.getenv("modrinth") != null) { - unifiedPublishing { - project { - displayName = "[NeoForge] Tardis Refined - $project.version" - releaseType = "release" - changelog = new File("${rootProject.projectDir}/changelog.md").text - gameVersions = ["$rootProject.minecraft_version"] - mainPublication tasks.remapJar - gameLoaders = ["neoforge"] - relations { - - } - - var CURSE_API_KEY = project.findProperty("curseforge") ?: System.getenv("curseforge") ?: "" - if (CURSE_API_KEY != "") { - curseforge { - token = CURSE_API_KEY - id = "782697" - gameVersions.addAll "Java 17", "$rootProject.minecraft_version" - } - } - - var MODRINTH_TOKEN = project.findProperty("modrinth") ?: System.getenv("modrinth") ?: "" - if (MODRINTH_TOKEN != "") { - modrinth { - token = MODRINTH_TOKEN - id = "nqVt6aES" - version = "neoforge-$project.version" - } - } - } - } -} - - remapJar { atAccessWideners.add('tardis_refined.accesswidener') } - loom { accessWidenerPath = project(":common").loom.accessWidenerPath