diff --git a/versions/common.gradle b/versions/common.gradle index 4c8d3036..8bd2f1f0 100644 --- a/versions/common.gradle +++ b/versions/common.gradle @@ -458,36 +458,29 @@ jar { } } -processResources - { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', { project.version } - inputs.property 'mcversion', { mcVersionStr } +processResources { + // this will ensure that this task is redone when the versions change. + inputs.property 'version', { project.version } + inputs.property 'mcversion', { mcVersionStr } - // replace stuff in mcmod.info (forge) and fabric.mod.json, nothing else - from(sourceSets.main.resources.srcDirs) { spec -> - include 'mcmod.info' - include 'fabric.mod.json' + // replace stuff in mcmod.info (forge) and fabric.mod.json, nothing else + filesMatching(['mcmod.info', 'fabric.mod.json']) { + // replace version and mcversion + expand 'version': project.version, 'mcversion': mcVersionStr + } - // replace version and mcversion - afterEvaluate { - spec.expand 'version': project.version, 'mcversion': mcVersionStr - } - } + // strip comments from (strict) JSON files + filesMatching('pack.mcmeta') { + filter { line -> line.trim().startsWith('//') ? '' : line} + } - // strip comments from (strict) JSON files - from(sourceSets.main.resources.srcDirs) { - include 'pack.mcmeta' - filter { line -> line.trim().startsWith('//') ? '' : line} - } - - // copy everything else, thats not the mcmod.info or fabric.mod.json - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - exclude 'fabric.mod.json' - exclude 'pack.mcmeta' - } - } + // exclude mod meta for non-applicable loader + if (FABRIC) { + exclude 'mcmod.info' + } else { + exclude 'fabric.mod.json' + } +} sourceSets { integrationTest {