Skip to content

Commit

Permalink
Minor cleanup in metadataTask
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Feb 8, 2024
1 parent 2713803 commit dfd255f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ variants.each { variant ->
// Depend on langTask and the following properties
dependsOn langTask
inputs.properties(
mod_id: rootProject.name,
version: project.mod_version,
authors: project.authors,
licence: project.licence,
Expand All @@ -63,27 +62,26 @@ variants.each { variant ->
// Declare task outputs so they can be used by other tasks
outputs.dir outputDir

def overrides = new TreeMap()
overrides.mod_id = inputs.properties.mod_id.toLowerCase()
overrides.json_authors = inputs.properties.authors.split(',').collect { "\"$it\"" }.join(", ")

// Need to do this at execution time;
// langTask won't have built anything at configuration time...
// LangTask.getTranslation() can't be used at configuration time...
doLast {
overrides.name = langTask.get().getTranslation("freecam.name")
overrides.description = langTask.get().getTranslation("freecam.description")
def values = new TreeMap(inputs.properties)
values.mod_id = rootProject.name.toLowerCase()
values.name = langTask.get().getTranslation("freecam.name")
values.description = langTask.get().getTranslation("freecam.description")
values.json_authors = values.authors.split(',').collect { "\"$it\"" }.join(", ")

copy {
// Include files under `src/platform`
from inputDir
into outputDir

filesMatching("fabric.mod.json") {
expand inputs.properties + overrides
expand values
}

filesMatching("META-INF/mods.toml") {
expand inputs.properties + overrides
expand values
}
}
}
Expand Down

0 comments on commit dfd255f

Please sign in to comment.