Include only the mod meta data file for the respective loader

Also clean up the entire processResources block in the process cause it was a
mere coincidence that it has worked properly.
This commit is contained in:
Jonas Herzig
2020-07-13 14:44:26 +02:00
parent ecee63491c
commit f83216ab91

View File

@@ -458,36 +458,29 @@ jar {
} }
} }
processResources processResources {
{ // this will ensure that this task is redone when the versions change.
// this will ensure that this task is redone when the versions change. inputs.property 'version', { project.version }
inputs.property 'version', { project.version } inputs.property 'mcversion', { mcVersionStr }
inputs.property 'mcversion', { mcVersionStr }
// replace stuff in mcmod.info (forge) and fabric.mod.json, nothing else // replace stuff in mcmod.info (forge) and fabric.mod.json, nothing else
from(sourceSets.main.resources.srcDirs) { spec -> filesMatching(['mcmod.info', 'fabric.mod.json']) {
include 'mcmod.info' // replace version and mcversion
include 'fabric.mod.json' expand 'version': project.version, 'mcversion': mcVersionStr
}
// replace version and mcversion // strip comments from (strict) JSON files
afterEvaluate { filesMatching('pack.mcmeta') {
spec.expand 'version': project.version, 'mcversion': mcVersionStr filter { line -> line.trim().startsWith('//') ? '' : line}
} }
}
// strip comments from (strict) JSON files // exclude mod meta for non-applicable loader
from(sourceSets.main.resources.srcDirs) { if (FABRIC) {
include 'pack.mcmeta' exclude 'mcmod.info'
filter { line -> line.trim().startsWith('//') ? '' : line} } else {
} exclude 'fabric.mod.json'
}
// 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'
}
}
sourceSets { sourceSets {
integrationTest { integrationTest {