From fcd8fcefa844ddaa0f1c04f7b98c79f4a5088f76 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Thu, 23 Apr 2020 14:11:26 -0400 Subject: [PATCH] Add support for Rust coverage files from Soong. Bug: 146448203 Test: Coverage file zips are installed correctly by make. Change-Id: Ia087ec87e5c7be0a91a43307abeabafaa9b366f3 --- core/soong_rust_prebuilt.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/soong_rust_prebuilt.mk b/core/soong_rust_prebuilt.mk index 4a9eb4ab6..804e37edf 100644 --- a/core/soong_rust_prebuilt.mk +++ b/core/soong_rust_prebuilt.mk @@ -75,6 +75,23 @@ ifndef LOCAL_IS_HOST_MODULE endif endif + +ifeq ($(NATIVE_COVERAGE),true) + ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE))) + $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip)) + ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true) + ifdef LOCAL_IS_HOST_MODULE + my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path)) + else + my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) + endif + my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip + $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path))) + $(LOCAL_BUILT_MODULE): $(my_coverage_path) + endif + endif +endif + # A product may be configured to strip everything in some build variants. # We do the stripping as a post-install command so that LOCAL_BUILT_MODULE # is still with the symbols and we don't need to clean it (and relink) when