Skip to content

Commit

Permalink
Use templates for mod metadata instead of processResources
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 23, 2025
1 parent 5ceca14 commit a04a5c3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
26 changes: 17 additions & 9 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import kotlin.io.path.invariantSeparatorsPathString
plugins {
id("carbon.shadow-platform")
id("quiet-fabric-loom")
alias(libs.plugins.blossom)
}

val shade: Configuration by configurations.creating
Expand Down Expand Up @@ -59,6 +60,22 @@ carbonPlatform {
productionJar = tasks.remapJar.flatMap { it.archiveFile }
}

sourceSets.main {
blossom {
resources {
properties.putAll(
mapOf(
"modId" to rootProject.name.lowercase(),
"name" to rootProject.name,
"version" to project.version,
"description" to project.description,
"githubUrl" to GITHUB_REPO_URL,
)
)
}
}
}

tasks {
shadowJar {
configurations = listOf(shade)
Expand All @@ -72,15 +89,6 @@ tasks {
relocateGuice()
relocateDependency("org.checkerframework")
}
processResources {
replace("fabric.mod.json", mapOf(
"modId" to rootProject.name.lowercase(),
"name" to rootProject.name,
"version" to project.version,
"description" to project.description,
"github_url" to GITHUB_REPO_URL
))
}

runServer {
dependsOn(shadowJar)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"schemaVersion": 1,
"id": "${modId}",
"version": "${version}",
"name": "${name}",
"description": "${description}",
"id": "{{ modId }}",
"version": "{{ version }}",
"name": "{{ name }}",
"description": "{{ description }}",
"authors": [
"Draycia",
"jmp"
],
"contact": {
"homepage": "${github_url}",
"sources": "${github_url}",
"issues": "${github_url}/issues"
"homepage": "{{ githubUrl }}",
"sources": "{{ githubUrl }}",
"issues": "{{ githubUrl }}/issues"
},
"license": "GPLv3",
"environment": "*",
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sponge-gradle = { id = "org.spongepowered.gradle.plugin", version = "2.2.0" }
hangar-publish = { id = "io.papermc.hangar-publish-plugin", version = "0.1.2" }
indra-publishing-sonatype = { id = "net.kyori.indra.publishing.sonatype", version.ref = "indra" }
javadoc-links = { id = "org.incendo.cloud-build-logic.javadoc-links", version = "0.0.15" }
blossom = { id = "net.kyori.blossom", version = "2.1.0" }

[versions]
indra = "3.1.3"
Expand Down
26 changes: 17 additions & 9 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("carbon.shadow-platform")
id("net.neoforged.moddev")
alias(libs.plugins.blossom)
}

neoForge {
Expand Down Expand Up @@ -66,6 +67,22 @@ carbonPlatform {
productionJar = prodJar.flatMap { it.archiveFile }
}

sourceSets.main {
blossom {
resources {
properties.putAll(
mapOf(
"modId" to rootProject.name.lowercase(),
"name" to rootProject.name,
"version" to project.version,
"description" to project.description,
"githubUrl" to GITHUB_REPO_URL,
)
)
}
}
}

tasks {
shadowJar {
archiveClassifier = "dev-all"
Expand All @@ -80,15 +97,6 @@ tasks {
relocateGuice()
relocateDependency("org.checkerframework")
}
processResources {
replace("META-INF/neoforge.mods.toml", mapOf(
"modId" to rootProject.name.lowercase(),
"name" to rootProject.name,
"version" to project.version,
"description" to project.description,
"github_url" to GITHUB_REPO_URL
))
}
jar {
archiveClassifier = "dev"
}
Expand Down

0 comments on commit a04a5c3

Please sign in to comment.