Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba88c3be authored by Roland Levillain's avatar Roland Levillain Committed by android-build-merger
Browse files

Merge "Implement APEX JAR (Java library) absence checks for Core Libraries."

am: 374213db

Change-Id: I690908bea6727c8f26d76105e53740a4e6488f59
parents 81e3eb85 374213db
Loading
Loading
Loading
Loading
+39 −14
Original line number Diff line number Diff line
@@ -1109,11 +1109,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 \
@@ -1129,14 +1129,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 \
@@ -1144,11 +1140,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 \
@@ -1160,16 +1154,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
@@ -1216,12 +1239,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
@@ -1235,11 +1260,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 \
@@ -1253,8 +1280,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)