Check vndk list on build

Check current vndk list on build time with current.txt.
If the vndk list is changed, the current.txt must be updated
manually. Otherwise the build will report an error.

The list is not allowed to be updated for the release versions.

Bug: 77816590
Bug: 67002788
Test: run 'm check-vndk-list' and check if build is successful.
Test: 1. change vndk property of a module and run 'm check-vndk-list'
         and check if build is failed.
      2. run 'update-vndk-list.sh'.
      3. run 'm check-vndk-list' again and check if build is
         successful.

Change-Id: I4caeb9eafa898f175d40f96125b9997edaeadbeb
Merged-In: I4caeb9eafa898f175d40f96125b9997edaeadbeb
(cherry picked from commit 27caa055b9e53f65b9d0aec126e05dab32145717)
This commit is contained in:
Justin Yun 2018-04-10 17:59:44 +09:00
parent 681cdaf454
commit 32e3453212
1 changed files with 19 additions and 9 deletions

View File

@ -21,26 +21,31 @@ $(INTERNAL_VNDK_LIB_LIST):
# This is the up-to-date list of vndk libs. # This is the up-to-date list of vndk libs.
# TODO(b/62012285): the lib list should be stored somewhere under # TODO(b/62012285): the lib list should be stored somewhere under
# /prebuilts/vndk # /prebuilts/vndk
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/$(PLATFORM_VNDK_VERSION).txt LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/$(PLATFORM_VNDK_VERSION).txt
ifeq ($(wildcard $(LATEST_VNDK_LIB_LIST)),)
$(error $(LATEST_VNDK_LIB_LIST) file not found. Please copy "$(LOCAL_PATH)/current.txt" to "$(LATEST_VNDK_LIB_LIST)" and commit a CL for release branch)
endif
else
LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt
endif
##################################################################### #####################################################################
# Check the generate list against the latest list stored in the # Check the generate list against the latest list stored in the
# source tree # source tree
.PHONY: check-vndk-list .PHONY: check-vndk-list
ifeq (REL,$(PLATFORM_VERSION_CODENAME)) # Check if vndk list is changed
# The check is enforced in release branches
droidcore: check-vndk-list droidcore: check-vndk-list
endif
check-vndk-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-list-timestamp check-vndk-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-list-timestamp
check-vndk-list: $(check-vndk-list-timestamp) check-vndk-list: $(check-vndk-list-timestamp)
_vndk_check_failure_message := "VNDK library list has changed." _vndk_check_failure_message := " error: VNDK library list has been changed.\n"
ifeq (REL,$(PLATFORM_VERSION_CODENAME) ifeq (REL,$(PLATFORM_VERSION_CODENAME))
_vndk_check_failure_message += "This isn't allowed in API locked branches." _vndk_check_failure_message += " Changing the VNDK library list is not allowed in API locked branches."
else else
_vndk_check_failure_message += "Run update-vndk-list.sh to update the list." _vndk_check_failure_message += " Run update-vndk-list.sh to update $(LATEST_VNDK_LIB_LIST)"
endif endif
$(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh $(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh
@ -48,7 +53,7 @@ $(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST)
--new-line-format="Added %L" \ --new-line-format="Added %L" \
--unchanged-line-format="" \ --unchanged-line-format="" \
$(LATEST_VNDK_LIB_LIST) $(INTERNAL_VNDK_LIB_LIST) \ $(LATEST_VNDK_LIB_LIST) $(INTERNAL_VNDK_LIB_LIST) \
|| ( echo $(_vndk_check_failure_message); exit 1 )) || ( echo -e $(_vndk_check_failure_message); exit 1 ))
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) touch $@ $(hide) touch $@
@ -71,7 +76,12 @@ ifeq (REL,$(PLATFORM_VERSION_CODENAME))
$(hide) echo "echo Updating VNDK library list is NOT allowed in API locked branches." >> $@; \ $(hide) echo "echo Updating VNDK library list is NOT allowed in API locked branches." >> $@; \
echo "exit 1" >> $@ echo "exit 1" >> $@
else else
$(hide) echo "cp $(PRIVATE_INTERNAL_VNDK_LIB_LIST) $(PRIVATE_LATEST_VNDK_LIB_LIST)" >> $@; \ $(hide) echo "if [ -z \"\$${ANDROID_BUILD_TOP}\" ]; then" >> $@; \
echo " echo Run lunch or choosecombo first" >> $@; \
echo " exit 1" >> $@; \
echo "fi" >> $@; \
echo "cd \$${ANDROID_BUILD_TOP}" >> $@; \
echo "cp $(PRIVATE_INTERNAL_VNDK_LIB_LIST) $(PRIVATE_LATEST_VNDK_LIB_LIST)" >> $@; \
echo "echo $(PRIVATE_LATEST_VNDK_LIB_LIST) updated." >> $@ echo "echo $(PRIVATE_LATEST_VNDK_LIB_LIST) updated." >> $@
endif endif
@chmod a+x $@ @chmod a+x $@