diff options
author | 2025-01-13 22:37:06 -0800 | |
---|---|---|
committer | 2025-01-13 22:37:06 -0800 | |
commit | 9eb3f2e1779a6c925c7109636133a47cdf4b5d99 (patch) | |
tree | 7876c6b27a253c9282e5caf76036b4b5d998d71b | |
parent | 3fa68093a5e366437fcfe8feb84428a9d2a9eea1 (diff) | |
parent | 8ec5f61a0293330dc75e1a68a4a887dcd0842a5a (diff) |
Merge "Add property Optimize.Keep_runtime_invisible_annotations" into main
-rw-r--r-- | android/config.go | 4 | ||||
-rw-r--r-- | java/dex.go | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go index 87aacd5cb..407156df6 100644 --- a/android/config.go +++ b/android/config.go @@ -2175,6 +2175,10 @@ func (c *config) UseTransitiveJarsInClasspath() bool { return c.productVariables.GetBuildFlagBool("RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH") } +func (c *config) UseR8OnlyRuntimeVisibleAnnotations() bool { + return c.productVariables.GetBuildFlagBool("RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS") +} + func (c *config) UseR8StoreStoreFenceConstructorInlining() bool { return c.productVariables.GetBuildFlagBool("RELEASE_R8_STORE_STORE_FENCE_CONSTRUCTOR_INLINING") } diff --git a/java/dex.go b/java/dex.go index 7b99549d4..4a7e9dcc4 100644 --- a/java/dex.go +++ b/java/dex.go @@ -49,6 +49,16 @@ type DexProperties struct { // Whether to continue building even if warnings are emitted. Defaults to true. Ignore_warnings *bool + // Whether runtime invisible annotations should be kept by R8. Defaults to false. + // This is equivalent to: + // -keepattributes RuntimeInvisibleAnnotations, + // RuntimeInvisibleParameterAnnotations, + // RuntimeInvisibleTypeAnnotations + // This is only applicable when RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS is + // enabled and will be used to migrate away from keeping runtime invisible + // annotations (b/387958004). + Keep_runtime_invisible_annotations *bool + // If true, runs R8 in Proguard compatibility mode, otherwise runs R8 in full mode. // Defaults to false for apps and tests, true for libraries. Proguard_compatibility *bool @@ -364,6 +374,10 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams, r8Flags = append(r8Flags, "--ignore-library-extends-program") } + if BoolDefault(opt.Keep_runtime_invisible_annotations, false) { + r8Flags = append(r8Flags, "--keep-runtime-invisible-annotations") + } + if BoolDefault(opt.Proguard_compatibility, true) { r8Flags = append(r8Flags, "--force-proguard-compatibility") } |