Home | History | Annotate | Download | only in tasks
      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 # skip api check for PDK buid
     21 ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK)))
     22 
     23 .PHONY: checkapi
     24 
     25 # Run the checkapi rules by default.
     26 droidcore: checkapi
     27 
     28 last_released_sdk_version := $(lastword $(call numerically_sort, \
     29             $(filter-out current, \
     30                 $(patsubst $(SRC_API_DIR)/%.txt,%, $(wildcard $(SRC_API_DIR)/*.txt)) \
     31              )\
     32         ))
     33 
     34 # INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
     35 # 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.
     38 
     39 # Check that the API we're building hasn't broken the last-released
     40 # SDK version.
     41 $(eval $(call check-api, \
     42     checkapi-last, \
     43     $(SRC_API_DIR)/$(last_released_sdk_version).txt, \
     44     $(INTERNAL_PLATFORM_API_FILE), \
     45     -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
     46     -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
     47     -error 16 -error 17 -error 18 , \
     48     cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
     49     checkapi, \
     50     $(call doc-timestamp-for,api-stubs) \
     51     ))
     52 
     53 # Check that the API we're building hasn't changed from the not-yet-released
     54 # SDK version.
     55 $(eval $(call check-api, \
     56     checkapi-current, \
     57     frameworks/base/api/current.txt, \
     58     $(INTERNAL_PLATFORM_API_FILE), \
     59     -error 2 -error 3 -error 4 -error 5 -error 6 \
     60     -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
     61     -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
     62     -error 25 -error 26 -error 27, \
     63     cat $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
     64     checkapi, \
     65     $(call doc-timestamp-for,api-stubs) \
     66     ))
     67 
     68 .PHONY: update-api
     69 update-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP)
     70 	@echo Copying current.txt
     71 	$(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt
     72 
     73 endif
     74