Don't expect all Java modules to have a manifest.

Some libraries that go through manifest_check do not have a manifest or
APK, so there is nothing to check LOCAL_USES_LIBRARIES and
LOCAL_OPTIONAL_USES_LIBRARIES against. Handle it as if the manifest had
zero <uses-library> tags: don't fail the build unless the module has
non-empty LOCAL_USES_LIBRARIES or LOCAL_OPTIONAL_USES_LIBRARIES.

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m
Change-Id: I4b1317cfbd93cb6129caba51b56081307a564442
This commit is contained in:
Ulya Trafimovich 2021-04-08 11:47:00 +01:00
parent d58ae982cf
commit 6ef5779c98
3 changed files with 14 additions and 3 deletions

View File

@ -169,12 +169,13 @@ LOCAL_DEX_PREOPT := false
endif endif
my_dex_jar := $(my_prebuilt_src_file) my_dex_jar := $(my_prebuilt_src_file)
my_manifest_or_apk := $(my_prebuilt_src_file)
dex_preopt_profile_src_file := $(my_prebuilt_src_file) dex_preopt_profile_src_file := $(my_prebuilt_src_file)
####################################### #######################################
# defines built_odex along with rule to install odex # defines built_odex along with rule to install odex
my_manifest_or_apk := $(my_prebuilt_src_file)
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
my_manifest_or_apk :=
####################################### #######################################
ifneq ($(LOCAL_REPLACE_PREBUILT_APK_INSTALLED),) ifneq ($(LOCAL_REPLACE_PREBUILT_APK_INSTALLED),)
# There is a replacement for the prebuilt .apk we can install without any processing. # There is a replacement for the prebuilt .apk we can install without any processing.

View File

@ -208,6 +208,17 @@ add_json_class_loader_context = \
# Verify <uses-library> coherence between the build system and the manifest. # Verify <uses-library> coherence between the build system and the manifest.
################################################################################ ################################################################################
# Some libraries do not have a manifest, so there is nothing to check against.
# Handle it as if the manifest had zero <uses-library> tags: it is ok unless the
# module has non-empty LOCAL_USES_LIBRARIES or LOCAL_OPTIONAL_USES_LIBRARIES.
ifndef my_manifest_or_apk
ifneq (,$(strip $(LOCAL_USES_LIBRARIES)$(LOCAL_OPTIONAL_USES_LIBRARIES)))
$(error $(LOCAL_MODULE) has non-empty <uses-library> list but no manifest)
else
LOCAL_ENFORCE_USES_LIBRARIES := false
endif
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.
@ -360,7 +371,7 @@ ifdef LOCAL_DEX_PREOPT
$(call add_json_str, ProfileClassListing, $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE))) $(call add_json_str, ProfileClassListing, $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)))
$(call add_json_bool, ProfileIsTextListing, $(my_profile_is_text_listing)) $(call add_json_bool, ProfileIsTextListing, $(my_profile_is_text_listing))
$(call add_json_str, EnforceUsesLibrariesStatusFile, $(my_enforced_uses_libraries)) $(call add_json_str, EnforceUsesLibrariesStatusFile, $(my_enforced_uses_libraries))
$(call add_json_bool, EnforceUsesLibraries, $(LOCAL_ENFORCE_USES_LIBRARIES)) $(call add_json_bool, EnforceUsesLibraries, $(filter true,$(LOCAL_ENFORCE_USES_LIBRARIES)))
$(call add_json_str, ProvidesUsesLibrary, $(firstword $(LOCAL_PROVIDES_USES_LIBRARY) $(LOCAL_MODULE))) $(call add_json_str, ProvidesUsesLibrary, $(firstword $(LOCAL_PROVIDES_USES_LIBRARY) $(LOCAL_MODULE)))
$(call add_json_map, ClassLoaderContexts) $(call add_json_map, ClassLoaderContexts)
$(call add_json_class_loader_context, any, $(my_dexpreopt_libs)) $(call add_json_class_loader_context, any, $(my_dexpreopt_libs))

View File

@ -33,7 +33,6 @@ endif
ifeq ($(prebuilt_module_is_dex_javalib),true) ifeq ($(prebuilt_module_is_dex_javalib),true)
my_dex_jar := $(my_prebuilt_src_file) my_dex_jar := $(my_prebuilt_src_file)
my_manifest_or_apk := $(my_prebuilt_src_file)
# This is a target shared library, i.e. a jar with classes.dex. # This is a target shared library, i.e. a jar with classes.dex.
$(foreach pair,$(PRODUCT_BOOT_JARS), \ $(foreach pair,$(PRODUCT_BOOT_JARS), \