-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Disable Obfuscation #7
Conversation
Closes: eclipse-kuksa#5 Signed-Off-By: Andre Weber <andre.weber3@etas.com>
To easily locate shrinking issues (e.g. missing Proguard Consumer rules) I enabled shrinking for the TestApp when it is build with the optional parameter "minify".
I checked how other open source libraries are dealing with obfuscation. The majority simply removed the buildTypes.release branch and disabled therefore obfuscation / shrinking by simply using the default values. Some Projects simply set isMinifyEnabled to false. When checking OkHttp I saw that they still enabled minify for debug builds when they are build with an optional property. I think that this is to find shrinking issues and took this approach over. Checked Projects: `LeakCanary OkHttp EventBus => Introducion of separate parameter "minify" to test obfuscation Picasso Glide Keyframes: DBFlow https://github.com/agrosner/DBFlow/blob/master/coroutines/build.gradle.kts |
isMinifyEnabled = true | ||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") | ||
// for local builds, used to find shrinking issues | ||
val isMinify = project.hasProperty("minify") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this parameter / property to my global gradle.properties to always have shrinking enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allright :)
debug { | ||
// while isDebuggable is set to true no obfuscation takes place, | ||
// the shrinking phase will still remove unused classes | ||
isDebuggable = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically true is the default value here, it was added here basically just to make the comment more clear.
When playing around I was wondering why the classes were not obfuscated when adding this. I tested the behavior by adding an "UnusedClass" to the SDK. Since shrinking is disabled in the SDK it was not removed from the corresponding build aar. However when building the TestApp with the minify parameter it was correctly removed during shrinking when it was unused from inside the TestApp. When the TestApp was using the class, it was correctly left intact
@SebastianSchildt LGTM, can be merged |
Closes: #5