From 5cc170017128c25eb4ee887855444cbfcb930893 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 9 Oct 2018 13:53:53 -0700 Subject: Stop using DIST_DIR directly, use dist-for-goals instead As a preparation in refactoring how we handle dist, I'm making everything use dist-for-goals. In this case, instead of fully relying on a phony rule, write the gtest xml into an intermediate folder, and use dist-for-goals to copy that into the dist dir. Bug: 117463001 Test: DIST_DIR=dist m aapt2_run_host_unit_tests dist Test: DIST_DIR=dist m aapt2_run_host_unit_tests dist (reruns test) Change-Id: I166c2b3088703875c6028c3479aec7cf09f3f635 --- tools/aapt2/Android.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/aapt2/Android.mk b/tools/aapt2/Android.mk index c9987b86cc5c..b165c6bed220 100644 --- a/tools/aapt2/Android.mk +++ b/tools/aapt2/Android.mk @@ -2,10 +2,19 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) +aapt2_results := $(call intermediates-dir-for,PACKAGING,aapt2_run_host_unit_tests)/result.xml + # Target for running host unit tests on post/pre-submit. .PHONY: aapt2_run_host_unit_tests -aapt2_run_host_unit_tests: PRIVATE_GTEST_OPTIONS := --gtest_output=xml:$(DIST_DIR)/gtest/aapt2_host_unit_tests_result.xml -aapt2_run_host_unit_tests: $(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests - -$(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests $(PRIVATE_GTEST_OPTIONS) > /dev/null 2>&1 +aapt2_run_host_unit_tests: $(aapt2_results) + +$(call dist-for-goals,aapt2_run_host_unit_tests,$(aapt2_results):gtest/aapt2_host_unit_tests_result.xml) + +# Always run the tests again, even if they haven't changed +$(aapt2_results): .KATI_IMPLICIT_OUTPUTS := $(aapt2_results)-nocache +$(aapt2_results): $(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests + -$(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests --gtest_output=xml:$@ > /dev/null 2>&1 + +aapt2_results := include $(call all-makefiles-under,$(LOCAL_PATH)) -- cgit v1.2.3-59-g8ed1b