diff --git a/fabricWrapper/build.gradle b/fabricWrapper/build.gradle index de47c7c7..0c11adff 100644 --- a/fabricWrapper/build.gradle +++ b/fabricWrapper/build.gradle @@ -1,4 +1,5 @@ import groovy.json.JsonBuilder +import groovy.json.JsonSlurper plugins { id("java-library") @@ -50,13 +51,6 @@ jar { processResources { // disable cache outputs.upToDateWhen { false } - ArrayList mc_condition = [] - ArrayList jars = [] - - fabric_subprojects.each({ - mc_condition.add("${it.minecraft_dependency}") - jars.add(["file": "META-INF/jars/${project.mod_archives_base_name}-${it.minecraft_version}-${project.version}.jar"]) - }) from("${rootDir}/icon.png") { into("assets/${project.mod_id}") @@ -64,7 +58,6 @@ processResources { filesMatching("fabric.mod.json") { expand([ - "minecraft_dependency": new JsonBuilder(mc_condition), "mod_description" : project.mod_description, "mod_homepage" : project.mod_homepage, "mod_id" : project.mod_id, @@ -72,9 +65,29 @@ processResources { "mod_name" : project.mod_name, "mod_version" : project.getModVersion(), "mod_sources" : project.mod_sources, - "sub_jars" : new JsonBuilder(jars).toPrettyString(), ]) } + + doLast { + ArrayList mc_condition = [] + ArrayList jars = [] + + fabric_subprojects.each({ + mc_condition.add("${it.minecraft_dependency}") + jars.add(["file": "META-INF/jars/${project.mod_archives_base_name}-${it.minecraft_version}-${project.version}.jar"]) + }) + + File file = file("build/resources/main/fabric.mod.json") + JsonSlurper slurper = new JsonSlurper() + JsonBuilder builder = new JsonBuilder(slurper.parse(file)) + builder.content.depends.minecraft = mc_condition + builder.content.jars = jars + BufferedWriter writer = file.newWriter() + writer.append(builder.toPrettyString()) + writer.flush() + writer.close() + println builder.toPrettyString() + } } java { @@ -162,4 +175,4 @@ signing { TaskCollection signingTasks = tasks.withType(Sign) tasks.withType(AbstractPublishToMaven).configureEach { it.dependsOn(signingTasks) -} \ No newline at end of file +} diff --git a/fabricWrapper/src/main/resources/fabric.mod.json b/fabricWrapper/src/main/resources/fabric.mod.json index 35168834..48193bfc 100644 --- a/fabricWrapper/src/main/resources/fabric.mod.json +++ b/fabricWrapper/src/main/resources/fabric.mod.json @@ -40,8 +40,6 @@ } }, "depends": { - "fabricloader": ">=0.11.7", - "minecraft": ${minecraft_dependency} - }, - "jars": ${sub_jars} + "fabricloader": ">=0.11.7" + } }