Skip to content

Commit

Permalink
Cleanup build script, configure publishing plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
50ap5ud5 committed Jan 5, 2025
1 parent 2cb3ddd commit 1986b9a
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 190 deletions.
119 changes: 108 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ plugins {
// see https://fabricmc.net/develop/ for new versions
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
id 'net.neoforged.moddev' version '2.0.52-beta' apply false
id "net.darkhax.curseforgegradle" version "1.1.25" apply(false)
id "com.modrinth.minotaur" version "2.+" apply(false)
// id "me.shedaniel.unified-publishing" version "0.1.+"
id 'net.neoforged.moddev' version '2.0.72' apply false
id "me.modmuss50.mod-publish-plugin" version "0.8.3"
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)' apply false
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply false
}

allprojects {
Expand All @@ -15,8 +15,9 @@ allprojects {
group = rootProject.maven_group

repositories {
mavenCentral()
maven {
url "https://cursemaven.com"
url = "https://cursemaven.com"
}

maven {
Expand All @@ -34,7 +35,7 @@ allprojects {
url = "https://maven.terraformersmc.com/"
}

maven { url 'https://jitpack.io' }
maven { url = 'https://jitpack.io' }

flatDir {
dirs '../modlibs'
Expand All @@ -49,8 +50,104 @@ allprojects {

}

//task publishMeEverywhere(){
// dependsOn ':neoforge:publishUnified'
// dependsOn ':fabric:publishUnified'
// dependsOn ':forge:publishUnified'
//}
publishMods {
File changeLog = rootProject.file("changelog.md")
String changelogText = changeLog.exists() ? changeLog.text : ""
changelog = changelogText

type = STABLE

dryRun = true //Always enable for debug

// CurseForge options used by both Fabric and Forge
def cfOptions = curseforgeOptions {
accessToken = providers.gradleProperty("CURSEFORGE_TOKEN")
minecraftVersions.add("1.21.4")
javaVersions.add(JavaVersion.VERSION_21)
clientRequired = true
dryRun = true
}

// Modrinth options used by both Fabric and Forge
def mrOptions = modrinthOptions {
accessToken = providers.gradleProperty("MODRINTH_TOKEN")
projectId = "${modrinth_id}"
minecraftVersionRange {
start = "1.21.4"
end = "1.21.4" // Set to "latest" to use the latest minecraft version
}
dryRun = true
}

// Fabric specific options for CurseForge
curseforge("curseforgeFabric") {
from cfOptions
file project(":fabric")
projectId = "${curseforge_id_fabric}"
modLoaders.add("fabric")
requires {
slug = "fabric-api"
}
embeds("cloth-config")
optional("modmenu")
version = "${minecraft_version}-${mod_version}-fabric"
displayName = "${jar_name}-Fabric-${minecraft_version}-${mod_version}"
}

// Forge specific options for CurseForge
curseforge("curseforgeForge") {
from cfOptions
file project(":forge")
modLoaders.add("forge")
projectId = "${curseforge_id_forge}"
version = "${minecraft_version}-${mod_version}-forge"
displayName = "${jar_name}-Forge-${minecraft_version}-${mod_version}"
}

// Neoforge specific options for Curseforge
curseforge("curseforgeNeoforge") {
from cfOptions
file project(":neoforge")
modLoaders.add("neoforge")
projectId = "${curseforge_id_forge}"
version = "${minecraft_version}-${mod_version}-neoforge"
displayName = "${jar_name}-Neoforge-${minecraft_version}-${mod_version}"
}

// Fabric specific options for Modrinth
modrinth("modrinthFabric") {
from mrOptions
file project(":fabric")
modLoaders.add("fabric")
requires {
slug = "fabric-api"
}
embeds {
slug = "cloth-config"
}
optional {
slug = "modmenu"
}
version = "${minecraft_version}-${mod_version}-fabric"
displayName = "${jar_name}-Fabric-${minecraft_version}-${mod_version}"
}

// Forge specific options for Modrinth
modrinth("modrinthForge") {
from mrOptions
file project(":forge")
modLoaders.add("forge")
version = "${minecraft_version}-${mod_version}-forge"
displayName = "${jar_name}-Forge-${minecraft_version}-${mod_version}"
}

// Neoforge specific options for Modrinth
modrinth("modrinthNeoforge") {
from mrOptions
file project(":neoforge")
modLoaders.add("neoforge")
version = "${minecraft_version}-${mod_version}-neoforge"
displayName = "${jar_name}-Neoforge-${minecraft_version}-${mod_version}"
}

}
1 change: 1 addition & 0 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ repositories {
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant ->
configurations."$variant".outgoing {
capability("$group:${project.name}:$version")
capability("$group:${base.archivesName.get()}:$version")
capability("$group:$mod_id-${project.name}-${minecraft_version}:$version")
capability("$group:$mod_id:$version")
Expand Down
86 changes: 5 additions & 81 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
plugins {
id 'multiloader-loader'
id 'fabric-loom'
id "com.github.johnrengelman.shadow" version "8.1.1"
id 'net.darkhax.curseforgegradle'
id 'com.modrinth.minotaur'
}

//Use the existing Neoforge data generator for resource pack data
Expand Down Expand Up @@ -42,23 +39,21 @@ loom {

repositories {

maven { url "https://maven.architectury.dev/" }

// the repository for Cloth Config
maven { url "https://maven.shedaniel.me/" }
maven { url = uri("https://maven.shedaniel.me/") }

maven {
url "https://cursemaven.com"
url = uri("https://cursemaven.com")
}

maven {
name = "Mod Menu Maven"
url = "https://maven.terraformersmc.com/"
url = uri("https://maven.terraformersmc.com/")
}

maven {
name = "Fuzs Mod Resources"
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
url = uri("https://raw.githubusercontent.com/Fuzss/modresources/main/maven/")
}
}

Expand All @@ -72,7 +67,7 @@ dependencies {

modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

// Fabric API. This is technically optional, but we need this for Forge Config API Port
// Fabric API. This is technically optional, but we need this for Forge Config API Port and Cloth Config
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"


Expand All @@ -91,9 +86,6 @@ dependencies {
}
modRuntimeOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}")

// common(project(path: ":common", configuration: "namedElements")) { transitive false }
// shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }

}

/* IntelliJ Project Import
Expand All @@ -106,72 +98,4 @@ if (System.getProperty("idea.sync.active") == "true") {
it.options.annotationProcessorPath = files()
}
}
}

//shadowJar {
// exclude "architectury.common.json"
// configurations = [project.configurations.shadowCommon]
// archiveClassifier = "dev-shadow"
//}

//remapJar {
// injectAccessWidener = true
// inputFile.set shadowJar.archiveFile
// dependsOn shadowJar
// archiveClassifier.set(null)
//}

//jar {
// archiveClassifier.set("dev")
//}

//sourcesJar {
// def commonSources = project(":common").sourcesJar
// dependsOn commonSources
// from commonSources.archiveFile.map { zipTree(it) }
//}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

if (System.getenv().CURSEFORGE_PUBLISH) {
task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv().CURSEFORGE_PUBLISH

def mainFile = upload(curseforge_id_fabric, remapJar)
mainFile.releaseType = 'release'
mainFile.addGameVersion "Fabric"
mainFile.addGameVersion "${minecraft_version}"
mainFile.addGameVersion "Java 21"
mainFile.addGameVersion('Client')

mainFile.changelog = file("$project.rootDir/changelog.md")
mainFile.changelogType = 'markdown'

mainFile.addRequirement("fabric-api", "cloth-config")
}
}


if (System.getenv().MODRINTH_PUBLISH) {
String fileContents = file("$project.rootDir/changelog.md").text
modrinth {
token = System.getenv().MODRINTH_PUBLISH
projectId = modrinth_id
versionType = "release"
versionName = "${mod_name}-${project.name}-${minecraft_version}"
versionNumber = project.version
uploadFile = remapJar
changelog = fileContents
gameVersions = ["${minecraft_version}"]
loaders = ["fabric"]

dependencies {
required.project "fabric-api"
required.project "cloth-config"
}
}
}
56 changes: 10 additions & 46 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
plugins {
id 'multiloader-loader'
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
id "com.github.johnrengelman.shadow" version "7.1.2"
id 'net.darkhax.curseforgegradle'
id 'com.modrinth.minotaur'
id 'net.minecraftforge.gradle'
id 'org.spongepowered.mixin'
}

mixin {
config("${mod_id}.common.mixins.json")
}

jar {
manifest {
attributes["MixinConfigs"] = "${mod_id}.common.mixins.json,${mod_id}.forge.mixins.json"
}
}

//Use the existing Neoforge data generator for resource pack data
def generatedResources = project(":neoforge").file("src/generated/resources")

Expand All @@ -21,7 +24,8 @@ sourceSets {
}

repositories {
maven { url "https://maven.minecraftforge.net/" }
maven { url = uri("https://maven.minecraftforge.net/") }
maven { url = uri("https://repo1.maven.org/maven2/") }
}


Expand Down Expand Up @@ -89,9 +93,6 @@ dependencies {
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }

// common(project(path: ":common", configuration: "namedElements")) { transitive false }
// shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }

// implementation("me.shedaniel.cloth:cloth-config-forge:${rootProject.cloth_config_version}")

//MixinExtras
Expand All @@ -108,7 +109,6 @@ dependencies {
// jarJar.ranged(it, "[${rootProject.forge_config_api_port_version},)")
// }


}


Expand All @@ -125,39 +125,3 @@ sourceSets.each {
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}


if (System.getenv().CURSEFORGE_PUBLISH) {
task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv().CURSEFORGE_PUBLISH

def mainFile = upload(curseforge_id_forge, jar)
mainFile.releaseType = 'release'
mainFile.addGameVersion "Forge"
mainFile.addGameVersion "${minecraft_version}"
mainFile.addGameVersion "Java 21"
mainFile.addGameVersion('Client')

mainFile.changelog = file("$project.rootDir/changelog.md")
mainFile.changelogType = 'markdown'

mainFile.addRequirement("configured")
}
}


if (System.getenv().MODRINTH_PUBLISH) {
String fileContents = file("$project.rootDir/changelog.md").text
modrinth {
token = System.getenv().MODRINTH_PUBLISH
projectId = project.modrinth_id
versionType = "release"
versionName = "${mod_name}-${project.name}-${minecraft_version}"
versionNumber = project.version
uploadFile = jar
changelog = fileContents
gameVersions = ["${minecraft_version}"]
loaders = ["forge"]

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static class Client {

public Client(ForgeConfigSpec.Builder builder) {
builder.push(BConstants.CONFIG_NAME);
SHOW_HANDS = builder.comment("Toggle whether the item held in hand should be rendered whilst the boat is moving").translation(BTranslationKeys.CONFIG_SHOW_HANDS).define("show_hands", true);
SHOW_HANDS = builder.comment("Toggle whether the item held in hand should be rendered whilst the boat is moving").translation(BTranslationKeys.configOption(BTranslationKeys.CONFIG_SHOW_HANDS)).define("show_hands", true);
WHITELISTED_ITEMS = builder.comment("Items that will remain displayed in hand. Adding the character '*' after a Mod ID will include all items from the mod. E.g. 'modid:*'. If no Mod ID is specified before the '*' character, all items will be included. E.g. '*'")
.translation(BTranslationKeys.CONFIG_WHITELIST_ITEMS)
.translation(BTranslationKeys.configOption(BTranslationKeys.CONFIG_WHITELIST_ITEMS))
.defineList("whitelisted_items", Lists.newArrayList("minecraft:filled_map"), String.class::isInstance);
builder.pop();
}
Expand Down
Loading

0 comments on commit 1986b9a

Please sign in to comment.