Vitalii Tomkiv | 280b572 | 2016-03-17 16:17:21 -0700 | [diff] [blame] | 1 | # Copyright (C) 2016 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 | # $(car_module) - name of the car library module |
| 19 | # $(car_module_api_dir) - dir to store API files |
| 20 | # $(car_module_include_systemapi) - if systemApi file should be generated |
| 21 | # $(car_module_java_libraries) - dependent libraries |
| 22 | # $(car_module_java_packages) - list of package names containing public classes |
| 23 | # $(car_module_src_files) - list of source files |
| 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 |
| 26 | # --------------------------------------------- |
| 27 | |
| 28 | ifeq ($(BOARD_IS_AUTOMOTIVE), true) |
| 29 | ifneq ($(TARGET_BUILD_PDK), true) |
| 30 | # |
| 31 | # Generate the public stub source files |
| 32 | # --------------------------------------------- |
| 33 | include $(CLEAR_VARS) |
| 34 | |
| 35 | car_module_api_file := \ |
| 36 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_api.txt |
| 37 | car_module_removed_file := \ |
| 38 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_removed.txt |
| 39 | |
| 40 | LOCAL_MODULE := $(car_module)-stubs |
| 41 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 42 | LOCAL_MODULE_TAGS := optional |
| 43 | |
| 44 | LOCAL_SRC_FILES := $(car_module_src_files) |
| 45 | LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module) |
| 46 | LOCAL_ADDITIONAL_JAVA_DIR := \ |
| 47 | $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src |
| 48 | LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION) |
| 49 | |
| 50 | LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src |
| 51 | |
| 52 | LOCAL_DROIDDOC_OPTIONS:= \ |
| 53 | -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \ |
| 54 | -api $(car_module_api_file) \ |
| 55 | -removedApi $(car_module_removed_file) \ |
| 56 | -nodocs \ |
| 57 | -hide 113 \ |
| 58 | -hide 110 |
| 59 | LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk |
| 60 | LOCAL_UNINSTALLABLE_MODULE := true |
| 61 | |
| 62 | include $(BUILD_DROIDDOC) |
| 63 | car_stub_stamp := $(full_target) |
| 64 | $(car_module_api_file) : $(full_target) |
| 65 | |
| 66 | ifeq ($(car_module_include_systemapi), true) |
| 67 | # |
| 68 | # Generate the system stub source files |
| 69 | # --------------------------------------------- |
| 70 | include $(CLEAR_VARS) |
| 71 | |
| 72 | car_module_system_api_file := \ |
| 73 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_api.txt |
| 74 | car_module_system_removed_file := \ |
| 75 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_removed.txt |
| 76 | |
| 77 | LOCAL_MODULE := $(car_module)-system-stubs |
| 78 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 79 | LOCAL_MODULE_TAGS := optional |
| 80 | |
| 81 | LOCAL_SRC_FILES := $(car_module_src_files) |
| 82 | LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module) |
| 83 | LOCAL_ADDITIONAL_JAVA_DIR := \ |
| 84 | $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src |
| 85 | LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION) |
| 86 | |
| 87 | LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src |
| 88 | |
| 89 | LOCAL_DROIDDOC_OPTIONS:= \ |
| 90 | -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \ |
| 91 | -showAnnotation android.annotation.SystemApi \ |
| 92 | -api $(car_module_system_api_file) \ |
| 93 | -removedApi $(car_module_system_removed_file) \ |
| 94 | -nodocs \ |
| 95 | -hide 113 \ |
| 96 | -hide 110 |
| 97 | LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk |
| 98 | LOCAL_UNINSTALLABLE_MODULE := true |
| 99 | |
| 100 | include $(BUILD_DROIDDOC) |
| 101 | car_system_stub_stamp := $(full_target) |
| 102 | $(car_module_system_api_file) : $(full_target) |
| 103 | |
| 104 | #($(car_module_include_systemapi), true) |
| 105 | endif |
| 106 | # |
| 107 | # Check public API |
| 108 | # --------------------------------------------- |
| 109 | .PHONY: $(car_module)-check-public-api |
| 110 | checkapi: $(car_module)-check-public-api |
| 111 | $(car_module): $(car_module)-check-public-api |
| 112 | |
| 113 | last_released_sdk_$(car_module) := $(lastword $(call numerically_sort, \ |
| 114 | $(filter-out current, \ |
| 115 | $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/*.txt)) \ |
| 116 | ))) |
| 117 | |
| 118 | # Check that the API we're building hasn't broken the last-released SDK version |
| 119 | # if it exists |
| 120 | ifneq ($(last_released_sdk_$(car_module)),) |
| 121 | $(eval $(call check-api, \ |
| 122 | $(car_module)-checkapi-last, \ |
| 123 | $(car_module_api_dir)/$(last_released_sdk_$(car_module)).txt, \ |
| 124 | $(car_module_api_file), \ |
| 125 | $(car_module_api_dir)/removed.txt, \ |
| 126 | $(car_module_removed_file), \ |
| 127 | -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \ |
| 128 | -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \ |
| 129 | -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \ |
| 130 | cat $(api_check_last_msg_file), \ |
| 131 | $(car_module)-check-public-api, \ |
| 132 | $(car_stub_stamp))) |
| 133 | endif |
| 134 | |
| 135 | # Check that the API we're building hasn't changed from the not-yet-released |
| 136 | # SDK version. |
| 137 | $(eval $(call check-api, \ |
| 138 | $(car_module)-checkapi-current, \ |
| 139 | $(car_module_api_dir)/current.txt, \ |
| 140 | $(car_module_api_file), \ |
| 141 | $(car_module_api_dir)/removed.txt, \ |
| 142 | $(car_module_removed_file), \ |
| 143 | -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \ |
| 144 | -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \ |
| 145 | -error 21 -error 23 -error 24 -error 25 -hide 113, \ |
| 146 | cat $(api_check_current_msg_file), \ |
| 147 | $(car_module)-check-public-api, \ |
| 148 | $(car_stub_stamp))) |
| 149 | |
| 150 | .PHONY: update-$(car_module)-api |
| 151 | update-$(car_module)-api: PRIVATE_API_DIR := $(car_module_api_dir) |
| 152 | update-$(car_module)-api: PRIVATE_MODULE := $(car_module) |
| 153 | update-$(car_module)-api: PRIVATE_REMOVED_API_FILE := $(car_module_removed_file) |
| 154 | update-$(car_module)-api: $(car_module_api_file) | $(ACP) |
| 155 | @echo Copying $(PRIVATE_MODULE) current.txt |
| 156 | $(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt |
| 157 | @echo Copying $(PRIVATE_MODULE) removed.txt |
| 158 | $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt |
| 159 | |
| 160 | # Run this update API task on the update-car-api task |
| 161 | update-car-api: update-$(car_module)-api |
| 162 | |
| 163 | ifeq ($(car_module_include_systemapi), true) |
| 164 | |
| 165 | # |
| 166 | # Check system API |
| 167 | # --------------------------------------------- |
| 168 | .PHONY: $(car_module)-check-system-api |
| 169 | checkapi: $(car_module)-check-system-api |
| 170 | $(car_module): $(car_module)-check-system-api |
| 171 | |
| 172 | last_released_system_sdk_$(car_module) := $(lastword $(call numerically_sort, \ |
| 173 | $(filter-out system-current, \ |
| 174 | $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/system-*.txt)) \ |
| 175 | ))) |
| 176 | |
| 177 | # Check that the API we're building hasn't broken the last-released SDK version |
| 178 | # if it exists |
| 179 | ifneq ($(last_released_system_sdk_$(car_module)),) |
| 180 | $(eval $(call check-api, \ |
| 181 | $(car_module)-checksystemapi-last, \ |
| 182 | $(car_module_api_dir)/$(last_released_system_sdk_$(car_module)).txt, \ |
| 183 | $(car_module_system_api_file), \ |
| 184 | $(car_module_api_dir)/system-removed.txt, \ |
| 185 | $(car_module_system_removed_file), \ |
| 186 | -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \ |
| 187 | -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \ |
| 188 | -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \ |
| 189 | cat $(api_check_last_msg_file), \ |
| 190 | $(car_module)-check-system-api, \ |
| 191 | $(car_system_stub_stamp))) |
| 192 | endif |
| 193 | |
| 194 | # Check that the API we're building hasn't changed from the not-yet-released |
| 195 | # SDK version. |
| 196 | $(eval $(call check-api, \ |
| 197 | $(car_module)-checksystemapi-current, \ |
| 198 | $(car_module_api_dir)/system-current.txt, \ |
| 199 | $(car_module_system_api_file), \ |
| 200 | $(car_module_api_dir)/system-removed.txt, \ |
| 201 | $(car_module_system_removed_file), \ |
| 202 | -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \ |
| 203 | -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \ |
| 204 | -error 21 -error 23 -error 24 -error 25 -hide 113, \ |
| 205 | cat $(api_check_current_msg_file), \ |
| 206 | $(car_module)-check-system-api, \ |
| 207 | $(car_stub_stamp))) |
| 208 | |
| 209 | .PHONY: update-$(car_module)-system-api |
| 210 | update-$(car_module)-system-api: PRIVATE_API_DIR := $(car_module_api_dir) |
| 211 | update-$(car_module)-system-api: PRIVATE_MODULE := $(car_module) |
| 212 | update-$(car_module)-system-api: PRIVATE_REMOVED_API_FILE := $(car_module_system_removed_file) |
| 213 | update-$(car_module)-system-api: $(car_module_system_api_file) | $(ACP) |
| 214 | @echo Copying $(PRIVATE_MODULE) system-current.txt |
| 215 | $(hide) $(ACP) $< $(PRIVATE_API_DIR)/system-current.txt |
| 216 | @echo Copying $(PRIVATE_MODULE) system-removed.txt |
| 217 | $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/system-removed.txt |
| 218 | |
| 219 | # Run this update API task on the update-car-api task |
| 220 | update-car-api: update-$(car_module)-system-api |
| 221 | |
| 222 | #($(car_module_include_systemapi), true) |
| 223 | endif |
| 224 | |
| 225 | #($(TARGET_BUILD_PDK),true) |
| 226 | endif |
| 227 | |
| 228 | #($(BOARD_IS_AUTOMOTIVE), true) |
| 229 | endif |
| 230 | # |
| 231 | # Clear variables |
| 232 | # --------------------------------------------- |
| 233 | car_module := |
| 234 | car_module_api_dir := |
| 235 | car_module_src_files := |
| 236 | car_module_java_libraries := |
| 237 | car_module_java_packages := |
| 238 | car_module_api_file := |
| 239 | car_module_removed_file := |
| 240 | car_module_system_api_file := |
| 241 | car_module_system_removed__file := |
| 242 | car_stub_stamp := |
| 243 | car_system_stub_stamp := |
| 244 | car_module_include_systemapi := |