Fix :shadowJar task

It now copies any shadowed jar in any configured subprojects
instead of requiring all subprojects
This commit is contained in:
Jonas Herzig
2019-05-06 11:01:55 +02:00
parent a65f3efbc5
commit b55dce280c
3 changed files with 11 additions and 13 deletions

View File

@@ -35,6 +35,10 @@ group= "com.replaymod"
// Fabric's remapJar task assumes the compile configuration to exist
configurations { compile }
task shadowJar(type: Copy) {
into "$buildDir/libs"
}
subprojects {
buildscript {
repositories {
@@ -46,18 +50,13 @@ subprojects {
// Workaround for https://discuss.gradle.org/t/idea-plugin-bug/21525
apply plugin: 'eclipse'
apply plugin: 'idea'
}
//evaluationDependsOnChildren()
task shadowJar(type: Copy) {
subprojects.forEach {
def shadowJar = it.tasks.findByName('shadowJar')
if (shadowJar != null && it.name != 'core') {
dependsOn shadowJar
from shadowJar.archivePath
}
def shadowJar = it.tasks.findByName('shadowJar')
if (shadowJar != null && shadowJar.hasProperty('archivePath') && project.name != 'core') {
def rootTask = rootProject.tasks.shadowJar
rootTask.dependsOn shadowJar
rootTask.from shadowJar.archivePath
}
into "$buildDir/libs"
}
def gitDescribe() {