diff options
author | Paul Duffin <paulduffin@google.com> | 2021-02-25 15:34:13 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2021-03-01 12:58:28 +0000 |
commit | ec0fe1775b726f852839729ecc16adff1dcffe4d (patch) | |
tree | 94cd3fb627cf35b7ab17ce2bb2456e5e8b9b472b /java/hiddenapi_singleton_test.go | |
parent | 3785673f9be9d3e0627d03c067e1b5f14a57a14f (diff) |
Avoid hiddenapi ignoring prebuilt with missing dex implementation jar
Previously, when a prebuilt was preferred but did not provide a
suitable boot dex jar both the source and the prebuilt were silently
ignored which meant that the "hiddenapi list" command was not given a
complete set of boot dex jars. That could either lead to incorrect
hiddenapi flags being set or the "hiddenapi list" command failing if it
could not find a class. Debugging the cause of either of those cases
can be very time consuming so this change fails early and makes the
cause very explicit.
Bug: 181267622
Test: m nothing
Change-Id: I6763ddb9ba90ed2e501d0cf7984f6655237e905d
Diffstat (limited to 'java/hiddenapi_singleton_test.go')
-rw-r--r-- | java/hiddenapi_singleton_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go index c0f0e381c..fb63820a8 100644 --- a/java/hiddenapi_singleton_test.go +++ b/java/hiddenapi_singleton_test.go @@ -126,6 +126,29 @@ func TestHiddenAPIIndexSingleton(t *testing.T) { `, indexParams) } +func TestHiddenAPISingletonWithSourceAndPrebuiltPreferredButNoDex(t *testing.T) { + config := testConfigWithBootJars(` + java_library { + name: "foo", + srcs: ["a.java"], + compile_dex: true, + } + + java_import { + name: "foo", + jars: ["a.jar"], + prefer: true, + } + `, []string{"platform:foo"}, nil) + + ctx := testContextWithHiddenAPI(config) + + runWithErrors(t, ctx, config, + "hiddenapi has determined that the source module \"foo\" should be ignored as it has been"+ + " replaced by the prebuilt module \"prebuilt_foo\" but unfortunately it does not provide a"+ + " suitable boot dex jar") +} + func TestHiddenAPISingletonWithPrebuilt(t *testing.T) { ctx, _ := testHiddenAPIBootJars(t, ` java_import { |