From 1a3b145803f0698e2553c9d550073dbc9763a8bd Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Mon, 22 Mar 2021 17:24:18 +0000 Subject: [PATCH] Add PRODUCT_BROKEN_VERIFY_USES_LIBRARIES. If set to true, it disables checks for a product. It is possible to override with environment variable RELAX_USES_LIBRARY_CHECK on the command-line. Per product configuration is needed rather than per board configuration (such as BUILD_BROKEN_* variables) because of the specifics of checks: they depend on the product packages list, and not on the board config. One example of a product family that needs to disable the checks are the SDK builds (e.g. sdk_gphone_x86_64), see b/183339664. Bug: 183339664 Bug: 132357300 Test: treehugger Change-Id: Ia58559e4e70163da94e9eb7b8a6133e0cbecd459 --- core/config.mk | 11 ----------- core/dex_preopt_config.mk | 16 ++++++++++++++++ core/product.mk | 3 +++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/config.mk b/core/config.mk index 6a99a6c7f9..00b3fcf129 100644 --- a/core/config.mk +++ b/core/config.mk @@ -479,17 +479,6 @@ USE_PREBUILT_SDK_TOOLS_IN_PLACE := true USE_D8 := true .KATI_READONLY := USE_D8 -# Whether to fail immediately if verify_uses_libraries check fails, or to keep -# going and restrict dexpreopt to not compile any code for the failed module. -# -# The intended use case for this flag is to have a smoother migration path for -# the Java modules that need to add information in their build -# files. The flag allows to quickly silence build errors. This flag should be -# used with caution and only as a temporary measure, as it masks real errors -# and affects performance. -RELAX_USES_LIBRARY_CHECK ?= false -.KATI_READONLY := RELAX_USES_LIBRARY_CHECK - # # Tools that are prebuilts for TARGET_BUILD_USE_PREBUILT_SDKS # diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index dda7de01fc..36fa6296f0 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -20,6 +20,22 @@ endif # The default value for LOCAL_DEX_PREOPT DEX_PREOPT_DEFAULT ?= $(ENABLE_PREOPT) +# Whether to fail immediately if verify_uses_libraries check fails, or to keep +# going and restrict dexpreopt to not compile any code for the failed module. +# +# The intended use case for this flag is to have a smoother migration path for +# the Java modules that need to add information in their build +# files. The flag allows to quickly silence build errors. This flag should be +# used with caution and only as a temporary measure, as it masks real errors +# and affects performance. +ifndef RELAX_USES_LIBRARY_CHECK + RELAX_USES_LIBRARY_CHECK := $(if \ + $(filter true,$(PRODUCT_BROKEN_VERIFY_USES_LIBRARIES)),true,false) +else + # Let the environment variable override PRODUCT_BROKEN_VERIFY_USES_LIBRARIES. +endif +.KATI_READONLY := RELAX_USES_LIBRARY_CHECK + # The default filter for which files go into the system_other image (if it is # being used). Note that each pattern p here matches both '/

' and /system/

'. # To bundle everything one should set this to '%'. diff --git a/core/product.mk b/core/product.mk index 19e760b736..11a63e3408 100644 --- a/core/product.mk +++ b/core/product.mk @@ -236,6 +236,9 @@ _product_single_value_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_J # This is necessary to avoid jars reordering due to makefile inheritance order. _product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA +# Set to true to disable checks for a product. +_product_list_vars += PRODUCT_BROKEN_VERIFY_USES_LIBRARIES + # All of the apps that we force preopt, this overrides WITH_DEXPREOPT. _product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK _product_list_vars += PRODUCT_DEXPREOPT_SPEED_APPS