diff --git a/core/main.mk b/core/main.mk index 65c256048..92f47f77f 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1106,11 +1106,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 \ @@ -1126,14 +1126,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 \ @@ -1141,11 +1137,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 \ @@ -1157,16 +1151,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 @@ -1213,12 +1236,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 @@ -1232,11 +1257,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 \ @@ -1250,8 +1277,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)