From 8be1e6db1640d51ca4478fec2c4f20d71b115734 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Wed, 15 Sep 2021 03:34:04 +0100 Subject: Propagate the dex jar path as an OptionalPath which is either valid or invalid with a message. This will allow propagating any error from the deapexer module for prebuilt APEXes to the location where the dex jars get used. It's only at those points that we can raise errors about not being able to extract files from the deapexer modules if they are invalid, and this way we avoid encoding knowledge there about why they may be invalid. To keep the refactoring limited it intentionally does not change any of the existing logic for when dexJarFiles are set or not (non-nil vs nil prior to this change), although there may be opportunity to use this for more conditions when dex jars aren't available. The refactoring is also not extended to dexpreopt.ClassLoaderContextMap. Test: m nothing Bug: 192006406 Change-Id: I68986dccd9a9b3fee4d24caa1947ea17a36caedc --- java/hiddenapi.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'java/hiddenapi.go') diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 30683daa0..7c8be1e6e 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -30,14 +30,14 @@ type hiddenAPI struct { // that information encoded within it. active bool - // The path to the dex jar that is in the boot class path. If this is nil then the associated + // The path to the dex jar that is in the boot class path. If this is unset then the associated // module is not a boot jar, but could be one of the -hiddenapi modules that provide additional // annotations for the boot dex jar but which do not actually provide a boot dex jar // themselves. // // This must be the path to the unencoded dex jar as the encoded dex jar indirectly depends on // this file so using the encoded dex jar here would result in a cycle in the ninja rules. - bootDexJarPath android.Path + bootDexJarPath OptionalDexJarPath // The paths to the classes jars that contain classes and class members annotated with // the UnsupportedAppUsage annotation that need to be extracted as part of the hidden API @@ -49,7 +49,7 @@ type hiddenAPI struct { uncompressDexState *bool } -func (h *hiddenAPI) bootDexJar() android.Path { +func (h *hiddenAPI) bootDexJar() OptionalDexJarPath { return h.bootDexJarPath } @@ -68,7 +68,7 @@ type hiddenAPIModule interface { } type hiddenAPIIntf interface { - bootDexJar() android.Path + bootDexJar() OptionalDexJarPath classesJars() android.Paths uncompressDex() *bool } @@ -79,7 +79,7 @@ var _ hiddenAPIIntf = (*hiddenAPI)(nil) // // uncompressedDexState should be nil when the module is a prebuilt and so does not require hidden // API encoding. -func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar, classesJar android.Path, uncompressedDexState *bool) { +func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar OptionalDexJarPath, classesJar android.Path, uncompressedDexState *bool) { // Save the classes jars even if this is not active as they may be used by modular hidden API // processing. -- cgit v1.2.3-59-g8ed1b