import groovy.json.JsonSlurper /* * This buildscript contains tasks related to the validation of each module in fabric api. * * Right now this task verifies each Fabric API module has a module lifecycle specified. * More functionality will probably be added in the future. */ subprojects { if (it.name == "deprecated") return // Create the task task validateModules(type: ValidateModuleTask) } /** * Verifies that each module has the required custom values for module lifecycle in it's FMJ. * *
Example: *
{@code * "custom": { * "fabric-api:module-lifecycle": "stable" * } * }*/ class ValidateModuleTask extends DefaultTask { ValidateModuleTask() { group = "verification" // Hook up validation to check task project.tasks.check.dependsOn(this) } @TaskAction void validate() { def clientOnlyMod = false def file = (project.file("src/main/resources/fabric.mod.json") as File) if (!file.exists()) { file = (project.file("src/client/resources/fabric.mod.json") as File) clientOnlyMod = true } def json = new JsonSlurper().parse(file) as Map