From fcb0d149b482ef805aea368b91234a0fb414f0d3 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 22 Sep 2017 13:34:10 -0700 Subject: [PATCH] Revert "Revert "Support : for LOCAL_JAVA_RESOURCE_FILES"" This reverts commit 15a2fa21a8eac50f1f9e92bda35990562d0dc462. This reapplies I83f3d45bdd156200308dc7ed0e0fea5d895d37a6 without the error on absolute paths if they are in $(OUT_DIR). BUG: 68305853 Test: OUT_DIR=/tmp/out mmma -j art/tools/ahat Change-Id: Ia0b156d21ba4b95eb3004d61f6fae2f4341fd39c Merged-In: Ia0b156d21ba4b95eb3004d61f6fae2f4341fd39c --- core/java_common.mk | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index 0859a46ce8..bf7f0393b4 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -101,12 +101,20 @@ ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),) java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups)) endif # LOCAL_JAVA_RESOURCE_DIRS -LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES)) ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) - java_resource_file_groups += \ - $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \ - $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \ - ) + # Converts LOCAL_JAVA_RESOURCE_FILES := to $(dir $(file))::$(notdir $(file)) + # and LOCAL_JAVA_RESOURCE_FILES := : to :: + java_resource_file_groups += $(strip $(foreach res,$(LOCAL_JAVA_RESOURCE_FILES), \ + $(eval _file := $(call word-colon,2,$(res))) \ + $(if $(_file), \ + $(eval _base := $(call word-colon,1,$(res))), \ + $(eval _base := $(dir $(res))) \ + $(eval _file := $(notdir $(res)))) \ + $(if $(filter /%, \ + $(filter-out $(OUT_DIR)/%,$(_base) $(_file))), \ + $(call pretty-error,LOCAL_JAVA_RESOURCE_FILES may not include absolute paths: $(_base) $(_file))) \ + $(patsubst %/,%,$(_base))::$(_file))) + endif # LOCAL_JAVA_RESOURCE_FILES ifdef java_resource_file_groups