Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 1 | # Copyright (C) 2015 The CyanogenMod 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 |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 21 | ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK) $(TARGET_DISABLE_LINEAGE_SDK))) |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 22 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 23 | .PHONY: checkapi-lineage |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 24 | |
| 25 | # Run the checkapi rules by default. |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 26 | droidcore: checkapi-lineage |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 27 | |
Adnan Begovic | de0b2d3 | 2016-04-01 16:23:12 -0700 | [diff] [blame] | 28 | # Validate against previous release platform sdk version api text within prebuilts |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 29 | lineage_last_released_sdk_version := $(LINEAGE_PLATFORM_SDK_VERSION) |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 30 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 31 | .PHONY: check-lineage-public-api |
| 32 | checkapi-lineage : check-lineage-public-api |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 33 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 34 | .PHONY: update-lineage-api |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 35 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 36 | # INTERNAL_LINEAGE_PLATFORM_API_FILE is the one build by droiddoc. |
| 37 | # Note that since INTERNAL_LINEAGE_PLATFORM_API_FILE is the byproduct of api-stubs module, |
| 38 | # (See lineage-sdk/Android.mk) |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 39 | # we need to add api-stubs as additional dependency of the api check. |
| 40 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 41 | $(INTERNAL_LINEAGE_PLATFORM_API_FILE): lineage-api-stubs-docs |
Adnan Begovic | 97ac30e | 2016-02-10 14:43:35 -0800 | [diff] [blame] | 42 | |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 43 | # Check that the API we're building hasn't broken the last-released |
| 44 | # SDK version. |
| 45 | $(eval $(call check-api, \ |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 46 | checkpublicapi-lineage-last, \ |
| 47 | $(LINEAGE_SRC_API_DIR)/$(lineage_last_released_sdk_version).txt, \ |
| 48 | $(INTERNAL_LINEAGE_PLATFORM_API_FILE), \ |
| 49 | $(FRAMEWORK_LINEAGE_PLATFORM_REMOVED_API_FILE), \ |
| 50 | $(INTERNAL_LINEAGE_PLATFORM_REMOVED_API_FILE), \ |
Adnan Begovic | e738087 | 2016-02-09 11:04:37 -0800 | [diff] [blame] | 51 | -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \ |
| 52 | -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ |
| 53 | -error 16 -error 17 -error 18 , \ |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 54 | cat $(FRAMEWORK_LINEAGE_API_NEEDS_UPDATE_TEXT), \ |
| 55 | check-lineage-public-api, \ |
| 56 | $(call doc-timestamp-for,lineage-api-stubs) \ |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 57 | )) |
| 58 | |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 59 | # Check that the API we're building hasn't changed from the not-yet-released |
| 60 | # SDK version. |
| 61 | $(eval $(call check-api, \ |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 62 | checkpublicapi-lineage-current, \ |
| 63 | $(FRAMEWORK_LINEAGE_PLATFORM_API_FILE), \ |
| 64 | $(INTERNAL_LINEAGE_PLATFORM_API_FILE), \ |
| 65 | $(FRAMEWORK_LINEAGE_PLATFORM_REMOVED_API_FILE), \ |
| 66 | $(INTERNAL_LINEAGE_PLATFORM_REMOVED_API_FILE), \ |
Adnan Begovic | e738087 | 2016-02-09 11:04:37 -0800 | [diff] [blame] | 67 | -error 2 -error 3 -error 4 -error 5 -error 6 \ |
| 68 | -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ |
| 69 | -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ |
| 70 | -error 25 -error 26 -error 27, \ |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 71 | cat $(FRAMEWORK_LINEAGE_API_NEEDS_UPDATE_TEXT), \ |
| 72 | check-lineage-public-api, \ |
| 73 | $(call doc-timestamp-for,lineage-api-stubs) \ |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 74 | )) |
| 75 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 76 | .PHONY: update-lineage-public-api |
| 77 | update-lineage-public-api: $(INTERNAL_LINEAGE_PLATFORM_API_FILE) | $(ACP) |
| 78 | @echo "Copying lineage_current.txt" |
| 79 | $(hide) $(ACP) $(INTERNAL_LINEAGE_PLATFORM_API_FILE) $(FRAMEWORK_LINEAGE_PLATFORM_API_FILE) |
| 80 | @echo "Copying lineage_removed.txt" |
| 81 | $(hide) $(ACP) $(INTERNAL_LINEAGE_PLATFORM_REMOVED_API_FILE) $(FRAMEWORK_LINEAGE_PLATFORM_REMOVED_API_FILE) |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 82 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 83 | update-lineage-api : update-lineage-public-api |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 84 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 85 | .PHONY: update-lineage-prebuilts-latest-public-api |
| 86 | current_sdk_release_text_file := $(LINEAGE_SRC_API_DIR)/$(lineage_last_released_sdk_version).txt |
Adnan Begovic | 4397d1d | 2015-07-16 17:11:06 -0700 | [diff] [blame] | 87 | |
Sam Mortimer | 19ce2d3 | 2017-09-18 21:05:19 -0700 | [diff] [blame] | 88 | update-lineage-prebuilts-latest-public-api: $(FRAMEWORK_LINEAGE_PLATFORM_API_FILE) | $(ACP) |
| 89 | @echo "Publishing lineage_current.txt as latest API release" |
| 90 | $(hide) $(ACP) $(FRAMEWORK_LINEAGE_PLATFORM_API_FILE) $(current_sdk_release_text_file) |
Adnan Begovic | 4397d1d | 2015-07-16 17:11:06 -0700 | [diff] [blame] | 91 | |
Adnan Begovic | 744a257 | 2015-05-26 18:19:59 -0700 | [diff] [blame] | 92 | endif |