diff options
author | 2024-01-09 21:35:56 +0000 | |
---|---|---|
committer | 2024-01-09 22:53:52 +0000 | |
commit | 59a4a2b8d210e74e6625794f954bd11bb6157002 (patch) | |
tree | 591506fc8acb4eba691f53fc16d9ac175ecc64ce /apex/apex.go | |
parent | 208444ce5d9bd9ca013dc81438ef62d6ac4a461f (diff) |
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
Diffstat (limited to 'apex/apex.go')
-rw-r--r-- | apex/apex.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apex/apex.go b/apex/apex.go index 42a7d73e7..4dd77281e 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1628,7 +1628,7 @@ func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.Platform type javaModule interface { android.Module BaseModuleName() string - DexJarBuildPath() java.OptionalDexJarPath + DexJarBuildPath(ctx android.ModuleErrorfContext) java.OptionalDexJarPath JacocoReportClassesFile() android.Path LintDepSets() java.LintDepSets Stem() string @@ -1642,7 +1642,7 @@ var _ javaModule = (*java.SdkLibraryImport)(nil) // apexFileForJavaModule creates an apexFile for a java module's dex implementation jar. func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile { - return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath().PathOrNil()) + return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath(ctx).PathOrNil()) } // apexFileForJavaModuleWithFile creates an apexFile for a java module with the supplied file. |