diff options
author | 2022-09-20 15:32:14 -0700 | |
---|---|---|
committer | 2022-09-21 11:01:32 -0700 | |
commit | 40d731a4c3757ad478bd1a1356b87978f4570016 (patch) | |
tree | 56c765dba18f7b742172bb49d8417a351beead40 /java/dex_test.go | |
parent | 9f6e6238ef3c6fa975a60f7b115b6b266c71461c (diff) |
Provide platform build flag to R8/D8
Provide the `--android-platform-build` flag to R8/D8 for targets that do
not specify a stable min SDK. This includes all targets that do not
specificy an SDK version (e.g., services.jar, SystemUI.apk) and all
targets that specify core_platform (e.g., framework.jar).
Follow-up work will expand the set of cases that qualify for this flag,
but for now this captures some of the highest priority targets.
Bug: 232073181
Test: m + presubmit + validate verbose.log
Change-Id: Idad32c80490a101c049b7f937807a615564ca8ef
Diffstat (limited to 'java/dex_test.go')
-rw-r--r-- | java/dex_test.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/java/dex_test.go b/java/dex_test.go index a3e2deda4..66178732a 100644 --- a/java/dex_test.go +++ b/java/dex_test.go @@ -30,6 +30,19 @@ func TestR8(t *testing.T) { platform_apis: true, } + android_app { + name: "stable_app", + srcs: ["foo.java"], + sdk_version: "current", + min_sdk_version: "31", + } + + android_app { + name: "core_platform_app", + srcs: ["foo.java"], + sdk_version: "core_platform", + } + java_library { name: "lib", srcs: ["foo.java"], @@ -42,11 +55,15 @@ func TestR8(t *testing.T) { `) app := result.ModuleForTests("app", "android_common") + stableApp := result.ModuleForTests("stable_app", "android_common") + corePlatformApp := result.ModuleForTests("core_platform_app", "android_common") lib := result.ModuleForTests("lib", "android_common") staticLib := result.ModuleForTests("static_lib", "android_common") appJavac := app.Rule("javac") appR8 := app.Rule("r8") + stableAppR8 := stableApp.Rule("r8") + corePlatformAppR8 := corePlatformApp.Rule("r8") libHeader := lib.Output("turbine-combined/lib.jar").Output staticLibHeader := staticLib.Output("turbine-combined/static_lib.jar").Output @@ -61,6 +78,12 @@ func TestR8(t *testing.T) { appR8.Args["r8Flags"], staticLibHeader.String()) android.AssertStringDoesContain(t, "expected -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") + android.AssertStringDoesContain(t, "expected --android-platform-build in app r8 flags", + appR8.Args["r8Flags"], "--android-platform-build") + android.AssertStringDoesNotContain(t, "expected no --android-platform-build in stable_app r8 flags", + stableAppR8.Args["r8Flags"], "--android-platform-build") + android.AssertStringDoesContain(t, "expected --android-platform-build in core_platform_app r8 flags", + corePlatformAppR8.Args["r8Flags"], "--android-platform-build") } func TestR8Flags(t *testing.T) { @@ -88,7 +111,8 @@ func TestR8Flags(t *testing.T) { appR8.Args["r8Flags"], "-dontobfuscate") android.AssertStringDoesNotContain(t, "expected no -ignorewarnings in app r8 flags", appR8.Args["r8Flags"], "-ignorewarnings") - + android.AssertStringDoesContain(t, "expected --android-platform-build in app r8 flags", + appR8.Args["r8Flags"], "--android-platform-build") } func TestD8(t *testing.T) { |