Skip to content

Commit

Permalink
Add proguard configuration for IMA/GMA plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Bird authored and IanDBird committed Jun 6, 2023
1 parent 60f66e3 commit 13abe30
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 7 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ A framework for integrating [UID2](https://github.com/IABTechLab/uid2docs) into

The UID2 SDK is a standalone headless library defined and published via Maven Central. As such the `dev-app` is the primary way for developing the SDK. Use Android Studio to open the root folder to begin development.

R8 / ProGuard
-------------
If you are using R8 the shrinking and obfuscation rules are included automatically.

ProGuard users must manually add the options from
[uid2-gma.pro](https://github.com/IABTechLab/uid2-android-sdk/blob/main/securesignals-gma/uid2-gma.pro) and [uid2-ima.pro](https://github.com/IABTechLab/uid2-android-sdk/blob/main/securesignals-ima/uid2-ima.pro).

## License

UID2 is released under the Apache license. [See LICENSE](https://github.com/IABTechLab/uid2-android-sdk/blob/main/LICENSE.md) for details.
6 changes: 2 additions & 4 deletions sdk/src/test/java/com/uid2/network/RefreshResponseTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class RefreshResponseTest {
JSONObject(),
JSONObject(mapOf("key" to "value"))
).forEach {
val refresh = RefreshResponse.fromJson(it)
assertNull(refresh)
assertNull(RefreshResponse.fromJson(it))
}

// If we take a valid response but remove the "status" parameter, check that it's handled correctly.
Expand All @@ -45,8 +44,7 @@ class RefreshResponseTest {

body.remove(it)

val refresh = RefreshResponse.fromJson(success)
assertNull(refresh)
assertNull(RefreshResponse.fromJson(success))
}
}

Expand Down
5 changes: 3 additions & 2 deletions securesignals-gma-dev-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
apply from: rootProject.file("$rootDir/common.gradle")

android {
namespace 'com.uid2.devapp'
namespace 'com.uid2.dev'

defaultConfig {
applicationId "com.uid2.securesignals.gma.devapp"
Expand All @@ -17,7 +17,8 @@ android {

buildTypes {
release {
minifyEnabled false
shrinkResources true
minifyEnabled true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.uid2.UID2Manager;
import com.uid2.data.UID2Identity;
import com.uid2.devapp.R;

import org.json.JSONObject;

Expand Down
1 change: 1 addition & 0 deletions securesignals-gma/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ android {

buildTypes {
release {
consumerProguardFiles 'uid2-gma.pro'
minifyEnabled false
}
}
Expand Down
3 changes: 3 additions & 0 deletions securesignals-gma/uid2-gma.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Google's GMA uses reflection to identify available adapters. These are therefore not referenced by the consuming
# application and thus, require a rule to ensure that they are not stripped out during the build.
-keep public class com.uid2.securesignals.gma.*
1 change: 1 addition & 0 deletions securesignals-ima/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ android {

buildTypes {
release {
consumerProguardFiles 'uid2-ima.pro'
minifyEnabled false
}
}
Expand Down
3 changes: 3 additions & 0 deletions securesignals-ima/uid2-ima.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Google's IMA uses reflection to identify available adapters. These are therefore not referenced by the consuming
# application and thus, require a rule to ensure that they are not stripped out during the build.
-keep public class com.uid2.securesignals.ima.*

0 comments on commit 13abe30

Please sign in to comment.