blob: e5977ac36593297b8e2f962dbc4ffbec246bd382 [file] [log] [blame]
Adnan Begovic744a2572015-05-26 18:19:59 -07001# Copyright (C) 2015 The CyanogenMod 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#
16# Rules for running apicheck to confirm that you haven't broken
17# api compatibility or added apis illegally.
18#
19
20# skip api check for PDK buid
Luca Stefani9b58af52016-08-26 22:59:59 +020021ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK) $(TARGET_DISABLE_CMSDK)))
Adnan Begovic744a2572015-05-26 18:19:59 -070022
23.PHONY: checkapi-cm
24
25# Run the checkapi rules by default.
26droidcore: checkapi-cm
27
Adnan Begovicde0b2d32016-04-01 16:23:12 -070028# Validate against previous release platform sdk version api text within prebuilts
Adnan Begovica1947312016-08-17 14:14:11 -070029cm_last_released_sdk_version := $(CM_PLATFORM_SDK_VERSION)
Adnan Begovic744a2572015-05-26 18:19:59 -070030
31.PHONY: check-cm-public-api
32checkapi-cm : check-cm-public-api
33
34.PHONY: update-cm-api
35
36# INTERNAL_CM_PLATFORM_API_FILE is the one build by droiddoc.
37# Note that since INTERNAL_CM_PLATFORM_API_FILE is the byproduct of api-stubs module,
38# (See vendor/cmsdk/Android.mk)
39# we need to add api-stubs as additional dependency of the api check.
40
Adnan Begovic97ac30e2016-02-10 14:43:35 -080041$(INTERNAL_CM_PLATFORM_API_FILE): cm-api-stubs-docs
42
Adnan Begovic744a2572015-05-26 18:19:59 -070043# Check that the API we're building hasn't broken the last-released
44# SDK version.
45$(eval $(call check-api, \
46 checkpublicapi-cm-last, \
47 $(CM_SRC_API_DIR)/$(cm_last_released_sdk_version).txt, \
48 $(INTERNAL_CM_PLATFORM_API_FILE), \
Adnan Begovic5dd33712015-07-16 17:10:17 -070049 $(FRAMEWORK_CM_PLATFORM_REMOVED_API_FILE), \
Adnan Begovic744a2572015-05-26 18:19:59 -070050 $(INTERNAL_CM_PLATFORM_REMOVED_API_FILE), \
Adnan Begovice7380872016-02-09 11:04:37 -080051 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
52 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
53 -error 16 -error 17 -error 18 , \
54 cat $(FRAMEWORK_CM_API_NEEDS_UPDATE_TEXT), \
Adnan Begovic744a2572015-05-26 18:19:59 -070055 check-cm-public-api, \
Adnan Begovice7380872016-02-09 11:04:37 -080056 $(call doc-timestamp-for,cm-api-stubs) \
Adnan Begovic744a2572015-05-26 18:19:59 -070057 ))
58
Adnan Begovic744a2572015-05-26 18:19:59 -070059# Check that the API we're building hasn't changed from the not-yet-released
60# SDK version.
61$(eval $(call check-api, \
62 checkpublicapi-cm-current, \
Adnan Begovic5dd33712015-07-16 17:10:17 -070063 $(FRAMEWORK_CM_PLATFORM_API_FILE), \
Adnan Begovic744a2572015-05-26 18:19:59 -070064 $(INTERNAL_CM_PLATFORM_API_FILE), \
Adnan Begovic5dd33712015-07-16 17:10:17 -070065 $(FRAMEWORK_CM_PLATFORM_REMOVED_API_FILE), \
Adnan Begovic744a2572015-05-26 18:19:59 -070066 $(INTERNAL_CM_PLATFORM_REMOVED_API_FILE), \
Adnan Begovice7380872016-02-09 11:04:37 -080067 -error 2 -error 3 -error 4 -error 5 -error 6 \
68 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
69 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
70 -error 25 -error 26 -error 27, \
71 cat $(FRAMEWORK_CM_API_NEEDS_UPDATE_TEXT), \
Adnan Begovic744a2572015-05-26 18:19:59 -070072 check-cm-public-api, \
Adnan Begovice7380872016-02-09 11:04:37 -080073 $(call doc-timestamp-for,cm-api-stubs) \
Adnan Begovic744a2572015-05-26 18:19:59 -070074 ))
75
76.PHONY: update-cm-public-api
77update-cm-public-api: $(INTERNAL_CM_PLATFORM_API_FILE) | $(ACP)
Luca Stefani9b58af52016-08-26 22:59:59 +020078 @echo "Copying cm_current.txt"
Adnan Begovic5dd33712015-07-16 17:10:17 -070079 $(hide) $(ACP) $(INTERNAL_CM_PLATFORM_API_FILE) $(FRAMEWORK_CM_PLATFORM_API_FILE)
Luca Stefani9b58af52016-08-26 22:59:59 +020080 @echo "Copying cm_removed.txt"
Adnan Begovic5dd33712015-07-16 17:10:17 -070081 $(hide) $(ACP) $(INTERNAL_CM_PLATFORM_REMOVED_API_FILE) $(FRAMEWORK_CM_PLATFORM_REMOVED_API_FILE)
Adnan Begovic744a2572015-05-26 18:19:59 -070082
83update-cm-api : update-cm-public-api
84
Adnan Begovic4397d1d2015-07-16 17:11:06 -070085.PHONY: update-cm-prebuilts-latest-public-api
86current_sdk_release_text_file := $(CM_SRC_API_DIR)/$(cm_last_released_sdk_version).txt
87
88update-cm-prebuilts-latest-public-api: $(FRAMEWORK_CM_PLATFORM_API_FILE) | $(ACP)
Luca Stefani9b58af52016-08-26 22:59:59 +020089 @echo "Publishing cm_current.txt as latest API release"
Adnan Begovic4397d1d2015-07-16 17:11:06 -070090 $(hide) $(ACP) $(FRAMEWORK_CM_PLATFORM_API_FILE) $(current_sdk_release_text_file)
91
Adnan Begovic744a2572015-05-26 18:19:59 -070092endif