1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# We define this in a subdir so that it won't pick up the parent's Android.xml by default.
16
17LOCAL_PATH := $(call my-dir)
18
19# $(1) name of the xml file to be created
20# $(2) path to the api text file
21define build_xml_api_file
22include $(CLEAR_VARS)
23LOCAL_MODULE := cts-$(subst .,-,$(1))
24LOCAL_MODULE_STEM := $(1)
25LOCAL_MODULE_CLASS := ETC
26LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
27include $(BUILD_SYSTEM)/base_rules.mk
28$$(LOCAL_BUILT_MODULE): $(2) | $(APICHECK)
29	@echo "Convert API file $$< -> $$@"
30	@mkdir -p $$(dir $$@)
31	$(hide) $(APICHECK_COMMAND) --compatible-output=no -convert2xmlnostrip $$< $$@
32endef
33
34$(foreach ver,$(PLATFORM_SYSTEMSDK_VERSIONS),\
35  $(if $(call math_is_number,$(ver)),\
36    $(eval $(call build_xml_api_file,system-$(ver).api,prebuilts/sdk/$(ver)/system/api/android.txt))\
37  )\
38)
39
40$(foreach ver,$(call int_range_list,28,$(PLATFORM_SDK_VERSION)),\
41  $(foreach api_level,public system,\
42    $(foreach lib,$(filter-out android,$(filter-out %removed,$(filter-out incompatibilities,\
43      $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt)))))),\
44        $(eval $(call build_xml_api_file,$(lib)-$(ver)-$(api_level).api,prebuilts/sdk/$(ver)/$(api_level)/api/$(lib).txt)) \
45    )\
46  )\
47)
48