Skip to content
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

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ android {
}
}
buildTypes {
debug { isMinifyEnabled = false }
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
// for local builds, used to find shrinking issues
val isMinify = project.hasProperty("minify")
Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allright :)

if (isMinify) {
debug {
// while isDebuggable is set to true no obfuscation takes place,
// the shrinking phase will still remove unused classes
isDebuggable = true
Copy link
Contributor Author

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


isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
}
namespace = "org.eclipse.kuksa.testapp"
Expand Down
9 changes: 0 additions & 9 deletions kuksa-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ android {
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
6 changes: 0 additions & 6 deletions kuksa-sdk/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
-keep,allowobfuscation,allowoptimization,allowshrinking class org.eclipse.kuksa.DataBrokerConnection { *; }
-keep,allowobfuscation,allowoptimization,allowshrinking class org.eclipse.kuksa.DataBrokerConnector { *; }
-keep,allowobfuscation,allowoptimization,allowshrinking class org.eclipse.kuksa.model.Property { *; }
-keep,allowobfuscation,allowoptimization,allowshrinking interface org.eclipse.kuksa.PropertyObserver { *; }
-keep,allowobfuscation,allowoptimization,allowshrinking class org.eclipse.kuksa.CoroutineCallback { *; }
-keep,allowobfuscation,allowoptimization,allowshrinking class org.eclipse.kuksa.TimeoutConfig { *; }
46 changes: 0 additions & 46 deletions kuksa-sdk/proguard-rules.pro

This file was deleted.

9 changes: 0 additions & 9 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ android {
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
21 changes: 0 additions & 21 deletions samples/proguard-rules.pro

This file was deleted.