[#302] Add ProGuard consumer rules
This allows consumers of the SDK to use ProGuard without breaking the SDK
This commit is contained in:
parent
7236fd718d
commit
4994718549
|
@ -1,6 +1,11 @@
|
||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
Next version
|
||||||
|
------------------------------------
|
||||||
|
- Fix: Added ProGuard rules so that SDK clients can use R8 to shrink their apps
|
||||||
|
- Updated dependencies
|
||||||
|
|
||||||
Version 1.3.0-beta19 *(2021-11-22)*
|
Version 1.3.0-beta19 *(2021-11-22)*
|
||||||
------------------------------------
|
------------------------------------
|
||||||
- New: Updated checkpoints for Mainnet and Testnet
|
- New: Updated checkpoints for Mainnet and Testnet
|
||||||
|
|
|
@ -36,7 +36,7 @@ android {
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
getByName("release").apply {
|
getByName("release").apply {
|
||||||
isMinifyEnabled = project.property("IS_MINIFY_ENABLED").toString().toBoolean()
|
isMinifyEnabled = project.property("IS_MINIFY_APP_ENABLED").toString().toBoolean()
|
||||||
proguardFiles.addAll(
|
proguardFiles.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Allow for debuggable stacktraces
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-renamesourcefileattribute SourceFile
|
|
@ -1,21 +0,0 @@
|
||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.kts.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
|
@ -41,7 +41,10 @@ IS_COVERAGE_ENABLED=false
|
||||||
IS_USE_TEST_ORCHESTRATOR=false
|
IS_USE_TEST_ORCHESTRATOR=false
|
||||||
|
|
||||||
# Optionally configure minification
|
# Optionally configure minification
|
||||||
IS_MINIFY_ENABLED=false
|
# For now, don't minify the SDK but do minify the app. Minifying the app helps us test
|
||||||
|
# the proguard-consumer rules in the SDK.
|
||||||
|
IS_MINIFY_SDK_ENABLED=false
|
||||||
|
IS_MINIFY_APP_ENABLED=true
|
||||||
|
|
||||||
# Set keystore details to enable build signing. Typically these
|
# Set keystore details to enable build signing. Typically these
|
||||||
# are overridden via ~/.gradle/gradle.properties to allow secure injection.
|
# are overridden via ~/.gradle/gradle.properties to allow secure injection.
|
||||||
|
|
|
@ -38,6 +38,8 @@ android {
|
||||||
argument("room.schemaLocation", "$projectDir/schemas")
|
argument("room.schemaLocation", "$projectDir/schemas")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consumerProguardFiles("proguard-consumer.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -45,20 +47,14 @@ android {
|
||||||
// test builds exceed the dex limit because they pull in large test libraries
|
// test builds exceed the dex limit because they pull in large test libraries
|
||||||
multiDexEnabled = true
|
multiDexEnabled = true
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
proguardFiles.addAll(
|
|
||||||
listOf(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
File("proguard-rules.pro")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
getByName("release").apply {
|
getByName("release").apply {
|
||||||
multiDexEnabled = false
|
multiDexEnabled = false
|
||||||
isMinifyEnabled = project.property("IS_MINIFY_ENABLED").toString().toBoolean()
|
isMinifyEnabled = project.property("IS_MINIFY_SDK_ENABLED").toString().toBoolean()
|
||||||
proguardFiles.addAll(
|
proguardFiles.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
File("proguard-rules.pro")
|
File("proguard-project.txt")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
-keepclasseswithmembernames,includedescriptorclasses class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://github.com/grpc/grpc-java/blob/master/android/proguard-rules.txt
|
||||||
|
-keepclassmembers class io.grpc.okhttp.OkHttpChannelBuilder {
|
||||||
|
io.grpc.okhttp.OkHttpChannelBuilder forTarget(java.lang.String);
|
||||||
|
io.grpc.okhttp.OkHttpChannelBuilder scheduledExecutorService(java.util.concurrent.ScheduledExecutorService);
|
||||||
|
io.grpc.okhttp.OkHttpChannelBuilder sslSocketFactory(javax.net.ssl.SSLSocketFactory);
|
||||||
|
io.grpc.okhttp.OkHttpChannelBuilder transportExecutor(java.util.concurrent.Executor);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
# This improves obfuscation and moves non-public classes to their own namespace.
|
||||||
|
-repackageclasses 'cash.z.ecc.android.sdk.internal'
|
||||||
|
|
||||||
|
# This makes it easier to autocomplete methods in an IDE using this obfuscated library.
|
||||||
|
-keepparameternames
|
||||||
|
|
||||||
|
# The ProGuard manual recommends keeping these attributes for libraries.
|
||||||
|
-keepattributes EnclosingMethod,InnerClasses,Signature,Exceptions,*Annotation*
|
||||||
|
|
||||||
|
# Ensure that stacktraces are reversible.
|
||||||
|
-renamesourcefileattribute SourceFile
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# Keep the public interface of the library.
|
||||||
|
# Some of these will need to be tuned in the future, as they shouldn't ALL be considered part of the
|
||||||
|
# public API. Much of this will be improved by further repackaging of the classes.
|
||||||
|
-keep public class cash.z.ecc.android.sdk.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.block.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.db.entity.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.exception.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.ext.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.jni.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.tool.* { public protected *; }
|
||||||
|
-keep public class cash.z.ecc.android.sdk.type.* { public protected *; }
|
|
@ -1,21 +0,0 @@
|
||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.kts.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
Loading…
Reference in New Issue