Merge "Regroup conditions related to LOCAL_ENFORCE_USES_LIBRARIES."

This commit is contained in:
Ulyana Trafimovich 2021-04-15 08:23:34 +00:00 committed by Gerrit Code Review
commit a43c4ff302

View file

@ -31,9 +31,8 @@ ifeq (false,$(LOCAL_DEX_PREOPT))
LOCAL_DEX_PREOPT := LOCAL_DEX_PREOPT :=
endif endif
# Disable <uses-library> checks and preopt for tests. # Disable preopt for tests.
ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests)) ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
LOCAL_ENFORCE_USES_LIBRARIES := false
LOCAL_DEX_PREOPT := LOCAL_DEX_PREOPT :=
endif endif
@ -52,25 +51,12 @@ ifneq (true,$(WITH_DEXPREOPT))
LOCAL_DEX_PREOPT := LOCAL_DEX_PREOPT :=
endif endif
# Disable <uses-library> checks 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).
ifneq (true,$(WITH_DEXPREOPT))
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
ifdef LOCAL_UNINSTALLABLE_MODULE ifdef LOCAL_UNINSTALLABLE_MODULE
LOCAL_DEX_PREOPT := LOCAL_DEX_PREOPT :=
endif endif
# Disable <uses-library> checks and preopt if the app contains no java code. # Disable preopt if the app contains no java code.
ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR)))
LOCAL_ENFORCE_USES_LIBRARIES := false
LOCAL_DEX_PREOPT := LOCAL_DEX_PREOPT :=
endif endif
@ -219,6 +205,27 @@ ifndef my_manifest_or_apk
endif endif
endif endif
# Disable the check for tests.
ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
# Disable the check if the app contains no java code.
ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR)))
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
# Disable <uses-library> checks 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).
ifneq (true,$(WITH_DEXPREOPT))
LOCAL_ENFORCE_USES_LIBRARIES := false
else ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
# Verify LOCAL_USES_LIBRARIES/LOCAL_OPTIONAL_USES_LIBRARIES # Verify LOCAL_USES_LIBRARIES/LOCAL_OPTIONAL_USES_LIBRARIES
# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or # If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
# LOCAL_OPTIONAL_USES_LIBRARIES are specified. # LOCAL_OPTIONAL_USES_LIBRARIES are specified.