summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jared Duke <jdduke@google.com> 2022-12-02 12:36:57 -0800
committer Jared Duke <jdduke@google.com> 2023-02-07 15:37:53 -0800
commit5c2a1f3bda94df38e3f13e20bdbf080c0472ed2a (patch)
tree1e31bf797bda4bfceb49817040eda790cf785d40
parent8e0ae8e9607375b2ae64582c10a66d7b70a6d9b7 (diff)
Don't ignore R8 warnings for optimized targets
Ideally we'd stop ignoring warnings entirely, but this helps de-risk optimized targets that may be more sensitive to side effects from suppressing such warnings. Test: m Bug: 215530220 Change-Id: Iccd124a347d55cd8f9474ebca7e41eca27882066
-rw-r--r--java/dex.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/java/dex.go b/java/dex.go
index b6fe10982..6b7a7f05b 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -43,7 +43,8 @@ type DexProperties struct {
// True if the module containing this has it set by default.
EnabledByDefault bool `blueprint:"mutated"`
- // Whether to continue building even if warnings are emitted. Defaults to true.
+ // Whether to continue building even if warnings are emitted. Defaults to true unless bytecode
+ // optimizations are enabled, in which case warnings are not ignored for safety.
Ignore_warnings *bool
// If true, runs R8 in Proguard compatibility mode (default).
@@ -339,8 +340,9 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Fl
}
// TODO(b/180878971): missing classes should be added to the relevant builds.
- // TODO(b/229727645): do not use true as default for Android platform builds.
- if proptools.BoolDefault(opt.Ignore_warnings, true) {
+ // TODO(b/229727645): do not use true as default for unoptimized platform targets.
+ ignoreWarningsDefault := !Bool(opt.Optimize)
+ if proptools.BoolDefault(opt.Ignore_warnings, ignoreWarningsDefault) {
r8Flags = append(r8Flags, "-ignorewarnings")
}