From 59a4a2b8d210e74e6625794f954bd11bb6157002 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 9 Jan 2024 21:35:56 +0000 Subject: Replace panic with ModuleErrorf This is a followup cleanup for aosp/2876754 and replaces panic with ctx.ModuleErrorf. The latter creates a more expressive build error. Implementation details - export moduleErrorf interface from build/soong/android. This minimal interface will be used as a parameter for `DexJarBuildPath` - Add ModuleErrorf to the function signature of DexJarBuildPath. This parameter only gets used for Import and SdkLibraryImport structs. These two can have duplicate deapexer definitions, and ModuleErrorf will be used to report that error - Create a minimal implementation of `ModuleErrorf` in tests of java and apex Test: m nothing --no-skip-soong-tests Change-Id: I0febec651f40c3f04deb957e64133c94b80fbd78 --- java/hiddenapi_singleton_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'java/hiddenapi_singleton_test.go') diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go index ef792f970..37afe297c 100644 --- a/java/hiddenapi_singleton_test.go +++ b/java/hiddenapi_singleton_test.go @@ -309,7 +309,8 @@ func TestHiddenAPIEncoding_JavaSdkLibrary(t *testing.T) { android.AssertStringEquals(t, "encode embedded java_library", unencodedDexJar, actualUnencodedDexJar.String()) // Make sure that the encoded dex jar is the exported one. - exportedDexJar := moduleForTests.Module().(UsesLibraryDependency).DexJarBuildPath().Path() + errCtx := moduleErrorfTestCtx{} + exportedDexJar := moduleForTests.Module().(UsesLibraryDependency).DexJarBuildPath(errCtx).Path() android.AssertPathRelativeToTopEquals(t, "encode embedded java_library", encodedDexJar, exportedDexJar) } -- cgit v1.2.3-59-g8ed1b