From 6e55ef157c4576f41ebc3b7d60ba826503b096ae Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Thu, 4 Mar 2021 12:37:50 +0000 Subject: [PATCH] Disable verify_uses_libraries check if dexpreopt is globally disabled. Without dexpreopt the check is not necessary, and although it is good to have, it is difficult to maintain on non-linux build platforms where dexpreopt is generally disabled (the check may fail due to various unrelated reasons, such as a failure to get manifest from an APK). Bug: 181570790 Bug: 132357300 Test: m nothing Change-Id: Ie012690e8f047ae9256e26565d162c19af4e8921 --- java/app.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/java/app.go b/java/app.go index 2d918e942..0660aa62e 100755 --- a/java/app.go +++ b/java/app.go @@ -1280,6 +1280,14 @@ func (u *usesLibrary) verifyUsesLibrariesManifest(ctx android.ModuleContext, man outputFile := android.PathForModuleOut(ctx, "manifest_check", "AndroidManifest.xml") statusFile := dexpreopt.UsesLibrariesStatusFile(ctx) + // Disable verify_uses_libraries check if dexpreopt is globally disabled. Without dexpreopt the + // check is not necessary, and although it is good to have, it is difficult to maintain on + // non-linux build platforms where dexpreopt is generally disabled (the check may fail due to + // various unrelated reasons, such as a failure to get manifest from an APK). + if dexpreopt.GetGlobalConfig(ctx).DisablePreopt { + return manifest + } + rule := android.NewRuleBuilder(pctx, ctx) cmd := rule.Command().BuiltTool("manifest_check"). Flag("--enforce-uses-libraries"). @@ -1310,6 +1318,14 @@ func (u *usesLibrary) verifyUsesLibrariesAPK(ctx android.ModuleContext, apk andr outputFile := android.PathForModuleOut(ctx, "verify_uses_libraries", apk.Base()) statusFile := dexpreopt.UsesLibrariesStatusFile(ctx) + // Disable verify_uses_libraries check if dexpreopt is globally disabled. Without dexpreopt the + // check is not necessary, and although it is good to have, it is difficult to maintain on + // non-linux build platforms where dexpreopt is generally disabled (the check may fail due to + // various unrelated reasons, such as a failure to get manifest from an APK). + if dexpreopt.GetGlobalConfig(ctx).DisablePreopt { + return apk + } + rule := android.NewRuleBuilder(pctx, ctx) aapt := ctx.Config().HostToolPath(ctx, "aapt") rule.Command().