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 --- apex/bootclasspath_fragment_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apex/bootclasspath_fragment_test.go') diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index 159e9e1c4..2600169a5 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -677,7 +677,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { func getDexJarPath(result *android.TestResult, name string) string { module := result.Module(name, "android_common") - return module.(java.UsesLibraryDependency).DexJarBuildPath().Path().RelativeToTop().String() + return module.(java.UsesLibraryDependency).DexJarBuildPath(moduleErrorfTestCtx{}).Path().RelativeToTop().String() } // TestBootclasspathFragment_HiddenAPIList checks to make sure that the correct parameters are -- cgit v1.2.3-59-g8ed1b