Flatten package hierarchy in the gradle proguard task and set the subprojects groups

This commit is contained in:
Username404-59 2021-04-27 18:56:09 +02:00
parent b486342ce0
commit c19b2ce735
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 15 additions and 12 deletions

View File

@ -27,27 +27,29 @@ architectury {
}
subprojects {
lateinit var MappingsDep: Dependency
group = rootProject.group.toString()
lateinit var mappingsDep: Dependency
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "forgified-fabric-loom")
apply(plugin = "com.github.johnrengelman.shadow")
val shadowC by configurations.creating
tasks {
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"
injars(this@tasks.getByName("remapJar"))
outjars("$rootDir/shrinkedJars/")
keep("class fr.username404.snowygui.mixins.* { * ; }")
keep("class fr.username404.snowygui.fabric.** { * ; }")
keep("class fr.username404.snowygui.forge.** { * ; }")
keepclassmembers("class fr.username404.snowygui.** { public protected <methods>; }")
keep("class $group.snowygui.mixins.* { * ; }")
keep("class $group.snowygui.fabric.** { * ; }")
keep("class $group.snowygui.forge.** { * ; }")
keepclassmembers("class $group.snowygui.** { public protected <methods>; }")
keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions")
obfuscationdictionary("$dictionariesDir/dictionary.txt")
classobfuscationdictionary("$dictionariesDir/classdictionary.txt")
packageobfuscationdictionary("$dictionariesDir/packagesdictionary.txt")
flattenpackagehierarchy("$group.snowygui")
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
dontwarn("java.**")
@ -65,7 +67,7 @@ subprojects {
if (this@subprojects.name != "common") build.get().finalizedBy(shrinkJar)
}
extensions.configure<net.fabricmc.loom.LoomGradleExtension>("loom") {
MappingsDep = officialMojangMappings()
mappingsDep = officialMojangMappings()
silentMojangMappingsLicense()
mixinConfig("snowygui-mixins.json")
refmapName = "snowygui-common-refmap.json"
@ -77,7 +79,7 @@ subprojects {
}
"io.github.config4k:config4k:0.4.2".also { implementation(it); shadowC(it) }
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
"mappings"(MappingsDep)
"mappings"(mappingsDep)
}
}
@ -138,7 +140,8 @@ allprojects {
}
val modProperties = mapOf(
"mod_version" to (rootProject.version as String),
"minecraft_version" to mcBase
"minecraft_version" to mcBase,
"mod_group" to this@allprojects.group
)
inputs.properties(modProperties)
filesNotMatching(listOf("*.png")) {

View File

@ -18,10 +18,10 @@
"environment": "client",
"entrypoints": {
"client": [
"fr.username404.snowygui.fabric.FabricInit"
"${mod_group}.snowygui.fabric.FabricInit"
],
"modmenu": [
"fr.username404.snowygui.fabric.ModMenuConf"
"${mod_group}.snowygui.fabric.ModMenuConf"
]
},
"mixins": [