Disallow VINTF metadata for PRODUCT_COPY_FILES

VINTF metadata must be checked by defining
DEVICE_MANIFEST_FILE and friends, instead of being
copied with PRODUCT_COPY_FILES directly.

This can be worked arond with BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES.

Test: Add the following and see errors:

PRODUCT_COPY_FILES += \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/vintf/manifest.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/vintf/manifest/foo.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/vintf/compatibility_matrix.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/manifest.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/manifest/foo.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/compatibility_matrix.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/etc/vintf/manifest.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/etc/vintf/compatibility_matrix.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_ODM)/etc/manifest.xml \
    device/XXX/manifest.xml:$(TARGET_COPY_OUT_ODM)/etc/vintf/manifest.xml \

Test: test again with BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES := true

Bug: 147506249

Change-Id: Id75a9690b3c71fdc9a4e1b4e9be2caa63183cf7c
This commit is contained in:
Yifan Hong 2020-01-09 16:15:11 -08:00
parent 4b26ce076a
commit 5e57a778cd
2 changed files with 24 additions and 2 deletions

View File

@ -16,7 +16,28 @@ LOCAL_PATH := $(BUILD_SYSTEM)
define check-product-copy-files
$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
$(if $(filter %.apk, $(2)),$(error \
Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
$(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \
$(TARGET_COPY_OUT_SYSTEM)/manifest.xml \
$(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \
$(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \
$(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \
$(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
$(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \
$(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
use vintf_compatibility_matrix / vintf_fragments instead!)) \
$(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \
$(TARGET_COPY_OUT_VENDOR)/manifest.xml \
$(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \
$(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
$(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \
$(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \
$(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
)
endef
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=

View File

@ -86,10 +86,11 @@ _board_strip_readonly_list += $(_dynamic_partitions_var_list)
_build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \
BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
BUILD_BROKEN_PREBUILT_ELF_FILES \
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
BUILD_BROKEN_USES_NETWORK \
BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
_build_broken_var_list += \
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \