Flatten package hierarchy in the gradle proguard task and set the subprojects groups
This commit is contained in:
parent
b486342ce0
commit
c19b2ce735
|
@ -27,27 +27,29 @@ architectury {
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
lateinit var MappingsDep: Dependency
|
group = rootProject.group.toString()
|
||||||
|
lateinit var mappingsDep: Dependency
|
||||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||||
apply(plugin = "forgified-fabric-loom")
|
apply(plugin = "forgified-fabric-loom")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
val shadowC by configurations.creating
|
val shadowC by configurations.creating
|
||||||
tasks {
|
tasks {
|
||||||
withType(ShadowJar::class) { this.configurations = listOf(shadowC) }
|
withType(ShadowJar::class) { this.configurations = listOf(shadowC) }
|
||||||
val shrinkJar = register("shrinkJar", proguard.gradle.ProGuardTask::class) {
|
val shrinkJar = register("shrinkJar", proguard.gradle.ProGuardTask::class) { group = this@subprojects.group as String
|
||||||
val dictionariesDir = "$rootDir/obfuscation"
|
val dictionariesDir = "$rootDir/obfuscation"
|
||||||
injars(this@tasks.getByName("remapJar"))
|
injars(this@tasks.getByName("remapJar"))
|
||||||
outjars("$rootDir/shrinkedJars/")
|
outjars("$rootDir/shrinkedJars/")
|
||||||
keep("class fr.username404.snowygui.mixins.* { * ; }")
|
keep("class $group.snowygui.mixins.* { * ; }")
|
||||||
keep("class fr.username404.snowygui.fabric.** { * ; }")
|
keep("class $group.snowygui.fabric.** { * ; }")
|
||||||
keep("class fr.username404.snowygui.forge.** { * ; }")
|
keep("class $group.snowygui.forge.** { * ; }")
|
||||||
keepclassmembers("class fr.username404.snowygui.** { public protected <methods>; }")
|
keepclassmembers("class $group.snowygui.** { public protected <methods>; }")
|
||||||
keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions")
|
keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions")
|
||||||
obfuscationdictionary("$dictionariesDir/dictionary.txt")
|
obfuscationdictionary("$dictionariesDir/dictionary.txt")
|
||||||
classobfuscationdictionary("$dictionariesDir/classdictionary.txt")
|
classobfuscationdictionary("$dictionariesDir/classdictionary.txt")
|
||||||
packageobfuscationdictionary("$dictionariesDir/packagesdictionary.txt")
|
packageobfuscationdictionary("$dictionariesDir/packagesdictionary.txt")
|
||||||
|
flattenpackagehierarchy("$group.snowygui")
|
||||||
adaptclassstrings()
|
adaptclassstrings()
|
||||||
"fr.username404.**".also { dontwarn(it); dontnote(it) }
|
"$group.**".also { dontwarn(it); dontnote(it) }
|
||||||
|
|
||||||
// The following lines are needed at least for the current version of proguard
|
// The following lines are needed at least for the current version of proguard
|
||||||
dontwarn("java.**")
|
dontwarn("java.**")
|
||||||
|
@ -65,7 +67,7 @@ subprojects {
|
||||||
if (this@subprojects.name != "common") build.get().finalizedBy(shrinkJar)
|
if (this@subprojects.name != "common") build.get().finalizedBy(shrinkJar)
|
||||||
}
|
}
|
||||||
extensions.configure<net.fabricmc.loom.LoomGradleExtension>("loom") {
|
extensions.configure<net.fabricmc.loom.LoomGradleExtension>("loom") {
|
||||||
MappingsDep = officialMojangMappings()
|
mappingsDep = officialMojangMappings()
|
||||||
silentMojangMappingsLicense()
|
silentMojangMappingsLicense()
|
||||||
mixinConfig("snowygui-mixins.json")
|
mixinConfig("snowygui-mixins.json")
|
||||||
refmapName = "snowygui-common-refmap.json"
|
refmapName = "snowygui-common-refmap.json"
|
||||||
|
@ -77,7 +79,7 @@ subprojects {
|
||||||
}
|
}
|
||||||
"io.github.config4k:config4k:0.4.2".also { implementation(it); shadowC(it) }
|
"io.github.config4k:config4k:0.4.2".also { implementation(it); shadowC(it) }
|
||||||
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
||||||
"mappings"(MappingsDep)
|
"mappings"(mappingsDep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +140,8 @@ allprojects {
|
||||||
}
|
}
|
||||||
val modProperties = mapOf(
|
val modProperties = mapOf(
|
||||||
"mod_version" to (rootProject.version as String),
|
"mod_version" to (rootProject.version as String),
|
||||||
"minecraft_version" to mcBase
|
"minecraft_version" to mcBase,
|
||||||
|
"mod_group" to this@allprojects.group
|
||||||
)
|
)
|
||||||
inputs.properties(modProperties)
|
inputs.properties(modProperties)
|
||||||
filesNotMatching(listOf("*.png")) {
|
filesNotMatching(listOf("*.png")) {
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
"environment": "client",
|
"environment": "client",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"fr.username404.snowygui.fabric.FabricInit"
|
"${mod_group}.snowygui.fabric.FabricInit"
|
||||||
],
|
],
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"fr.username404.snowygui.fabric.ModMenuConf"
|
"${mod_group}.snowygui.fabric.ModMenuConf"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
Loading…
Reference in New Issue