fix issues in gradle setups

This commit is contained in:
progwml6 2020-11-02 21:50:06 -05:00
parent 9dfd4947e4
commit bb0f2345d0
1 changed files with 38 additions and 10 deletions

View File

@ -147,21 +147,49 @@ sourceSets {
} }
} }
processResources { def modsTomlSpec = copySpec{
exclude '**/*.xcf' from(sourceSets.main.resources) {
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml' include 'META-INF/mods.toml'
expand 'version': project.version, expand 'version': project.version,
'minecraft_version_min': minecraft_version_min, 'minecraft_version_max': minecraft_version_max, 'minecraft_version_min': minecraft_version_min,
'forge_version_min': forge_version_min, 'forge_version_max': forge_version_max, 'minecraft_version_max': minecraft_version_max,
'javafml_min': javafml_min, 'javafml_max': javafml_max 'forge_version_min': forge_version_min,
'forge_version_max': forge_version_max,
'javafml_min': javafml_min,
'javafml_max': javafml_max
} }
}
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml' // need to copy into each build directory, unfortunately does not seem easy to do this automatically
def buildPaths = [
"$rootDir/out/production/resources", // IDEA
"$rootDir/bin", // Eclipse
]
// task to add mods.toml to all relevant folders
task replaceResources {
// copy for gradle
copy {
outputs.upToDateWhen { false }
with modsTomlSpec
into processResources.destinationDir
} }
// copy for IDEs
buildPaths.each { path ->
if (new File(path).exists()) {
copy {
outputs.upToDateWhen { false }
with modsTomlSpec
into path
}
}
}
}
processResources {
exclude 'META-INF/mods.toml'
finalizedBy replaceResources
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {