1 # 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 20 ifneq ($(BUILD_TINY_ANDROID), true) 21 22 .PHONY: checkapi 23 24 # eval this to define a rule that runs apicheck. 25 # 26 # Args: 27 # $(1) target 28 # $(2) stable api xml file 29 # $(3) api xml file to be tested 30 # $(4) arguments for apicheck 31 # $(5) command to run if apicheck failed 32 define check-api 33 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(APICHECK) 34 @echo "Checking API:" $(1) 35 $(hide) ( $(APICHECK) $(4) $(2) $(3) || ( $(5) ; exit 38 ) ) 36 $(hide) mkdir -p $$(dir $$@) 37 $(hide) touch $$@ 38 checkapi: $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp 39 endef 40 41 # Run the checkapi rules by default. 42 droidcore: checkapi 43 44 last_released_sdk_version := $(lastword $(call numerically_sort,\ 45 $(patsubst $(SRC_API_DIR)/%.xml,%, \ 46 $(filter-out $(SRC_API_DIR)/current.xml, \ 47 $(wildcard $(SRC_API_DIR)/*.xml))))) 48 49 # INTERNAL_PLATFORM_API_FILE is the one build by droiddoc. 50 51 # Check that the API we're building hasn't broken the last-released 52 # SDK version. 53 $(eval $(call check-api, \ 54 checkapi-last, \ 55 $(SRC_API_DIR)/$(last_released_sdk_version).xml, \ 56 $(INTERNAL_PLATFORM_API_FILE), \ 57 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \ 58 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ 59 -error 16 -error 17 -error 18 , \ 60 cat $(BUILD_SYSTEM)/apicheck_msg_last.txt \ 61 )) 62 63 # Check that the API we're building hasn't changed from the not-yet-released 64 # SDK version. 65 $(eval $(call check-api, \ 66 checkapi-current, \ 67 $(SRC_API_DIR)/current.xml, \ 68 $(INTERNAL_PLATFORM_API_FILE), \ 69 -error 2 -error 3 -error 4 -error 5 -error 6 \ 70 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ 71 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ 72 -error 25 , \ 73 cat $(BUILD_SYSTEM)/apicheck_msg_current.txt \ 74 )) 75 76 .PHONY: update-api 77 update-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP) 78 @echo Copying current.xml 79 $(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) $(SRC_API_DIR)/current.xml 80 81 endif 82