Loading java/dex.go +7 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ 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. Ignore_warnings *bool // If true, runs R8 in Proguard compatibility mode (default). // Otherwise, runs R8 in full mode. Proguard_compatibility *bool Loading Loading @@ -293,7 +296,10 @@ 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) { r8Flags = append(r8Flags, "-ignorewarnings") } return r8Flags, r8Deps } Loading java/dex_test.go +30 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,36 @@ func TestR8(t *testing.T) { appR8.Args["r8Flags"], libHeader.String()) android.AssertStringDoesNotContain(t, "expected no static_lib header jar in app javac classpath", appR8.Args["r8Flags"], staticLibHeader.String()) android.AssertStringDoesContain(t, "expected -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") } func TestR8Flags(t *testing.T) { result := PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd.RunTestWithBp(t, ` android_app { name: "app", srcs: ["foo.java"], platform_apis: true, optimize: { shrink: false, optimize: false, obfuscate: false, ignore_warnings: false, }, } `) app := result.ModuleForTests("app", "android_common") appR8 := app.Rule("r8") android.AssertStringDoesContain(t, "expected -dontshrink in app r8 flags", appR8.Args["r8Flags"], "-dontshrink") android.AssertStringDoesContain(t, "expected -dontoptimize in app r8 flags", appR8.Args["r8Flags"], "-dontoptimize") android.AssertStringDoesContain(t, "expected -dontobfuscate in app r8 flags", appR8.Args["r8Flags"], "-dontobfuscate") android.AssertStringDoesNotContain(t, "expected no -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") } func TestD8(t *testing.T) { Loading Loading
java/dex.go +7 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ 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. Ignore_warnings *bool // If true, runs R8 in Proguard compatibility mode (default). // Otherwise, runs R8 in full mode. Proguard_compatibility *bool Loading Loading @@ -293,7 +296,10 @@ 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) { r8Flags = append(r8Flags, "-ignorewarnings") } return r8Flags, r8Deps } Loading
java/dex_test.go +30 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,36 @@ func TestR8(t *testing.T) { appR8.Args["r8Flags"], libHeader.String()) android.AssertStringDoesNotContain(t, "expected no static_lib header jar in app javac classpath", appR8.Args["r8Flags"], staticLibHeader.String()) android.AssertStringDoesContain(t, "expected -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") } func TestR8Flags(t *testing.T) { result := PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd.RunTestWithBp(t, ` android_app { name: "app", srcs: ["foo.java"], platform_apis: true, optimize: { shrink: false, optimize: false, obfuscate: false, ignore_warnings: false, }, } `) app := result.ModuleForTests("app", "android_common") appR8 := app.Rule("r8") android.AssertStringDoesContain(t, "expected -dontshrink in app r8 flags", appR8.Args["r8Flags"], "-dontshrink") android.AssertStringDoesContain(t, "expected -dontoptimize in app r8 flags", appR8.Args["r8Flags"], "-dontoptimize") android.AssertStringDoesContain(t, "expected -dontobfuscate in app r8 flags", appR8.Args["r8Flags"], "-dontobfuscate") android.AssertStringDoesNotContain(t, "expected no -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") } func TestD8(t *testing.T) { Loading