Skip to content

Commit

Permalink
attempt to fix gradle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
progwml6 committed Nov 3, 2020
1 parent 16c4dfc commit 2d736e7
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions build.gradle
Expand Up @@ -145,23 +145,52 @@ sourceSets {
}
}

processResources {
exclude '**/*.xcf'

from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'

def modsTomlSpec = copySpec{
from(sourceSets.main.resources) {
include 'META-INF/mods.toml'
expand 'version': project.version,
'minecraft_version_min': minecraft_version_min, 'minecraft_version_max': minecraft_version_max,
'forge_version_min': forge_version_min, 'forge_version_max': forge_version_max,
'javafml_min': javafml_min, 'javafml_max': javafml_max
'minecraft_version_min': minecraft_version_min,
'minecraft_version_max': minecraft_version_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) {
from sourceSets.main.allJava
classifier = 'sources'
Expand Down

0 comments on commit 2d736e7

Please sign in to comment.