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