From ec0fe1775b726f852839729ecc16adff1dcffe4d Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 25 Feb 2021 15:34:13 +0000 Subject: 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 --- java/java_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'java/java_test.go') diff --git a/java/java_test.go b/java/java_test.go index 8407f2462..bb51ebc3d 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -114,20 +114,26 @@ func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config pathCtx := android.PathContextForTesting(config) dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx)) + runWithErrors(t, ctx, config, pattern) + + return ctx, config +} + +func runWithErrors(t *testing.T, ctx *android.TestContext, config android.Config, pattern string) { ctx.Register() _, errs := ctx.ParseBlueprintsFiles("Android.bp") if len(errs) > 0 { android.FailIfNoMatchingErrors(t, pattern, errs) - return ctx, config + return } _, errs = ctx.PrepareBuildActions(config) if len(errs) > 0 { android.FailIfNoMatchingErrors(t, pattern, errs) - return ctx, config + return } t.Fatalf("missing expected error %q (0 errors are returned)", pattern) - return ctx, config + return } func testJavaWithFS(t *testing.T, bp string, fs map[string][]byte) (*android.TestContext, android.Config) { -- cgit v1.2.3-59-g8ed1b