Embed proguard/R8 rules in kotlin-reflect artifact jar
The Android build pipeline can extract embedded proguard configurations
from dependencies and merge them automatically. This adds a conservative
proguard configuration to the kotlin-reflect JVM artifact in support of
that. This focuses mostly on just retaining what's necessary for
kotlin-reflect's own functionality to operate, but could be expanded if
community feedback discovers other good candidate rules.
With this in place - most Android projects using R8 or Proguard should
Just Work™️ with kotlin-reflect.
This commit is contained in:
committed by
Alexander Udalov
parent
ae395bda09
commit
482874fdc1
@@ -0,0 +1,21 @@
|
|||||||
|
# When editing this file, update the following files as well:
|
||||||
|
# - META-INF/com.android.tools/r8-from-1.6.0/kotlin-reflect.pro
|
||||||
|
# - META-INF/com.android.tools/r8-upto-1.6.0/kotlin-reflect.pro
|
||||||
|
# - META-INF/proguard/kotlin-reflect.pro
|
||||||
|
# Keep Metadata annotations so they can be parsed at runtime.
|
||||||
|
-keep class kotlin.Metadata { *; }
|
||||||
|
|
||||||
|
# Keep implementations of service loaded interfaces
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader { public protected *; }
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition { public protected *; }
|
||||||
|
|
||||||
|
# Keep generic signatures and annotations at runtime.
|
||||||
|
-keepattributes Signature,RuntimeVisible*Annotations
|
||||||
|
|
||||||
|
# Don't note on API calls from different JVM versions as they're gated properly at runtime.
|
||||||
|
-dontnote kotlin.internal.PlatformImplementationsKt
|
||||||
|
|
||||||
|
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
|
||||||
|
-dontwarn kotlin.reflect.jvm.internal.**
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# When editing this file, update the following files as well:
|
||||||
|
# - META-INF/com.android.tools/proguard/kotlin-reflect.pro
|
||||||
|
# - META-INF/com.android.tools/r8-upto-1.6.0/kotlin-reflect.pro
|
||||||
|
# - META-INF/proguard/kotlin-reflect.pro
|
||||||
|
# Keep Metadata annotations so they can be parsed at runtime.
|
||||||
|
-keep class kotlin.Metadata { *; }
|
||||||
|
|
||||||
|
# Keep generic signatures and annotations at runtime.
|
||||||
|
# R8 requires InnerClasses and EnclosingMethod if you keepattributes Signature.
|
||||||
|
-keepattributes InnerClasses,Signature,RuntimeVisible*Annotations,EnclosingMethod
|
||||||
|
|
||||||
|
# Don't note on API calls from different JVM versions as they're gated properly at runtime.
|
||||||
|
-dontnote kotlin.internal.PlatformImplementationsKt
|
||||||
|
|
||||||
|
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
|
||||||
|
-dontwarn kotlin.reflect.jvm.internal.**
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
# When editing this file, update the following files as well:
|
||||||
|
# - META-INF/com.android.tools/proguard/kotlin-reflect.pro
|
||||||
|
# - META-INF/com.android.tools/r8-from-1.6.0/kotlin-reflect.pro
|
||||||
|
# - META-INF/proguard/kotlin-reflect.pro
|
||||||
|
# Keep Metadata annotations so they can be parsed at runtime.
|
||||||
|
-keep class kotlin.Metadata { *; }
|
||||||
|
|
||||||
|
# Keep implementations of service loaded interfaces
|
||||||
|
# R8 will automatically handle these these in 1.6+
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader { public protected *; }
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition { public protected *; }
|
||||||
|
|
||||||
|
# Keep generic signatures and annotations at runtime.
|
||||||
|
# R8 requires InnerClasses and EnclosingMethod if you keepattributes Signature.
|
||||||
|
-keepattributes InnerClasses,Signature,RuntimeVisible*Annotations,EnclosingMethod
|
||||||
|
|
||||||
|
# Don't note on API calls from different JVM versions as they're gated properly at runtime.
|
||||||
|
-dontnote kotlin.internal.PlatformImplementationsKt
|
||||||
|
|
||||||
|
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
|
||||||
|
-dontwarn kotlin.reflect.jvm.internal.**
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# When editing this file, update the following files as well:
|
||||||
|
# - META-INF/com.android.tools/proguard/kotlin-reflect.pro
|
||||||
|
# - META-INF/com.android.tools/r8-from-1.6.0/kotlin-reflect.pro
|
||||||
|
# - META-INF/com.android.tools/r8-upto-1.6.0/kotlin-reflect.pro
|
||||||
|
# Keep Metadata annotations so they can be parsed at runtime.
|
||||||
|
-keep class kotlin.Metadata { *; }
|
||||||
|
|
||||||
|
# Keep implementations of service loaded interfaces
|
||||||
|
# R8 will automatically handle these these in 1.6+
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader { public protected *; }
|
||||||
|
-keep interface kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition
|
||||||
|
-keep class * implements kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition { public protected *; }
|
||||||
|
|
||||||
|
# Keep generic signatures and annotations at runtime.
|
||||||
|
# R8 requires InnerClasses and EnclosingMethod if you keepattributes Signature.
|
||||||
|
-keepattributes InnerClasses,Signature,RuntimeVisible*Annotations,EnclosingMethod
|
||||||
|
|
||||||
|
# Don't note on API calls from different JVM versions as they're gated properly at runtime.
|
||||||
|
-dontnote kotlin.internal.PlatformImplementationsKt
|
||||||
|
|
||||||
|
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
|
||||||
|
-dontwarn kotlin.reflect.jvm.internal.**
|
||||||
@@ -11,6 +11,9 @@ sourceSets {
|
|||||||
java {
|
java {
|
||||||
srcDir "${rootDir}/core/reflection.jvm/src"
|
srcDir "${rootDir}/core/reflection.jvm/src"
|
||||||
}
|
}
|
||||||
|
resources {
|
||||||
|
srcDir("${rootDir}/core/reflection.jvm/resources")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
|
|||||||
Reference in New Issue
Block a user