Cache configureRelocation output so we can do up-to-date checks
Saves us from having to run it every time even if the shadowJar task would be up-to-date anyway.
This commit is contained in:
@@ -319,9 +319,11 @@ if (FABRIC) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File configureRelocationOutput = new File(project.buildDir, 'configureRelocation')
|
||||||
task configureRelocation() {
|
task configureRelocation() {
|
||||||
dependsOn tasks.jar
|
dependsOn tasks.jar
|
||||||
dependsOn configurations.relocate
|
dependsOn configurations.relocate
|
||||||
|
outputs.file(configureRelocationOutput)
|
||||||
doLast {
|
doLast {
|
||||||
def pkgs = files(configurations.relocate).filter { it.exists() }.collect {
|
def pkgs = files(configurations.relocate).filter { it.exists() }.collect {
|
||||||
def tree = it.isDirectory() ? fileTree(it) : zipTree(it)
|
def tree = it.isDirectory() ? fileTree(it) : zipTree(it)
|
||||||
@@ -367,10 +369,7 @@ task configureRelocation() {
|
|||||||
}
|
}
|
||||||
pkgs
|
pkgs
|
||||||
}.flatten().unique()
|
}.flatten().unique()
|
||||||
pkgs.each { pkg ->
|
configureRelocationOutput.write(pkgs.join('\n'))
|
||||||
def pkgName = pkg.replace('/', '.')
|
|
||||||
shadowJar.relocate pkgName, 'com.replaymod.lib.' + pkgName
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,6 +391,13 @@ task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar)
|
|||||||
exclude 'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'module-info.class'
|
exclude 'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'module-info.class'
|
||||||
|
|
||||||
dependsOn tasks.configureRelocation
|
dependsOn tasks.configureRelocation
|
||||||
|
inputs.file(configureRelocationOutput)
|
||||||
|
doFirst {
|
||||||
|
configureRelocationOutput.readLines().each { pkg ->
|
||||||
|
def pkgName = pkg.replace('/', '.')
|
||||||
|
relocate pkgName, 'com.replaymod.lib.' + pkgName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No need to shadow netty, MC provides it
|
// No need to shadow netty, MC provides it
|
||||||
relocate 'com.github.steveice10.netty', 'io.netty'
|
relocate 'com.github.steveice10.netty', 'io.netty'
|
||||||
|
|||||||
Reference in New Issue
Block a user