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