Fix the shrinkJar task
This commit is contained in:
parent
dac1294ee3
commit
d47de62bfa
|
@ -1,5 +1,6 @@
|
|||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.modrinth.minotaur.request.VersionType
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath("com.guardsquare:proguard-gradle:7.1.0-beta2") {
|
||||
|
@ -40,13 +41,23 @@ subprojects {
|
|||
keep("class fr.username404.snowygui.fabric.** { * ; }")
|
||||
keep("class fr.username404.snowygui.forge.** { * ; }")
|
||||
keepclassmembers("class fr.username404.snowygui.** { public protected <methods>; }")
|
||||
// TODO Fix kotlin
|
||||
keepattributes(); keepdirectories(); keeppackagenames(); keepparameternames()
|
||||
obfuscationdictionary("$dictionariesDir/dictionary.txt")
|
||||
classobfuscationdictionary("$dictionariesDir/classdictionary.txt")
|
||||
adaptclassstrings()
|
||||
"fr.username404.**".also { dontwarn(it); dontnote(it) }
|
||||
dontwarn("java.**") // Needed for the current version of proguard
|
||||
|
||||
// The following lines are needed at least for the current version of proguard
|
||||
dontwarn("java.**")
|
||||
onlyIf {
|
||||
JavaVersion.current().isJava8.also {
|
||||
if (it) {
|
||||
libraryjars("${Jvm.current().javaHome}/lib/rt.jar")
|
||||
libraryjars("${Jvm.current().javaHome}/lib/jce.jar")
|
||||
} else println("The shrinkJar task is disabled because Java 9 or higher does not work with our current proguard configuration.")
|
||||
}
|
||||
}
|
||||
|
||||
// Note: dontpreverify() should NOT be used, it will cause errors at runtime
|
||||
useuniqueclassmembernames()
|
||||
optimizations("method/inlining/*, code/allocation/variable, class/merging/vertical, code/removal/advanced, code/simplification/branch, code/merging")
|
||||
|
@ -81,10 +92,12 @@ allprojects {
|
|||
}
|
||||
tasks {
|
||||
withType(ShadowJar::class) {
|
||||
minimize {
|
||||
exclude(project(":common"))
|
||||
}
|
||||
relocate("kotlin", "${rootProject.group}.kotlin")
|
||||
relocate("com.typesafe.config", "${rootProject.group}.typesafe.config")
|
||||
relocate("io.github.config4k", "${rootProject.group}.config4k")
|
||||
exclude("**/*.kotlin_metadata")
|
||||
exclude("**/*.kotlin_builtins")
|
||||
exclude("META-INF/maven/**/*")
|
||||
archiveClassifier.set("shadow")
|
||||
}
|
||||
withType(Jar::class) {
|
||||
|
|
Loading…
Reference in New Issue