Be more strict about unknown install <uses-library> paths.
Allow default install paths only for compatibility libraries. For other libraries that are explicitly specified in `uses_libs` and `optional_uses_libs` unknown install path should be an error. Bug: 132357300 Test: lunch cf_x86_phone-userdebug && m Change-Id: I2209c90a939a8aa46c42e13bb42d09c07e4d0895
This commit is contained in:
@@ -130,14 +130,20 @@ func (libPaths LibraryPaths) addLibraryPath(ctx android.PathContext, lib string,
|
||||
|
||||
// Add a new library path to the map. Ensure that the build path to the library exists.
|
||||
func (libPaths LibraryPaths) AddLibraryPath(ctx android.PathContext, lib string, hostPath, installPath android.Path) {
|
||||
if hostPath != nil {
|
||||
// Add a library only if the build path to it is known.
|
||||
if hostPath != nil && installPath != nil {
|
||||
// Add a library only if the build and install path to it is known.
|
||||
libPaths.addLibraryPath(ctx, lib, hostPath, installPath)
|
||||
} else if !ctx.Config().AllowMissingDependencies() {
|
||||
// Error on libraries with unknown build paths, unless missing dependencies are allowed.
|
||||
android.ReportPathErrorf(ctx, "unknown build path to <uses-library> '%s'", lib)
|
||||
} else if ctx.Config().AllowMissingDependencies() {
|
||||
// If missing dependencies are allowed, the build shouldn't fail when a <uses-library> is
|
||||
// not found. However, this is likely to result is disabling dexpreopt, as it won't be
|
||||
// possible to construct class loader context without on-host and on-device library paths.
|
||||
} else {
|
||||
// Not adding a library to the map will likely result in disabling dexpreopt.
|
||||
// Error on libraries with unknown paths.
|
||||
if hostPath == nil {
|
||||
android.ReportPathErrorf(ctx, "unknown build path to <uses-library> '%s'", lib)
|
||||
} else {
|
||||
android.ReportPathErrorf(ctx, "unknown install path to <uses-library> '%s'", lib)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user