Skip to content

Commit 72e5fae

Browse files
committed
unified publishmods.
1 parent ecff713 commit 72e5fae

4 files changed

Lines changed: 50 additions & 61 deletions

File tree

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ plugins {
33
id 'fabric-loom' version '1.13-SNAPSHOT' apply false
44
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
55
id 'net.neoforged.moddev' version '2.0.140' apply false
6+
id "me.modmuss50.mod-publish-plugin" version "1.1.0" apply false
67
}

buildSrc/src/main/groovy/multiloader-loader.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,49 @@ tasks.named('sourcesJar', Jar) {
4242
dependsOn(configurations.commonResources)
4343
from(configurations.commonResources)
4444
}
45+
46+
pluginManager.withPlugin('me.modmuss50.mod-publish-plugin') {
47+
def isFabric = project.name == 'fabric'
48+
def loaderName = isFabric ? 'Fabric' : 'NeoForge'
49+
def changelogFile = file("../${project.name}/build/changelog.txt")
50+
def releaseType = isFabric ? project.findProperty('fabricVersionType') : project.findProperty('versionType')
51+
52+
afterEvaluate {
53+
publishMods {
54+
file = isFabric ? remapJar.archiveFile : jar.archiveFile
55+
displayName = "${mod_name.replace(' ','')}-${loaderName}-${minecraft_version} ${version}"
56+
if (changelogFile.exists()) {
57+
changelog.set(changelogFile.getText())
58+
}
59+
type = releaseType?.toUpperCase() ?: 'RELEASE'
60+
if (isFabric) {
61+
modLoaders.add("fabric")
62+
modLoaders.add("quilt")
63+
} else {
64+
modLoaders.add("neoforge")
65+
}
66+
curseforge {
67+
projectId = "252818"
68+
projectSlug = "dynamictrees"
69+
accessToken = providers.gradleProperty("curseApiKey").getOrElse(providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull())
70+
minecraftVersions.add(minecraft_version)
71+
if (isFabric) {
72+
requires("forge-config-api-port")
73+
} else {
74+
optional("dynamictreesplus")
75+
}
76+
}
77+
modrinth {
78+
projectId = "vdjF5PL5"
79+
accessToken = providers.gradleProperty("modrinthToken").getOrElse(providers.environmentVariable("MODRINTH_TOKEN").getOrNull())
80+
minecraftVersions.add(minecraft_version)
81+
if (isFabric) {
82+
requires("ohNO6lps")
83+
} else {
84+
optional("qaO9Dqpu")
85+
}
86+
}
87+
}
88+
}
89+
}
90+

fabric/build.gradle

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import me.modmuss50.mpp.ReleaseType
2-
31
plugins {
42
id 'multiloader-loader'
53
id 'fabric-loom'
6-
id "me.modmuss50.mod-publish-plugin" version "0.8.4"
4+
id "me.modmuss50.mod-publish-plugin"
75
}
86
version = "${version}${fabricVersionAppend}"
97

@@ -75,30 +73,3 @@ loom {
7573

7674
sourceSets.main.resources { srcDir 'src/generated/resources' }
7775

78-
def changelogFile = file("../fabric/build/changelog.txt")
79-
80-
publishMods {
81-
file = remapJar.archiveFile
82-
displayName = "${mod_name.replace(' ','')}-Fabric-${minecraft_version} ${version}"
83-
if (changelogFile.exists()) {
84-
changelog.set(changelogFile.getText())
85-
}
86-
type = ReleaseType.of(fabricVersionType.toUpperCase())
87-
modLoaders.add("fabric")
88-
modLoaders.add("quilt")
89-
curseforge {
90-
projectId = "252818"
91-
projectSlug = "dynamictrees"
92-
accessToken = providers.gradleProperty("curseApiKey").orElse(providers.environmentVariable("CURSEFORGE_API_KEY")).orNull
93-
minecraftVersions.add("1.21.1")
94-
// optional("dynamictreesplus")
95-
requires("forge-config-api-port")
96-
}
97-
modrinth {
98-
projectId = "vdjF5PL5"
99-
minecraftVersions.add("1.21.1")
100-
accessToken = providers.gradleProperty("modrinthToken").orElse(providers.environmentVariable("MODRINTH_TOKEN")).orNull
101-
// optional("qaO9Dqpu")
102-
requires("ohNO6lps")
103-
}
104-
}

neoforge/build.gradle

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import me.modmuss50.mpp.ReleaseType
2-
31
plugins {
42
id 'multiloader-loader'
53
id 'net.neoforged.moddev'
6-
id "me.modmuss50.mod-publish-plugin" version "1.1.0"
4+
id "me.modmuss50.mod-publish-plugin"
75
}
86
version = "${version}${neoVersionAppend}"
97

@@ -23,7 +21,7 @@ neoForge {
2321
runs {
2422
configureEach {
2523
systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
26-
ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
24+
ideName = "NeoForge ${it.name.capitalize()} (${project.path})"
2725
}
2826
client {
2927
client()
@@ -64,37 +62,10 @@ neoForge {
6462
implementation "curse.maven:glitchcore-955399:5660740"
6563
implementation "curse.maven:serene-seasons-291874:5753503"
6664

67-
//runtimeOnly "curse.maven:distant-horizons-508933:7328639"
6865
runtimeOnly "curse.maven:patchouli-306770:6164617"
6966
runtimeOnly "curse.maven:spark-361579:6225208"
7067
}
7168

7269
}
7370

7471
sourceSets.main.resources { srcDir 'src/generated/resources' }
75-
76-
def changelogFile = file("../neoforge/build/changelog.txt")
77-
78-
publishMods {
79-
file = jar.archiveFile
80-
displayName = "${mod_name.replace(' ','')}-NeoForge-${minecraft_version} ${project.version}"
81-
if (changelogFile.exists()) {
82-
changelog.set(changelogFile.getText())
83-
}
84-
type = ReleaseType.of(versionType.toUpperCase())
85-
modLoaders.add("neoforge")
86-
87-
curseforge {
88-
projectId = "252818"
89-
projectSlug = "dynamictrees"
90-
accessToken = providers.gradleProperty("curseApiKey").orElse(providers.environmentVariable("CURSEFORGE_API_KEY")).orNull
91-
minecraftVersions.add("1.21.1")
92-
optional("dynamictreesplus")
93-
}
94-
modrinth {
95-
projectId = "vdjF5PL5"
96-
accessToken = providers.gradleProperty("modrinthToken").orElse(providers.environmentVariable("MODRINTH_TOKEN")).orNull
97-
minecraftVersions.add("1.21.1")
98-
optional("qaO9Dqpu")
99-
}
100-
}

0 commit comments

Comments
 (0)