blob: fc98f5bc8db401240fb749b7357ba5c58b431823 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Copyright (C) 2008 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#
16# Rules for running apicheck to confirm that you haven't broken
17# api compatibility or added apis illegally.
18#
19
Mike Lockwooddaf5e222012-10-18 10:17:47 -070020# skip api check for PDK buid
21ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK)))
The Android Open Source Project88b60792009-03-03 19:28:42 -080022
23.PHONY: checkapi
24
The Android Open Source Project88b60792009-03-03 19:28:42 -080025# Run the checkapi rules by default.
26droidcore: checkapi
27
Joe Onorato15ee93b2011-04-08 15:03:48 -070028last_released_sdk_version := $(lastword $(call numerically_sort, \
Ying Wangc065da22012-11-14 15:57:07 -080029 $(filter-out current, \
Joe Onorato15ee93b2011-04-08 15:03:48 -070030 $(patsubst $(SRC_API_DIR)/%.txt,%, $(wildcard $(SRC_API_DIR)/*.txt)) \
31 )\
32 ))
Ying Wang0f6f4ca2010-06-09 10:26:26 -070033
The Android Open Source Project88b60792009-03-03 19:28:42 -080034# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
Ying Wangc065da22012-11-14 15:57:07 -080035# Note that since INTERNAL_PLATFORM_API_FILE is the byproduct of api-stubs module,
36# (See frameworks/base/Android.mk)
37# we need to add api-stubs as additional dependency of the api check.
The Android Open Source Project88b60792009-03-03 19:28:42 -080038
39# Check that the API we're building hasn't broken the last-released
40# SDK version.
41$(eval $(call check-api, \
Ying Wangc065da22012-11-14 15:57:07 -080042 checkapi-last, \
43 $(SRC_API_DIR)/$(last_released_sdk_version).txt, \
44 $(INTERNAL_PLATFORM_API_FILE), \
Hui Shuf6a9b872014-03-13 15:38:29 -070045 frameworks/base/api/removed.txt, \
Hui Shue8af17e2014-02-21 14:18:19 -080046 $(INTERNAL_PLATFORM_REMOVED_API_FILE), \
Jeff Browndd243372013-04-01 13:40:55 -070047 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
Ying Wangc065da22012-11-14 15:57:07 -080048 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
49 -error 16 -error 17 -error 18 , \
50 cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
51 checkapi, \
52 $(call doc-timestamp-for,api-stubs) \
53 ))
The Android Open Source Project88b60792009-03-03 19:28:42 -080054
55# Check that the API we're building hasn't changed from the not-yet-released
56# SDK version.
57$(eval $(call check-api, \
Ying Wangc065da22012-11-14 15:57:07 -080058 checkapi-current, \
Ying Wang19cc22b2012-12-04 15:07:34 -080059 frameworks/base/api/current.txt, \
Ying Wangc065da22012-11-14 15:57:07 -080060 $(INTERNAL_PLATFORM_API_FILE), \
Hui Shue8af17e2014-02-21 14:18:19 -080061 frameworks/base/api/removed.txt, \
62 $(INTERNAL_PLATFORM_REMOVED_API_FILE), \
Ying Wangc065da22012-11-14 15:57:07 -080063 -error 2 -error 3 -error 4 -error 5 -error 6 \
64 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
65 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
Jeff Browndd243372013-04-01 13:40:55 -070066 -error 25 -error 26 -error 27, \
Ying Wang829f68b2014-06-26 17:54:28 -070067 sed -e 's/%UPDATE_API%/update-api/g' $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
Ying Wangc065da22012-11-14 15:57:07 -080068 checkapi, \
69 $(call doc-timestamp-for,api-stubs) \
70 ))
The Android Open Source Project88b60792009-03-03 19:28:42 -080071
72.PHONY: update-api
73update-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP)
Joe Onorato15ee93b2011-04-08 15:03:48 -070074 @echo Copying current.txt
Ying Wang19cc22b2012-12-04 15:07:34 -080075 $(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt
Hui Shue8af17e2014-02-21 14:18:19 -080076 @echo Copying removed.txt
77 $(hide) $(ACP) $(INTERNAL_PLATFORM_REMOVED_API_FILE) frameworks/base/api/removed.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -080078
Ying Wang829f68b2014-06-26 17:54:28 -070079
80#####################Check System API#####################
81.PHONY: checksystemapi
82
83# Check that the System API we're building hasn't broken the last-released
84# SDK version.
85$(eval $(call check-api, \
86 checksystemapi-last, \
87 $(SRC_SYSTEM_API_DIR)/$(last_released_sdk_version).txt, \
88 $(INTERNAL_PLATFORM_SYSTEM_API_FILE), \
89 frameworks/base/api/system-removed.txt, \
90 $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE), \
91 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
92 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
93 -error 16 -error 17 -error 18 , \
94 cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
95 checksystemapi, \
96 $(call doc-timestamp-for,system-api-stubs) \
97 ))
98
99# Check that the System API we're building hasn't changed from the not-yet-released
100# SDK version.
101$(eval $(call check-api, \
102 checksystemapi-current, \
103 frameworks/base/api/system-current.txt, \
104 $(INTERNAL_PLATFORM_SYSTEM_API_FILE), \
105 frameworks/base/api/system-removed.txt, \
106 $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE), \
107 -error 2 -error 3 -error 4 -error 5 -error 6 \
108 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
109 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
110 -error 25 -error 26 -error 27, \
111 sed -e 's/%UPDATE_API%/update-system-api/g' $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
112 checksystemapi, \
113 $(call doc-timestamp-for,system-api-stubs) \
114 ))
115
116.PHONY: update-system-api
117update-system-api: $(INTERNAL_PLATFORM_SYSTEM_API_FILE) | $(ACP)
118 @echo Copying system-current.txt
119 $(hide) $(ACP) $(INTERNAL_PLATFORM_SYSTEM_API_FILE) frameworks/base/api/system-current.txt
120 @echo Copying system-removed.txt
121 $(hide) $(ACP) $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE) frameworks/base/api/system-removed.txt
122
The Android Open Source Project88b60792009-03-03 19:28:42 -0800123endif