Merge "Implement APEX JAR (Java library) absence checks for Core Libraries." am: 374213db0d am: ba88c3be5c

am: d5281547cc

Change-Id: I785a8e65bf96ef2933c06bcf0a56689f58b1eda0
This commit is contained in:
Roland Levillain 2019-10-31 15:02:21 -07:00 committed by android-build-merger
commit a9000395a4

View file

@ -1108,11 +1108,11 @@ $(if $(strip $(1)), \
endef
# Check that libraries that should only be in APEXes don't end up in the system
# image. For the Runtime APEX this complements the checks in
# image. For the ART APEX this complements the checks in
# art/build/apex/art_apex_test.py.
# TODO(b/128708192): Implement this restriction in Soong instead.
# Runtime APEX libraries
# ART APEX (native) libraries
APEX_MODULE_LIBS := \
libadbconnection.so \
libadbconnectiond.so \
@ -1128,14 +1128,10 @@ APEX_MODULE_LIBS := \
libartd-dexlayout.so \
libartd.so \
libartpalette.so \
libc.so \
libc_malloc_debug.so \
libc_malloc_hooks.so \
libdexfile.so \
libdexfile_external.so \
libdexfiled.so \
libdexfiled_external.so \
libdl.so \
libdt_fd_forward.so \
libdt_socket.so \
libicui18n.so \
@ -1143,11 +1139,9 @@ APEX_MODULE_LIBS := \
libicu_jni.so \
libjavacore.so \
libjdwp.so \
libm.so \
libnativebridge.so \
libnativehelper.so \
libnativeloader.so \
libneuralnetworks.so \
libnpt.so \
libopenjdk.so \
libopenjdkjvm.so \
@ -1159,16 +1153,45 @@ APEX_MODULE_LIBS := \
libprofiled.so \
libsigchain.so \
# Runtime (Bionic) APEX (native) libraries
APEX_MODULE_LIBS += \
libc.so \
libc_malloc_debug.so \
libc_malloc_hooks.so \
libdl.so \
libm.so \
# Conscrypt APEX libraries
APEX_MODULE_LIBS += \
libjavacrypto.so \
# Android Neural Network API (NNAPI) APEX (native) libraries
APEX_MODULE_LIBS += \
libneuralnetworks.so \
# ART APEX JARs (Java libraries)
APEX_MODULE_LIBS += \
apache-xml.jar \
bouncycastle.jar \
core-icu4j.jar \
core-libart.jar \
core-oj.jar \
okhttp.jar \
# Conscrypt APEX JARs (Java libraries)
APEX_MODULE_LIBS += \
conscrypt.jar \
# An option to disable the check below, for local use since some build targets
# still may create these libraries in /system (b/129006418).
DISABLE_APEX_LIBS_ABSENCE_CHECK ?=
# Allow APEX libraries under /system/apex, which happens when APEX flattening
# is enabled.
APEX_LIBS_ABSENCE_CHECK_EXCLUDE := apex
# Bionic should not be in /system, except for the bootstrap instance.
APEX_LIBS_ABSENCE_CHECK_EXCLUDE := lib/bootstrap lib64/bootstrap
APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/bootstrap lib64/bootstrap
# Exclude lib/arm and lib64/arm64 which contain the native bridge proxy libs. They
# are compiled for the guest architecture and used with an entirely different
@ -1215,12 +1238,14 @@ else
# APEX might be misconfigured or something is wrong in the build system.
# Please reach out to the APEX package owners and/or soong-team@, or
# android-building@googlegroups.com externally.
#
# Likewise, we check for the absence of APEX Java libraries (JARs).
define check-apex-libs-absence
$(call maybe-print-list-and-error, \
$(filter $(foreach lib,$(APEX_MODULE_LIBS),%/$(lib)), \
$(filter-out $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE), \
$(TARGET_OUT)/$(if $(findstring %,$(dir)),$(dir),$(dir)/%)), \
$(filter $(TARGET_OUT)/lib/% $(TARGET_OUT)/lib64/%,$(1)))), \
$(filter $(TARGET_OUT),$(1)))), \
APEX libraries found in product_target_FILES (see comment for check-apex-libs-absence in \
build/make/core/main.mk for details))
endef
@ -1234,11 +1259,13 @@ else
# try "m installclean && m systemimage" to get a correct system image. For
# local work you can also disable the check with the
# DISABLE_APEX_LIBS_ABSENCE_CHECK environment variable.
#
# Likewise, we check for the absence of APEX Java libraries (JARs).
define check-apex-libs-absence-on-disk
$(hide) ( \
cd $(TARGET_OUT) && \
findres=$$(find lib* \
$(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "$(subst %,*,$(dir))" -prune -o) \
findres=$$(find . \
$(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "./$(subst %,*,$(dir))" -prune -o) \
-type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
-print) && \
if [ -n "$$findres" ]; then \
@ -1252,8 +1279,6 @@ else
endef
endif
# TODO(b/142944799): Implement Java library absence check for Core Libraries.
ifdef FULL_BUILD
ifneq (true,$(ALLOW_MISSING_DEPENDENCIES))
# Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)