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

am: ba88c3be5c

Change-Id: I39709701f2ce1e2d4b5cf631822f29d78958bae9
This commit is contained in:
Roland Levillain 2019-10-31 14:24:33 -07:00 committed by android-build-merger
commit d5281547cc
1 changed files with 39 additions and 14 deletions

View File

@ -1106,11 +1106,11 @@ $(if $(strip $(1)), \
endef endef
# Check that libraries that should only be in APEXes don't end up in the system # 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. # art/build/apex/art_apex_test.py.
# TODO(b/128708192): Implement this restriction in Soong instead. # TODO(b/128708192): Implement this restriction in Soong instead.
# Runtime APEX libraries # ART APEX (native) libraries
APEX_MODULE_LIBS := \ APEX_MODULE_LIBS := \
libadbconnection.so \ libadbconnection.so \
libadbconnectiond.so \ libadbconnectiond.so \
@ -1126,14 +1126,10 @@ APEX_MODULE_LIBS := \
libartd-dexlayout.so \ libartd-dexlayout.so \
libartd.so \ libartd.so \
libartpalette.so \ libartpalette.so \
libc.so \
libc_malloc_debug.so \
libc_malloc_hooks.so \
libdexfile.so \ libdexfile.so \
libdexfile_external.so \ libdexfile_external.so \
libdexfiled.so \ libdexfiled.so \
libdexfiled_external.so \ libdexfiled_external.so \
libdl.so \
libdt_fd_forward.so \ libdt_fd_forward.so \
libdt_socket.so \ libdt_socket.so \
libicui18n.so \ libicui18n.so \
@ -1141,11 +1137,9 @@ APEX_MODULE_LIBS := \
libicu_jni.so \ libicu_jni.so \
libjavacore.so \ libjavacore.so \
libjdwp.so \ libjdwp.so \
libm.so \
libnativebridge.so \ libnativebridge.so \
libnativehelper.so \ libnativehelper.so \
libnativeloader.so \ libnativeloader.so \
libneuralnetworks.so \
libnpt.so \ libnpt.so \
libopenjdk.so \ libopenjdk.so \
libopenjdkjvm.so \ libopenjdkjvm.so \
@ -1157,16 +1151,45 @@ APEX_MODULE_LIBS := \
libprofiled.so \ libprofiled.so \
libsigchain.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 # Conscrypt APEX libraries
APEX_MODULE_LIBS += \ APEX_MODULE_LIBS += \
libjavacrypto.so \ 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 # An option to disable the check below, for local use since some build targets
# still may create these libraries in /system (b/129006418). # still may create these libraries in /system (b/129006418).
DISABLE_APEX_LIBS_ABSENCE_CHECK ?= 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. # 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 # 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 # are compiled for the guest architecture and used with an entirely different
@ -1213,12 +1236,14 @@ else
# APEX might be misconfigured or something is wrong in the build system. # 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 # Please reach out to the APEX package owners and/or soong-team@, or
# android-building@googlegroups.com externally. # android-building@googlegroups.com externally.
#
# Likewise, we check for the absence of APEX Java libraries (JARs).
define check-apex-libs-absence define check-apex-libs-absence
$(call maybe-print-list-and-error, \ $(call maybe-print-list-and-error, \
$(filter $(foreach lib,$(APEX_MODULE_LIBS),%/$(lib)), \ $(filter $(foreach lib,$(APEX_MODULE_LIBS),%/$(lib)), \
$(filter-out $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE), \ $(filter-out $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE), \
$(TARGET_OUT)/$(if $(findstring %,$(dir)),$(dir),$(dir)/%)), \ $(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 \ APEX libraries found in product_target_FILES (see comment for check-apex-libs-absence in \
build/make/core/main.mk for details)) build/make/core/main.mk for details))
endef endef
@ -1232,11 +1257,13 @@ else
# try "m installclean && m systemimage" to get a correct system image. For # try "m installclean && m systemimage" to get a correct system image. For
# local work you can also disable the check with the # local work you can also disable the check with the
# DISABLE_APEX_LIBS_ABSENCE_CHECK environment variable. # 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 define check-apex-libs-absence-on-disk
$(hide) ( \ $(hide) ( \
cd $(TARGET_OUT) && \ cd $(TARGET_OUT) && \
findres=$$(find lib* \ findres=$$(find . \
$(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "$(subst %,*,$(dir))" -prune -o) \ $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "./$(subst %,*,$(dir))" -prune -o) \
-type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \ -type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
-print) && \ -print) && \
if [ -n "$$findres" ]; then \ if [ -n "$$findres" ]; then \
@ -1250,8 +1277,6 @@ else
endef endef
endif endif
# TODO(b/142944799): Implement Java library absence check for Core Libraries.
ifdef FULL_BUILD ifdef FULL_BUILD
ifneq (true,$(ALLOW_MISSING_DEPENDENCIES)) ifneq (true,$(ALLOW_MISSING_DEPENDENCIES))
# Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product) # Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)