Skip to content

Commit

Permalink
QOL: Making use of Forgix (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
Redstoneguy129 authored Nov 24, 2024
1 parent 1b8dc99 commit bca1290
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 86 deletions.
63 changes: 57 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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"
Expand Down Expand Up @@ -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
}
43 changes: 0 additions & 43 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing" version "0.1.+"
}

architectury {
Expand All @@ -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.
Expand Down
37 changes: 0 additions & 37 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing" version "0.1.+"
}
architectury {
platformSetupLoomIde()
Expand All @@ -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

Expand Down

0 comments on commit bca1290

Please sign in to comment.