Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 1 | # Copyright (C) 2015 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 | # Input variables |
| 17 | # |
| 18 | # $(support_module) - name of the support library module |
| 19 | # $(support_module_api_dir) - dir to store API files |
| 20 | # $(support_module_java_libraries) - dependent libraries |
| 21 | # $(support_module_java_packages) - list of package names containing public classes |
| 22 | # $(support_module_src_files) - list of source files |
Chris Banes | 95ad49b | 2015-10-19 11:02:33 +0100 | [diff] [blame] | 23 | # $(support_module_aidl_includes) - list of aidl files |
Chris Banes | 6396405 | 2015-04-30 10:37:19 +0100 | [diff] [blame] | 24 | # $(api_check_current_msg_file) - file containing error message for current API check |
| 25 | # $(api_check_last_msg_file) - file containing error message for last SDK API check |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 26 | # --------------------------------------------- |
| 27 | |
| 28 | # |
| 29 | # Generate the stub source files |
| 30 | # --------------------------------------------- |
| 31 | include $(CLEAR_VARS) |
| 32 | |
| 33 | support_module_api_file := \ |
| 34 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(support_module)_api.txt |
| 35 | support_module_removed_file := \ |
| 36 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(support_module)_removed.txt |
| 37 | |
| 38 | LOCAL_MODULE := $(support_module)-stubs |
| 39 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 40 | LOCAL_MODULE_TAGS := optional |
| 41 | |
| 42 | LOCAL_SRC_FILES := $(support_module_src_files) |
Chris Banes | 95ad49b | 2015-10-19 11:02:33 +0100 | [diff] [blame] | 43 | LOCAL_AIDL_INCLUDES := $(support_module_aidl_includes) |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 44 | LOCAL_JAVA_LIBRARIES := $(support_module_java_libraries) |
| 45 | LOCAL_ADDITIONAL_JAVA_DIR := \ |
| 46 | $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(support_module),,COMMON)/src |
Chris Banes | 82b5549 | 2016-01-22 11:11:47 +0000 | [diff] [blame] | 47 | LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION) |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 48 | |
Ying Wang | 746d818 | 2015-07-16 14:18:19 -0700 | [diff] [blame] | 49 | LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src |
| 50 | |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 51 | LOCAL_DROIDDOC_OPTIONS:= \ |
Chris Banes | 6396405 | 2015-04-30 10:37:19 +0100 | [diff] [blame] | 52 | -stubpackages "$(subst $(space),:,$(support_module_java_packages))" \ |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 53 | -api $(support_module_api_file) \ |
| 54 | -removedApi $(support_module_removed_file) \ |
| 55 | -nodocs |
| 56 | |
| 57 | LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk |
| 58 | LOCAL_UNINSTALLABLE_MODULE := true |
| 59 | |
| 60 | include $(BUILD_DROIDDOC) |
| 61 | support_stub_stamp := $(full_target) |
| 62 | $(support_module_api_file) : $(full_target) |
| 63 | |
| 64 | # |
| 65 | # Check API |
| 66 | # --------------------------------------------- |
| 67 | last_released_sdk_$(support_module) := $(lastword $(call numerically_sort, \ |
| 68 | $(filter-out current, \ |
| 69 | $(patsubst $(support_module_api_dir)/%.txt,%, $(wildcard $(support_module_api_dir)/*.txt)) \ |
| 70 | ))) |
| 71 | |
| 72 | # Check that the API we're building hasn't broken the last-released SDK version |
| 73 | # if it exists |
Chris Banes | f3fac2d | 2015-03-28 18:55:31 +0000 | [diff] [blame] | 74 | ifneq ($(last_released_sdk_$(support_module)),) |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 75 | $(eval $(call check-api, \ |
| 76 | $(support_module)-checkapi-last, \ |
| 77 | $(support_module_api_dir)/$(last_released_sdk_$(support_module)).txt, \ |
| 78 | $(support_module_api_file), \ |
| 79 | $(support_module_api_dir)/removed.txt, \ |
| 80 | $(support_module_removed_file), \ |
| 81 | -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \ |
| 82 | -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \ |
| 83 | -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18, \ |
| 84 | cat $(api_check_last_msg_file), \ |
| 85 | check-support-api, \ |
| 86 | $(support_stub_stamp))) |
| 87 | endif |
| 88 | |
| 89 | # Check that the API we're building hasn't changed from the not-yet-released |
| 90 | # SDK version. |
| 91 | $(eval $(call check-api, \ |
| 92 | $(support_module)-checkapi-current, \ |
| 93 | $(support_module_api_dir)/current.txt, \ |
| 94 | $(support_module_api_file), \ |
| 95 | $(support_module_api_dir)/removed.txt, \ |
| 96 | $(support_module_removed_file), \ |
| 97 | -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \ |
| 98 | -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \ |
| 99 | -error 21 -error 23 -error 24 -error 25, \ |
| 100 | cat $(api_check_current_msg_file), \ |
| 101 | check-support-api, \ |
| 102 | $(support_stub_stamp))) |
| 103 | |
| 104 | .PHONY: update-$(support_module)-api |
| 105 | update-$(support_module)-api: PRIVATE_API_DIR := $(support_module_api_dir) |
| 106 | update-$(support_module)-api: PRIVATE_MODULE := $(support_module) |
| 107 | update-$(support_module)-api: PRIVATE_REMOVED_API_FILE := $(support_module_removed_file) |
| 108 | update-$(support_module)-api: $(support_module_api_file) | $(ACP) |
| 109 | @echo Copying $(PRIVATE_MODULE) current.txt |
| 110 | $(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt |
| 111 | @echo Copying $(PRIVATE_MODULE) removed.txt |
| 112 | $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt |
| 113 | |
| 114 | # Run this update API task on the update-support-api task |
| 115 | update-support-api: update-$(support_module)-api |
| 116 | |
| 117 | # |
| 118 | # Clear variables |
| 119 | # --------------------------------------------- |
| 120 | support_module := |
| 121 | support_module_api_dir := |
| 122 | support_module_src_files := |
Chris Banes | 95ad49b | 2015-10-19 11:02:33 +0100 | [diff] [blame] | 123 | support_module_aidl_includes := |
Chris Banes | f62fcde | 2015-02-25 10:42:47 +0000 | [diff] [blame] | 124 | support_module_java_libraries := |
| 125 | support_module_java_packages := |
| 126 | support_module_api_file := |
| 127 | support_module_removed_file := |
| 128 | support_stub_stamp := |