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 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 17 | ALLOWED_VERSIONS := $(call allowed-platform-versions,\ |
| 18 | $(MIN_PLATFORM_VERSION),\ |
| 19 | $(MAX_PLATFORM_VERSION),\ |
Joe Onorato | 6d7afa0 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 20 | $(RELEASE_PLATFORM_VERSION)) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 21 | |
Joe Onorato | 6d7afa0 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 22 | ifdef TARGET_PLATFORM_VERSION |
| 23 | $(error Do not set TARGET_PLATFORM_VERSION directly. Use RELEASE_PLATFORM_VERSION. value: $(TARGET_PLATFORM_VERSION)) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 24 | endif |
| 25 | |
Joe Onorato | 6d7afa0 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 26 | TARGET_PLATFORM_VERSION := $(RELEASE_PLATFORM_VERSION) |
| 27 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 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 | |
Joe Onorato | 89f17ef | 2023-07-14 14:16:11 -0700 | [diff] [blame] | 59 | # Release config flag to override the current version to REL. Note that the |
| 60 | # codename can also be locked to REL by setting it in versino_defaults.mk. |
| 61 | ifneq ($(RELEASE_PLATFORM_VERSION_CODENAME_REL),) |
| 62 | PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION) := REL |
| 63 | endif |
| 64 | |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 65 | PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION)) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 66 | ifndef PLATFORM_VERSION_CODENAME |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 67 | # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION |
| 68 | PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 69 | endif |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 70 | |
| 71 | # This is all of the *active* development codenames. |
| 72 | # This confusing name is needed because |
| 73 | # all_codenames has been baked into build.prop for ages. |
| 74 | # |
| 75 | # Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated |
| 76 | # list of additional codenames after PLATFORM_VERSION_CODENAME. |
| 77 | PLATFORM_VERSION_ALL_CODENAMES := |
| 78 | |
| 79 | # Build a list of all active code names. Avoid duplicates, and stop when we |
| 80 | # reach a codename that matches PLATFORM_VERSION_CODENAME (anything beyond |
| 81 | # that is not included in our build). |
| 82 | _versions_in_target := \ |
| 83 | $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION)) |
| 84 | $(foreach version,$(_versions_in_target),\ |
| 85 | $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\ |
Dan Shi | d637190 | 2023-10-05 06:07:52 +0000 | [diff] [blame] | 86 | $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\ |
| 87 | $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename)))) |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 88 | |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 89 | # And the list of actually all the codenames that are in preview. The |
| 90 | # ALL_CODENAMES variable is sort of a lie for historical reasons and only |
| 91 | # includes codenames up to and including the currently active codename, whereas |
| 92 | # this variable also includes future codenames. For example, while AOSP is still |
| 93 | # merging into U, but V development has started, ALL_CODENAMES will only be U, |
| 94 | # but ALL_PREVIEW_CODENAMES will be U and V. |
Dan Albert | 2610a32 | 2023-10-05 20:23:55 +0000 | [diff] [blame] | 95 | # |
| 96 | # REL is filtered out of the list. The codename of the current release is |
| 97 | # replaced by "REL" when the build is configured as a release rather than a |
| 98 | # preview. For example, PLATFORM_VERSION_CODENAME.UpsideDownCake will be "REL" |
| 99 | # rather than UpsideDownCake in a -next target when the upcoming release is |
| 100 | # UpsideDownCake. "REL" is a codename (and android.os.Build relies on this: |
| 101 | # https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/os/Build.java;l=484-487;drc=316e3d16c9f34212f3beace7695289651d15a071), |
| 102 | # so it should be in PLATFORM_VERSION_ALL_CODENAMES, but it definitely is not a |
| 103 | # preview codename. |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 104 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := |
| 105 | $(foreach version,$(ALL_VERSIONS),\ |
| 106 | $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\ |
Dan Albert | 2610a32 | 2023-10-05 20:23:55 +0000 | [diff] [blame] | 107 | $(if $(filter REL,$(_codename)),,\ |
| 108 | $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\ |
| 109 | $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename))))) |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 110 | |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 111 | # And convert from space separated to comma separated. |
| 112 | PLATFORM_VERSION_ALL_CODENAMES := \ |
| 113 | $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES))) |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 114 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \ |
| 115 | $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES))) |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 116 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 117 | .KATI_READONLY := \ |
| 118 | PLATFORM_VERSION_CODENAME \ |
Dan Albert | 4d24cbd | 2023-03-27 20:30:55 +0000 | [diff] [blame] | 119 | PLATFORM_VERSION_ALL_CODENAMES \ |
| 120 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \ |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 121 | |
satayev | 2d94586 | 2022-02-09 21:59:28 +0000 | [diff] [blame] | 122 | ifneq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 123 | codenames := \ |
| 124 | $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES))) |
| 125 | ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),) |
| 126 | $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \ |
| 127 | Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES) |
| 128 | endif |
| 129 | endif |
| 130 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 131 | ifndef PLATFORM_VERSION |
| 132 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 133 | PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE) |
| 134 | else |
| 135 | PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 136 | endif |
| 137 | endif |
| 138 | .KATI_READONLY := PLATFORM_VERSION |
| 139 | |
Colin Cross | a492544 | 2022-02-28 18:01:35 -0800 | [diff] [blame] | 140 | ifndef PLATFORM_DISPLAY_VERSION |
| 141 | PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION) |
| 142 | endif |
| 143 | .KATI_READONLY := PLATFORM_DISPLAY_VERSION |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 144 | |
| 145 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 146 | PLATFORM_PREVIEW_SDK_VERSION := 0 |
| 147 | else |
| 148 | ifndef PLATFORM_PREVIEW_SDK_VERSION |
| 149 | # This is the definition of a preview SDK version over and above the current |
| 150 | # platform SDK version. Unlike the platform SDK version, a higher value |
| 151 | # for preview SDK version does NOT mean that all prior preview APIs are |
| 152 | # included. Packages reading this value to determine compatibility with |
| 153 | # known APIs should check that this value is precisely equal to the preview |
| 154 | # SDK version the package was built for, otherwise it should fall back to |
| 155 | # assuming the device can only support APIs as of the previous official |
| 156 | # public release. |
| 157 | # This value will always be forced to 0 for release builds by the logic |
| 158 | # in the "ifeq" block above, so the value below will be used on any |
| 159 | # non-release builds, and it should always be at least 1, to indicate that |
| 160 | # APIs may have changed since the claimed PLATFORM_SDK_VERSION. |
| 161 | PLATFORM_PREVIEW_SDK_VERSION := 1 |
| 162 | endif |
| 163 | endif |
| 164 | .KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION |
| 165 | |
| 166 | ifndef DEFAULT_APP_TARGET_SDK |
| 167 | # This is the default minSdkVersion and targetSdkVersion to use for |
| 168 | # all .apks created by the build system. It can be overridden by explicitly |
| 169 | # setting these in the .apk's AndroidManifest.xml. It is either the code |
| 170 | # name of the development build or, if this is a release build, the official |
| 171 | # SDK version of this release. |
| 172 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 173 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION) |
| 174 | else |
| 175 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME) |
| 176 | endif |
| 177 | endif |
| 178 | .KATI_READONLY := DEFAULT_APP_TARGET_SDK |
| 179 | |
| 180 | ifndef PLATFORM_VNDK_VERSION |
| 181 | # This is the definition of the VNDK version for the current VNDK libraries. |
Justin Yun | e952590 | 2023-09-12 16:13:37 +0900 | [diff] [blame] | 182 | # With trunk stable, VNDK will not be frozen but deprecated. |
| 183 | # This version will be removed with the VNDK deprecation. |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 184 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
Justin Yun | e952590 | 2023-09-12 16:13:37 +0900 | [diff] [blame] | 185 | ifdef RELEASE_PLATFORM_VNDK_VERSION |
| 186 | PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION) |
| 187 | else |
| 188 | PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION) |
| 189 | endif |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 190 | else |
| 191 | PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 192 | endif |
| 193 | endif |
| 194 | .KATI_READONLY := PLATFORM_VNDK_VERSION |
| 195 | |
| 196 | ifndef PLATFORM_SYSTEMSDK_MIN_VERSION |
| 197 | # This is the oldest version of system SDK that the platform supports. Contrary |
| 198 | # to the public SDK where platform essentially supports all previous SDK versions, |
| 199 | # platform supports only a few number of recent system SDK versions as some of |
| 200 | # old system APIs are gradually deprecated, removed and then deleted. |
Nick Kovacs | 2092c97 | 2022-08-08 18:44:42 +0000 | [diff] [blame] | 201 | PLATFORM_SYSTEMSDK_MIN_VERSION := 29 |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 202 | endif |
| 203 | .KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION |
| 204 | |
| 205 | # This is the list of system SDK versions that the current platform supports. |
| 206 | PLATFORM_SYSTEMSDK_VERSIONS := |
| 207 | ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION)) |
| 208 | $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\ |
| 209 | $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION))) |
| 210 | PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION)) |
| 211 | endif |
| 212 | # Platform always supports the current version |
| 213 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 214 | PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION) |
| 215 | else |
| 216 | PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES)) |
| 217 | endif |
| 218 | PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS))) |
| 219 | .KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS |
| 220 | |
| 221 | .KATI_READONLY := PLATFORM_SECURITY_PATCH |
| 222 | |
| 223 | ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 224 | # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH. |
| 225 | PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s) |
| 226 | endif |
| 227 | .KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 228 | |
| 229 | ifndef PLATFORM_BASE_OS |
| 230 | # Used to indicate the base os applied to the device. |
| 231 | # Can be an arbitrary string, but must be a single word. |
| 232 | # |
| 233 | # If there is no $PLATFORM_BASE_OS set, keep it empty. |
| 234 | PLATFORM_BASE_OS := |
| 235 | endif |
| 236 | .KATI_READONLY := PLATFORM_BASE_OS |
| 237 | |
| 238 | ifndef BUILD_ID |
| 239 | # Used to signify special builds. E.g., branches and/or releases, |
| 240 | # like "M5-RC7". Can be an arbitrary string, but must be a single |
| 241 | # word and a valid file name. |
| 242 | # |
| 243 | # If there is no BUILD_ID set, make it obvious. |
| 244 | BUILD_ID := UNKNOWN |
| 245 | endif |
| 246 | .KATI_READONLY := BUILD_ID |
| 247 | |
| 248 | ifndef BUILD_DATETIME |
| 249 | # Used to reproduce builds by setting the same time. Must be the number |
| 250 | # of seconds since the Epoch. |
| 251 | BUILD_DATETIME := $(shell date +%s) |
| 252 | endif |
| 253 | |
| 254 | DATE := date -d @$(BUILD_DATETIME) |
| 255 | .KATI_READONLY := DATE |
| 256 | |
| 257 | # Everything should be using BUILD_DATETIME_FROM_FILE instead. |
| 258 | # BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves |
| 259 | # to soong_ui. |
| 260 | $(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE) |
| 261 | |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 262 | ifndef HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 263 | HAS_BUILD_NUMBER := false |
| 264 | endif |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 265 | .KATI_READONLY := HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 266 | |
| 267 | ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |
| 268 | # Used to set minimum supported target sdk version. Apps targeting sdk |
| 269 | # version lower than the set value will result in a warning being shown |
| 270 | # when any activity from the app is started. |
Nick Kovacs | 67ebe09 | 2022-08-05 19:32:08 +0000 | [diff] [blame] | 271 | PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 28 |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 272 | endif |
| 273 | .KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |