Unify addition of class loader subcontext from dependencies.
Previously CLC construction was scattered across different module types and dependency tags. This CL moves all logic to one function, which handles all special cases. This will allow to simplify CLC API and reduce the number of different ways in which CLC is constructed. Previously some of the cases failed early (at the time when a library is added to CLC) if the build/install paths were unknown. Other cases did not fail early, but were validated later before CLC was used. Late failures are necessary because some of the libraries with unknown paths still have to be processed by manifest_fixer (which doesn't need library paths), but they do not use dexpreopt (which needs library paths). This CL removes the early failures (all paths are still validated later). The CLC tests do not fail because they use a private method that toggles the "strict" flag (that enforces early/late failure mode) manually in the method call. The CL also makes a functional change in the way CLC is constructed for component libraries that have an OptionalImplicitSdkLibrary(), or libraries that are disguised as SDK libraries via `provides_uses_lib`. Previously such a component/disguised library X was added to its own CLC as a sibling element of X's own <uses-library> dependencies, which created incorrect CLC structure. Now this is handled by addCLCFromDep, when X is processed as dependency and added as a top-level CLC element with its sub-CLC properly nested under it. Bug: 132357300 Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: I6a512209b87b81d785875f10f76b21c81b2ed579
This commit is contained in:
@@ -335,11 +335,14 @@ func (clcMap ClassLoaderContextMap) MaybeAddContext(ctx android.ModuleInstallPat
|
||||
}
|
||||
}
|
||||
|
||||
// Add class loader context for the given SDK version. Fail on unknown build/install paths.
|
||||
// Add class loader context for the given SDK version. Don't fail on unknown build/install paths, as
|
||||
// libraries with unknown paths still need to be processed by manifest_fixer (which doesn't care
|
||||
// about paths). For the subset of libraries that are used in dexpreopt, their build/install paths
|
||||
// are validated later before CLC is used (in validateClassLoaderContext).
|
||||
func (clcMap ClassLoaderContextMap) AddContextForSdk(ctx android.ModuleInstallPathContext, sdkVer int,
|
||||
lib string, hostPath, installPath android.Path, nestedClcMap ClassLoaderContextMap) {
|
||||
|
||||
clcMap.addContextOrReportError(ctx, sdkVer, lib, hostPath, installPath, true, nestedClcMap)
|
||||
clcMap.addContextOrReportError(ctx, sdkVer, lib, hostPath, installPath, false, nestedClcMap)
|
||||
}
|
||||
|
||||
// Merge the other class loader context map into this one, do not override existing entries.
|
||||
|
Reference in New Issue
Block a user