platform_vendor_tequila/build/tasks/generate_cmsdk_coverage.mk
Luis Vidal 1117dae753 cmsdk-api-coverage: Don't prepend ANDROID_BUILD_TOP to file path
$@ already contains the full path of the output, so no need
to prepend ANDROID_BUILD_TOP to the path

Change-Id: Ieeeb9fa16352e80b878cddb89b1e7c04b82ab43c
2016-06-13 17:29:48 -07:00

77 lines
3.1 KiB
Makefile

#
# Copyright (C) 2010 The Android Open Source Project
# Copyright (C) 2016 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for producing cmsdk coverage reports.
# Run "make cmsdk-test-coverage" in the $ANDROID_BUILD_TOP directory.
cmsdk_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cmsdk-api-coverage
dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps
coverage_out := $(HOST_OUT)/cmsdk-api-coverage
api_text_description := vendor/cmsdk/api/cm_current.txt
api_xml_description := $(coverage_out)/api.xml
$(api_xml_description) : $(api_text_description) $(APICHECK)
$(hide) echo "Converting API file to XML: $@"
$(hide) mkdir -p $(dir $@)
$(hide) $(APICHECK_COMMAND) -convert2xml $< $@
cmsdk-test-coverage-report := $(coverage_out)/cmsdk-test-coverage.html
cmsdk_tests_apk := $(call intermediates-dir-for,APPS,CMPlatformTests)/package.apk
cmsettingsprovider_tests_apk := $(call intermediates-dir-for,APPS,CMSettingsProviderTests)/package.apk
cmsdk_api_coverage_dependencies := $(cmsdk_api_coverage_exe) $(dexdeps_exe) $(api_xml_description)
$(cmsdk-test-coverage-report): PRIVATE_TEST_CASES := $(cmsdk_tests_apk) $(cmsettingsprovider_tests_apk)
$(cmsdk-test-coverage-report): PRIVATE_CMSDK_API_COVERAGE_EXE := $(cmsdk_api_coverage_exe)
$(cmsdk-test-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe)
$(cmsdk-test-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description)
$(cmsdk-test-coverage-report): $(cmsdk_tests_apk) $(cmsettingsprovider_tests_apk) $(cmsdk_api_coverage_dependencies) | $(ACP)
$(call generate-cm-coverage-report,"CMSDK API Coverage Report",\
$(PRIVATE_TEST_CASES),html)
.PHONY: cmsdk-test-coverage
cmsdk-test-coverage : $(cmsdk-test-coverage-report)
# Put the test coverage report in the dist dir if "cmsdk" is among the build goals.
ifneq ($(filter cmsdk, $(MAKECMDGOALS)),)
$(call dist-for-goals, cmsdk, $(cmsdk-test-coverage-report):cmsdk-test-coverage-report.html)
endif
# Arguments;
# 1 - Name of the report printed out on the screen
# 2 - List of apk files that will be scanned to generate the report
# 3 - Format of the report
define generate-cm-coverage-report
$(hide) mkdir -p $(dir $@)
$(hide) $(PRIVATE_CMSDK_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -f $(3) -o $@ $(2) -cm
@ echo $(1): file://$@
endef
# Reset temp vars
cmsdk_api_coverage_dependencies :=
cmsdk-combined-coverage-report :=
cmsdk-combined-xml-coverage-report :=
cmsdk-verifier-coverage-report :=
cmsdk-test-coverage-report :=
api_xml_description :=
api_text_description :=
coverage_out :=
dexdeps_exe :=
cmsdk_api_coverage_exe :=
cmsdk_verifier_apk :=
android_cmsdk_zip :=