From 7fc865a4caec1a2ced41918449e34596f50f8c43 Mon Sep 17 00:00:00 2001 From: William Roberts Date: Tue, 29 Sep 2015 14:17:38 -0700 Subject: [PATCH] service_contexts: don't delete intermediate on failure When service_contexts fails to build, the file is deleted leaving only the error message for debugging. Build service_contexts and general variant as a temporary intermediate before running checkfc. Change-Id: Ib9dcbf21d0a28700d500cf0ea4e412b009758d5d Signed-off-by: William Roberts --- Android.mk | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Android.mk b/Android.mk index a303eda32..95a19daa2 100644 --- a/Android.mk +++ b/Android.mk @@ -315,16 +315,22 @@ include $(BUILD_SYSTEM)/base_rules.mk all_svc_files := $(call build_policy, service_contexts) -$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) -$(LOCAL_BUILT_MODULE): PRIVATE_SVC_FILES := $(all_svc_files) -$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) -$(LOCAL_BUILT_MODULE): $(all_svc_files) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc +service_contexts.tmp := $(intermediates)/service_contexts.tmp +$(service_contexts.tmp): PRIVATE_SVC_FILES := $(all_svc_files) +$(service_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) +$(service_contexts.tmp): $(all_svc_files) @mkdir -p $(dir $@) $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ - $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@ + +$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) +$(LOCAL_BUILT_MODULE): $(service_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) + @mkdir -p $(dir $@) + $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $< + $(hide) $(ACP) $< $@ built_svc := $(LOCAL_BUILT_MODULE) all_svc_files := +service_contexts.tmp := ################################## include $(CLEAR_VARS) @@ -335,12 +341,18 @@ LOCAL_MODULE_TAGS := tests include $(BUILD_SYSTEM)/base_rules.mk -$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_general_sepolicy) -$(LOCAL_BUILT_MODULE): $(addprefix $(LOCAL_PATH)/, service_contexts) $(built_general_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc +general_service_contexts.tmp := $(intermediates)/general_service_contexts.tmp +$(general_service_contexts.tmp): $(addprefix $(LOCAL_PATH)/, service_contexts) @mkdir -p $(dir $@) $(hide) m4 -s $< > $@ - $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@ +$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_general_sepolicy) +$(LOCAL_BUILT_MODULE): $(general_service_contexts.tmp) $(built_general_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) + @mkdir -p $(dir $@) + $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $< + $(hide) $(ACP) $< $@ + +general_service_contexts.tmp := ################################## include $(CLEAR_VARS)