Merge "Disable dexpreopt if optional_uses_libs does not have an impl" into main
This commit is contained in:
15
java/app.go
15
java/app.go
@@ -778,6 +778,9 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
a.onDeviceDir = android.InstallPathToOnDevicePath(ctx, a.installDir)
|
||||
|
||||
a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
|
||||
if a.usesLibrary.shouldDisableDexpreopt {
|
||||
a.dexpreopter.disableDexpreopt()
|
||||
}
|
||||
|
||||
var noticeAssetPath android.WritablePath
|
||||
if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
|
||||
@@ -1566,6 +1569,9 @@ type usesLibrary struct {
|
||||
|
||||
// Whether to enforce verify_uses_library check.
|
||||
enforce bool
|
||||
|
||||
// Whether dexpreopt should be disabled
|
||||
shouldDisableDexpreopt bool
|
||||
}
|
||||
|
||||
func (u *usesLibrary) addLib(lib string, optional bool) {
|
||||
@@ -1647,6 +1653,15 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext
|
||||
}
|
||||
}
|
||||
|
||||
// Skip java_sdk_library dependencies that provide stubs, but not an implementation.
|
||||
// This will be restricted to optional_uses_libs
|
||||
if sdklib, ok := m.(SdkLibraryDependency); ok {
|
||||
if tag == usesLibOptTag && sdklib.DexJarBuildPath(ctx).PathOrNil() == nil {
|
||||
u.shouldDisableDexpreopt = true
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if lib, ok := m.(UsesLibraryDependency); ok {
|
||||
libName := dep
|
||||
if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil {
|
||||
|
Reference in New Issue
Block a user