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

Commit 51512c55 authored by Vic Yang's avatar Vic Yang
Browse files

Add support for no-vendor-variant VNDK

When TARGET_VNDK_USE_CORE_VARIANT is set to true, the vendor variant of
VNDK libraries are by default not installed.  Instead, the core variant
will be used by vendor binaries at runtime.

To ensure the core variant of VNDK libraries are installed, we also add
a flag LOCAL_VNDK_DEPEND_ON_CORE_VARIANT to indicate that the vendor
variant module depends on the core variant module.  This flag should be
set by Soong for all VNDK libraries without the vendor variant
installed.  When the flag is set, the vendor variant binary is also
compared against the core variant binary to ensure they are
functionally identical.

As we are merging the two variants for some libraries, we need a new
link type to denote a module is usable as both native:vndk and
native:platform.  We add native:platform_vndk for this.

Bug: 119423884
Test: With the corresponding Soong change, build with
      TARGET_VNDK_USE_CORE_VARIANT set to true.
Test: Add a dummy VNDK library and a dummy vendor binary that depends
      on it.  Build with no-vendor-variant VNDK and check the core
      variant is installed.
Test: Add conditional compilation based on __ANDROID_VNDK__ in the
      dummy VNDK library and check build fails.

Change-Id: I40000f2728e8193212113c1ee950e9d697f2d40d
parent 1b83413b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1214,17 +1214,17 @@ else ifdef LOCAL_USE_VNDK
        # with vendor_available: false
        my_link_type := native:vendor
        my_warn_types :=
        my_allowed_types := native:vendor native:vndk
        my_allowed_types := native:vendor native:vndk native:platform_vndk
    endif
else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(call get_non_asan_path,$(LOCAL_MODULE_PATH))),)
my_link_type := native:recovery
my_warn_types :=
# TODO(b/113303515) remove native:platform and my_allowed_ndk_types
my_allowed_types := native:recovery native:platform $(my_allowed_ndk_types)
my_allowed_types := native:recovery native:platform native:platform_vndk $(my_allowed_ndk_types)
else
my_link_type := native:platform
my_warn_types := $(my_warn_ndk_types)
my_allowed_types := $(my_allowed_ndk_types) native:platform
my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk
endif

my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
+1 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ LOCAL_USE_VNDK:=
LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=
LOCAL_VINTF_FRAGMENTS:=
LOCAL_VNDK_DEPEND_ON_CORE_VARIANT:=
LOCAL_VTSC_FLAGS:=
LOCAL_VTS_INCLUDES:=
LOCAL_VTS_MODE:=
+16 −0
Original line number Diff line number Diff line
@@ -3398,3 +3398,19 @@ $(KATI_obsolete_var \
  initialize-package-file \
  add-jni-shared-libs-to-package,\
  These functions have been removed)

###########################################################
## Verify the variants of a VNDK library are identical
##
## $(1): Path to the core variant shared library file.
## $(2): Path to the vendor variant shared library file.
## $(3): TOOLS_PREFIX
###########################################################
LIBRARY_IDENTITY_CHECK_SCRIPT := build/make/tools/check_identical_lib.sh
define verify-vndk-libs-identical
@echo "Checking VNDK vendor variant: $(2)"
$(hide) CLANG_BIN="$(LLVM_PREBUILTS_PATH)" \
	CROSS_COMPILE="$(strip $(3))" \
	XZ="$(XZ)" \
	$(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2)
endef
+2 −2
Original line number Diff line number Diff line
@@ -113,12 +113,12 @@ my_link_type := app:sdk
my_warn_types := native:platform $(my_warn_ndk_types)
my_allowed_types := $(my_allowed_ndk_types)
    ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
        my_allowed_types += native:vendor native:vndk
        my_allowed_types += native:vendor native:vndk native:platform_vndk
    endif
else
my_link_type := app:platform
my_warn_types := $(my_warn_ndk_types)
my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private
my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private native:platform_vndk
endif

my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
+4 −0
Original line number Diff line number Diff line
@@ -501,6 +501,10 @@ ifndef subdir_makefiles_total
subdir_makefiles_total := $(words init post finish)
endif

droid_targets: no_vendor_variant_vndk_check
.PHONY: no_vendor_variant_vndk_check
no_vendor_variant_vndk_check:

$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...)

# -------------------------------------------------------------------
Loading