Build DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE

... along with compatibility_matrix.device.xml.
The new module cm.device.xml contains the original content
of empty.xml (kernel configs, sepolicy, etc.) as well
as HALs from DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE.
This variable points to a framework compatibility matrix
that contains framework HALs as a vendor extension; all
HALs in this file must be optional.

Bug: 65028233
Test: m framework_compatibility_matrix.xml -j and manual inspection
Test: vts_treble_vintf_test

Change-Id: I94949f62f7f5b332d845f2e7fa4714df7c49ed3e
Merged-In: I94949f62f7f5b332d845f2e7fa4714df7c49ed3e
This commit is contained in:
Yifan Hong 2018-03-23 12:03:33 -07:00
parent c0660b0142
commit 13df628b8f
3 changed files with 50 additions and 4 deletions

View file

@ -22,6 +22,7 @@ BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := $(LOCAL_PATH)/compatibility_matrix.mk
LOCAL_ADD_VBMETA_VERSION :=
LOCAL_ASSEMBLE_VINTF_ENV_VARS :=
LOCAL_ASSEMBLE_VINTF_FLAGS :=
LOCAL_WARN_REQUIRED_HALS :=
LOCAL_KERNEL_VERSIONS :=
LOCAL_GEN_FILE_DEPENDENCIES :=
@ -57,14 +58,46 @@ include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
# Framework Compatibility Matrix (common to all FCM versions)
include $(CLEAR_VARS)
LOCAL_MODULE_STEM := compatibility_matrix.empty.xml
LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
LOCAL_MODULE_STEM := compatibility_matrix.device.xml
# define LOCAL_MODULE and LOCAL_MODULE_CLASS for local-generated-sources-dir.
LOCAL_MODULE := framework_compatibility_matrix.device.xml
LOCAL_MODULE_CLASS := ETC
ifndef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
LOCAL_SRC_FILES := compatibility_matrix.empty.xml
else
# DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE specify an absolute path
LOCAL_GENERATED_SOURCES := $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE)
# Enforce that DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE does not specify required HALs
# by checking it against an empty manifest. But the empty manifest needs to contain
# BOARD_SEPOLICY_VERS to be compatible with DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE.
my_manifest_src_file := $(LOCAL_PATH)/manifest.empty.xml
my_gen_check_manifest := $(local-generated-sources-dir)/manifest.check.xml
$(my_gen_check_manifest): PRIVATE_SRC_FILE := $(my_manifest_src_file)
$(my_gen_check_manifest): $(my_manifest_src_file) $(HOST_OUT_EXECUTABLES)/assemble_vintf
BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
IGNORE_TARGET_FCM_VERSION=true \
$(HOST_OUT_EXECUTABLES)/assemble_vintf -i $(PRIVATE_SRC_FILE) -o $@
LOCAL_GEN_FILE_DEPENDENCIES += $(my_gen_check_manifest)
LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_gen_check_manifest)"
my_gen_check_manifest :=
my_manifest_src_file :=
endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
LOCAL_ADD_VBMETA_VERSION := true
LOCAL_ASSEMBLE_VINTF_ENV_VARS := \
POLICYVERS \
PLATFORM_SEPOLICY_VERSION \
PLATFORM_SEPOLICY_COMPAT_VERSIONS
LOCAL_WARN_REQUIRED_HALS := \
"Error: DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX cannot contain required HALs."
include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
# Framework Compatibility Matrix
@ -78,7 +111,7 @@ LOCAL_REQUIRED_MODULES := \
framework_compatibility_matrix.1.xml \
framework_compatibility_matrix.2.xml \
framework_compatibility_matrix.current.xml \
framework_compatibility_matrix.empty.xml
framework_compatibility_matrix.device.xml
LOCAL_GENERATED_SOURCES := $(call module-installed-files,$(LOCAL_REQUIRED_MODULES))
ifdef BUILT_VENDOR_MANIFEST

View file

@ -29,8 +29,13 @@ ifndef LOCAL_MODULE_STEM
$(error LOCAL_MODULE_STEM must be defined.)
endif
ifndef LOCAL_MODULE
LOCAL_MODULE := framework_$(LOCAL_MODULE_STEM)
endif
ifndef LOCAL_MODULE_CLASS
LOCAL_MODULE_CLASS := ETC
endif
ifndef LOCAL_MODULE_PATH
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf
@ -76,13 +81,19 @@ my_matrix_src_files := \
$(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) \
$(LOCAL_GENERATED_SOURCES)
ifneq (,$(strip $(LOCAL_WARN_REQUIRED_HALS)))
$(GEN): PRIVATE_ADDITIONAL_ENV_VARS += PRODUCT_ENFORCE_VINTF_MANIFEST=true
$(GEN): PRIVATE_COMMAND_TAIL := || (echo $(strip $(LOCAL_WARN_REQUIRED_HALS)) && false)
endif
$(GEN): PRIVATE_SRC_FILES := $(my_matrix_src_files)
$(GEN): $(my_matrix_src_files) $(HOST_OUT_EXECUTABLES)/assemble_vintf
$(foreach varname,$(PRIVATE_ENV_VARS),$(varname)="$($(varname))") \
$(PRIVATE_ADDITIONAL_ENV_VARS) \
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
-i $(call normalize-path-list,$(PRIVATE_SRC_FILES)) \
-o $@ \
$(PRIVATE_FLAGS)
$(PRIVATE_FLAGS) $(PRIVATE_COMMAND_TAIL)
LOCAL_PREBUILT_MODULE_FILE := $(GEN)
LOCAL_SRC_FILES :=
@ -91,6 +102,7 @@ LOCAL_GENERATED_SOURCES :=
LOCAL_ADD_VBMETA_VERSION :=
LOCAL_ASSEMBLE_VINTF_ENV_VARS :=
LOCAL_ASSEMBLE_VINTF_FLAGS :=
LOCAL_WARN_REQUIRED_HALS :=
LOCAL_KERNEL_VERSIONS :=
LOCAL_GEN_FILE_DEPENDENCIES :=
my_matrix_src_files :=

View file

@ -0,0 +1 @@
<manifest version="1.0" type="device" />