Remove deapex support from java_*_import
prebuilt_apex/apex_set currently supports its deapexed contents to be
returned via a sibling java_import/java_sdk_import module. This is
necesssary for
1. dexpreopt/hiddenapi processing
2. usage as shared library
(1) is no longer necessary. this information is provided by the
top-level prebuilt apexes now
(2) is no longer possible since `exported_java_libs` has been removed in
https://r.android.com/3272110
This CL uses a hack for java_sdk_library_improt. Even though (1) is
provided by the top-level apex, there are still some places where
dexpreopt/hiddenapi processing visits the import modules. This CL uses
a bogus path to make analysis work. If this bogus path gets used, there
will be an error during ninja execution
Test: go test ./apex
Test: in internal lunch cf_x86_64_phone-next-userdebug (uses mainline
prebuilts)
Test: verified that file_list.txt is same
Bug: 368337090
Change-Id: I0ea2327f648f0fc60e337b232f7265e140772ffd
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 9f0564a..f7cd8e1 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -2823,40 +2823,14 @@
}
if ctx.Device() {
- // If this is a variant created for a prebuilt_apex then use the dex implementation jar
- // obtained from the associated deapexer module.
+ // Shared libraries deapexed from prebuilt apexes are no longer supported.
+ // Set the dexJarBuildPath to a fake path.
+ // This allows soong analysis pass, but will be an error during ninja execution if there are
+ // any rdeps.
ai, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
if ai.ForPrebuiltApex {
- // Get the path of the dex implementation jar from the `deapexer` module.
- di, err := android.FindDeapexerProviderForModule(ctx)
- if err != nil {
- // An error was found, possibly due to multiple apexes in the tree that export this library
- // Defer the error till a client tries to call DexJarBuildPath
- module.dexJarFileErr = err
- module.initHiddenAPIError(err)
- return
- }
- dexJarFileApexRootRelative := ApexRootRelativePathToJavaLib(module.BaseModuleName())
- if dexOutputPath := di.PrebuiltExportPath(dexJarFileApexRootRelative); dexOutputPath != nil {
- dexJarFile := makeDexJarPathFromPath(dexOutputPath)
- module.dexJarFile = dexJarFile
- installPath := android.PathForModuleInPartitionInstall(
- ctx, "apex", ai.ApexVariationName, dexJarFileApexRootRelative)
- module.installFile = installPath
- module.initHiddenAPI(ctx, dexJarFile, module.findScopePaths(apiScopePublic).stubsImplPath[0], nil)
-
- module.dexpreopter.installPath = module.dexpreopter.getInstallPath(ctx, android.RemoveOptionalPrebuiltPrefix(ctx.ModuleName()), installPath)
- module.dexpreopter.isSDKLibrary = true
- module.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, android.RemoveOptionalPrebuiltPrefix(ctx.ModuleName()), &module.dexpreopter)
-
- if profilePath := di.PrebuiltExportPath(dexJarFileApexRootRelative + ".prof"); profilePath != nil {
- module.dexpreopter.inputProfilePathOnHost = profilePath
- }
- } else {
- // This should never happen as a variant for a prebuilt_apex is only created if the
- // prebuilt_apex has been configured to export the java library dex file.
- ctx.ModuleErrorf("internal error: no dex implementation jar available from prebuilt APEX %s", di.ApexModuleName())
- }
+ module.dexJarFile = makeDexJarPathFromPath(android.PathForModuleInstall(ctx, "intentionally_no_longer_supported"))
+ module.initHiddenAPI(ctx, module.dexJarFile, module.findScopePaths(apiScopePublic).stubsImplPath[0], nil)
}
}