Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2008 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | # |
| 18 | |
| 19 | ALLOWED_VERSIONS := $(call allowed-platform-versions,\ |
| 20 | $(MIN_PLATFORM_VERSION),\ |
| 21 | $(MAX_PLATFORM_VERSION),\ |
| 22 | $(DEFAULT_PLATFORM_VERSION)) |
| 23 | |
| 24 | ifndef TARGET_PLATFORM_VERSION |
| 25 | TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION) |
| 26 | endif |
| 27 | |
| 28 | ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION))) |
| 29 | $(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of) |
| 30 | $(error $(ALLOWED_VERSIONS)) |
| 31 | endif |
| 32 | ALLOWED_VERSIONS := |
| 33 | MIN_PLATFORM_VERSION := |
| 34 | MAX_PLATFORM_VERSION := |
| 35 | |
| 36 | .KATI_READONLY := TARGET_PLATFORM_VERSION |
| 37 | |
| 38 | # Default versions for each TARGET_PLATFORM_VERSION |
| 39 | # TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional |
| 40 | # on this |
| 41 | |
| 42 | # This is the canonical definition of the platform version, |
| 43 | # which is the version that we reveal to the end user. |
| 44 | # Update this value when the platform version changes (rather |
| 45 | # than overriding it somewhere else). Can be an arbitrary string. |
| 46 | |
| 47 | # When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION |
| 48 | # please add that PLATFORM_VERSION as well as clean up obsolete PLATFORM_VERSION's |
| 49 | # in the following text file: |
| 50 | # cts/tests/tests/os/assets/platform_versions.txt |
| 51 | |
| 52 | # Note that there should be one PLATFORM_VERSION and PLATFORM_VERSION_CODENAME |
| 53 | # entry for each unreleased API level, regardless of |
| 54 | # MIN_PLATFORM_VERSION/MAX_PLATFORM_VERSION. PLATFORM_VERSION is used to |
| 55 | # generate the range of allowed SDK versions, so it must have an entry for every |
| 56 | # unreleased API level targetable by this branch, not just those that are valid |
| 57 | # lunch targets for this branch. |
| 58 | |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 59 | PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION)) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 60 | ifndef PLATFORM_VERSION_CODENAME |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 61 | # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION |
| 62 | PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 63 | endif |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 64 | |
| 65 | # This is all of the *active* development codenames. |
| 66 | # This confusing name is needed because |
| 67 | # all_codenames has been baked into build.prop for ages. |
| 68 | # |
| 69 | # Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated |
| 70 | # list of additional codenames after PLATFORM_VERSION_CODENAME. |
| 71 | PLATFORM_VERSION_ALL_CODENAMES := |
| 72 | |
| 73 | # Build a list of all active code names. Avoid duplicates, and stop when we |
| 74 | # reach a codename that matches PLATFORM_VERSION_CODENAME (anything beyond |
| 75 | # that is not included in our build). |
| 76 | _versions_in_target := \ |
| 77 | $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION)) |
| 78 | $(foreach version,$(_versions_in_target),\ |
| 79 | $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\ |
| 80 | $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\ |
| 81 | $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename)))) |
| 82 | |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 83 | # And the list of actually all the codenames that are in preview. The |
| 84 | # ALL_CODENAMES variable is sort of a lie for historical reasons and only |
| 85 | # includes codenames up to and including the currently active codename, whereas |
| 86 | # this variable also includes future codenames. For example, while AOSP is still |
| 87 | # merging into U, but V development has started, ALL_CODENAMES will only be U, |
| 88 | # but ALL_PREVIEW_CODENAMES will be U and V. |
| 89 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := |
| 90 | $(foreach version,$(ALL_VERSIONS),\ |
| 91 | $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\ |
| 92 | $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\ |
| 93 | $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename)))) |
| 94 | |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 95 | # And convert from space separated to comma separated. |
| 96 | PLATFORM_VERSION_ALL_CODENAMES := \ |
| 97 | $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES))) |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 98 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \ |
| 99 | $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES))) |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 100 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 101 | .KATI_READONLY := \ |
| 102 | PLATFORM_VERSION_CODENAME \ |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 103 | PLATFORM_VERSION_ALL_CODENAMES \ |
| 104 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \ |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 105 | |
satayev | 2d94586 | 2022-02-09 21:59:28 +0000 | [diff] [blame] | 106 | ifneq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 107 | codenames := \ |
| 108 | $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES))) |
| 109 | ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),) |
| 110 | $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \ |
| 111 | Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES) |
| 112 | endif |
| 113 | endif |
| 114 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 115 | ifndef PLATFORM_VERSION |
| 116 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 117 | PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE) |
| 118 | else |
| 119 | PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 120 | endif |
| 121 | endif |
| 122 | .KATI_READONLY := PLATFORM_VERSION |
| 123 | |
Colin Cross | a492544 | 2022-02-28 18:01:35 -0800 | [diff] [blame] | 124 | ifndef PLATFORM_DISPLAY_VERSION |
| 125 | PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION) |
| 126 | endif |
| 127 | .KATI_READONLY := PLATFORM_DISPLAY_VERSION |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 128 | |
| 129 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 130 | PLATFORM_PREVIEW_SDK_VERSION := 0 |
| 131 | else |
| 132 | ifndef PLATFORM_PREVIEW_SDK_VERSION |
| 133 | # This is the definition of a preview SDK version over and above the current |
| 134 | # platform SDK version. Unlike the platform SDK version, a higher value |
| 135 | # for preview SDK version does NOT mean that all prior preview APIs are |
| 136 | # included. Packages reading this value to determine compatibility with |
| 137 | # known APIs should check that this value is precisely equal to the preview |
| 138 | # SDK version the package was built for, otherwise it should fall back to |
| 139 | # assuming the device can only support APIs as of the previous official |
| 140 | # public release. |
| 141 | # This value will always be forced to 0 for release builds by the logic |
| 142 | # in the "ifeq" block above, so the value below will be used on any |
| 143 | # non-release builds, and it should always be at least 1, to indicate that |
| 144 | # APIs may have changed since the claimed PLATFORM_SDK_VERSION. |
| 145 | PLATFORM_PREVIEW_SDK_VERSION := 1 |
| 146 | endif |
| 147 | endif |
| 148 | .KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION |
| 149 | |
| 150 | ifndef DEFAULT_APP_TARGET_SDK |
| 151 | # This is the default minSdkVersion and targetSdkVersion to use for |
| 152 | # all .apks created by the build system. It can be overridden by explicitly |
| 153 | # setting these in the .apk's AndroidManifest.xml. It is either the code |
| 154 | # name of the development build or, if this is a release build, the official |
| 155 | # SDK version of this release. |
| 156 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 157 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION) |
| 158 | else |
| 159 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME) |
| 160 | endif |
| 161 | endif |
| 162 | .KATI_READONLY := DEFAULT_APP_TARGET_SDK |
| 163 | |
| 164 | ifndef PLATFORM_VNDK_VERSION |
| 165 | # This is the definition of the VNDK version for the current VNDK libraries. |
| 166 | # The version is only available when PLATFORM_VERSION_CODENAME == REL. |
| 167 | # Otherwise, it will be set to a CODENAME version. The ABI is allowed to be |
| 168 | # changed only before the Android version is released. Once |
| 169 | # PLATFORM_VNDK_VERSION is set to actual version, the ABI for this version |
| 170 | # will be frozon and emit build errors if any ABI for the VNDK libs are |
| 171 | # changed. |
| 172 | # After that the snapshot of the VNDK with this version will be generated. |
| 173 | # |
| 174 | # The VNDK version follows PLATFORM_SDK_VERSION. |
| 175 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 176 | PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION) |
| 177 | else |
| 178 | PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 179 | endif |
| 180 | endif |
| 181 | .KATI_READONLY := PLATFORM_VNDK_VERSION |
| 182 | |
| 183 | ifndef PLATFORM_SYSTEMSDK_MIN_VERSION |
| 184 | # This is the oldest version of system SDK that the platform supports. Contrary |
| 185 | # to the public SDK where platform essentially supports all previous SDK versions, |
| 186 | # platform supports only a few number of recent system SDK versions as some of |
| 187 | # old system APIs are gradually deprecated, removed and then deleted. |
| 188 | PLATFORM_SYSTEMSDK_MIN_VERSION := 28 |
| 189 | endif |
| 190 | .KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION |
| 191 | |
| 192 | # This is the list of system SDK versions that the current platform supports. |
| 193 | PLATFORM_SYSTEMSDK_VERSIONS := |
| 194 | ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION)) |
| 195 | $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\ |
| 196 | $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION))) |
| 197 | PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION)) |
| 198 | endif |
| 199 | # Platform always supports the current version |
| 200 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 201 | PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION) |
| 202 | else |
| 203 | PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES)) |
| 204 | endif |
| 205 | PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS))) |
| 206 | .KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS |
| 207 | |
| 208 | .KATI_READONLY := PLATFORM_SECURITY_PATCH |
| 209 | |
| 210 | ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 211 | # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH. |
| 212 | PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s) |
| 213 | endif |
| 214 | .KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 215 | |
| 216 | ifndef PLATFORM_BASE_OS |
| 217 | # Used to indicate the base os applied to the device. |
| 218 | # Can be an arbitrary string, but must be a single word. |
| 219 | # |
| 220 | # If there is no $PLATFORM_BASE_OS set, keep it empty. |
| 221 | PLATFORM_BASE_OS := |
| 222 | endif |
| 223 | .KATI_READONLY := PLATFORM_BASE_OS |
| 224 | |
| 225 | ifndef BUILD_ID |
| 226 | # Used to signify special builds. E.g., branches and/or releases, |
| 227 | # like "M5-RC7". Can be an arbitrary string, but must be a single |
| 228 | # word and a valid file name. |
| 229 | # |
| 230 | # If there is no BUILD_ID set, make it obvious. |
| 231 | BUILD_ID := UNKNOWN |
| 232 | endif |
| 233 | .KATI_READONLY := BUILD_ID |
| 234 | |
| 235 | ifndef BUILD_DATETIME |
| 236 | # Used to reproduce builds by setting the same time. Must be the number |
| 237 | # of seconds since the Epoch. |
| 238 | BUILD_DATETIME := $(shell date +%s) |
| 239 | endif |
| 240 | |
| 241 | DATE := date -d @$(BUILD_DATETIME) |
| 242 | .KATI_READONLY := DATE |
| 243 | |
| 244 | # Everything should be using BUILD_DATETIME_FROM_FILE instead. |
| 245 | # BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves |
| 246 | # to soong_ui. |
| 247 | $(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE) |
| 248 | |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame^] | 249 | ifndef HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 250 | HAS_BUILD_NUMBER := false |
| 251 | endif |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame^] | 252 | .KATI_READONLY := HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 253 | |
| 254 | ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |
| 255 | # Used to set minimum supported target sdk version. Apps targeting sdk |
| 256 | # version lower than the set value will result in a warning being shown |
| 257 | # when any activity from the app is started. |
Joseph Jang | cc1f5e4 | 2022-01-26 03:15:15 +0000 | [diff] [blame] | 258 | PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23 |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 259 | endif |
| 260 | .KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |