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 | |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 17 | |
| 18 | # |
| 19 | # Handle various build version information. |
| 20 | # |
| 21 | # Guarantees that the following are defined: |
| 22 | # PLATFORM_VERSION |
| 23 | # PLATFORM_DISPLAY_VERSION |
| 24 | # PLATFORM_SDK_VERSION |
| 25 | # PLATFORM_SDK_EXTENSION_VERSION |
| 26 | # PLATFORM_VERSION_CODENAME |
| 27 | # DEFAULT_APP_TARGET_SDK |
| 28 | # BUILD_ID |
| 29 | # BUILD_NUMBER |
| 30 | # PLATFORM_SECURITY_PATCH |
| 31 | # PLATFORM_VNDK_VERSION |
| 32 | # PLATFORM_SYSTEMSDK_VERSIONS |
| 33 | # PLATFORM_VERSION_LAST_STABLE |
| 34 | # |
| 35 | |
| 36 | # Look for an optional file containing overrides of the defaults, |
| 37 | # but don't cry if we don't find it. We could just use -include, but |
| 38 | # the build.prop target also wants INTERNAL_BUILD_ID_MAKEFILE to be set |
| 39 | # if the file exists. |
| 40 | # |
| 41 | INTERNAL_BUILD_ID_MAKEFILE := $(wildcard $(BUILD_SYSTEM)/build_id.mk) |
| 42 | ifdef INTERNAL_BUILD_ID_MAKEFILE |
| 43 | include $(INTERNAL_BUILD_ID_MAKEFILE) |
| 44 | endif |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 45 | |
Joe Onorato | 6d7afa0 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 46 | ifdef TARGET_PLATFORM_VERSION |
| 47 | $(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] | 48 | endif |
Joe Onorato | 6d7afa0 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 49 | TARGET_PLATFORM_VERSION := $(RELEASE_PLATFORM_VERSION) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 50 | .KATI_READONLY := TARGET_PLATFORM_VERSION |
| 51 | |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 52 | ifdef PLATFORM_SECURITY_PATCH |
| 53 | $(error Do not set PLATFORM_SECURITY_PATCH directly. Use RELEASE_PLATFORM_SECURITY_PATCH. value: $(PLATFORM_SECURITY_PATCH)) |
Joe Onorato | 89f17ef | 2023-07-14 14:16:11 -0700 | [diff] [blame] | 54 | endif |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 55 | PLATFORM_SECURITY_PATCH := $(RELEASE_PLATFORM_SECURITY_PATCH) |
| 56 | .KATI_READONLY := PLATFORM_SECURITY_PATCH |
Joe Onorato | 89f17ef | 2023-07-14 14:16:11 -0700 | [diff] [blame] | 57 | |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 58 | ifdef PLATFORM_SDK_VERSION |
| 59 | $(error Do not set PLATFORM_SDK_VERSION directly. Use RELEASE_PLATFORM_SDK_VERSION. value: $(PLATFORM_SDK_VERSION)) |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 60 | endif |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 61 | PLATFORM_SDK_VERSION := $(RELEASE_PLATFORM_SDK_VERSION) |
| 62 | .KATI_READONLY := PLATFORM_SDK_VERSION |
Sebastian Ene | 573fbcd | 2022-04-27 09:32:39 +0000 | [diff] [blame] | 63 | |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 64 | ifdef PLATFORM_SDK_EXTENSION_VERSION |
| 65 | $(error Do not set PLATFORM_SDK_EXTENSION_VERSION directly. Use RELEASE_PLATFORM_SDK_EXTENSION_VERSION. value: $(PLATFORM_SDK_EXTENSION_VERSION)) |
satayev | 2d94586 | 2022-02-09 21:59:28 +0000 | [diff] [blame] | 66 | endif |
Jeff Hamilton | 426a9f8 | 2023-10-19 04:54:15 +0000 | [diff] [blame^] | 67 | PLATFORM_SDK_EXTENSION_VERSION := $(RELEASE_PLATFORM_SDK_EXTENSION_VERSION) |
| 68 | .KATI_READONLY := PLATFORM_SDK_EXTENSION_VERSION |
| 69 | |
| 70 | # This is the sdk extension version that PLATFORM_SDK_VERSION ships with. |
| 71 | PLATFORM_BASE_SDK_EXTENSION_VERSION := $(PLATFORM_SDK_EXTENSION_VERSION) |
| 72 | .KATI_READONLY := PLATFORM_BASE_SDK_EXTENSION_VERSION |
| 73 | |
| 74 | ifdef PLATFORM_VERSION_CODENAME |
| 75 | $(error Do not set PLATFORM_VERSION_CODENAME directly. Use RELEASE_PLATFORM_VERSION. value: $(PLATFORM_VERSION_CODENAME)) |
| 76 | endif |
| 77 | PLATFORM_VERSION_CODENAME := $(RELEASE_PLATFORM_VERSION_CODENAME) |
| 78 | .KATI_READONLY := PLATFORM_VERSION_CODENAME |
| 79 | |
| 80 | ifdef PLATFORM_VERSION_ALL_CODENAMES |
| 81 | $(error Do not set PLATFORM_VERSION_ALL_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_CODENAMES. value: $(PLATFORM_VERSION_ALL_CODENAMES)) |
| 82 | endif |
| 83 | PLATFORM_VERSION_ALL_CODENAMES := $(RELEASE_PLATFORM_VERSION_ALL_CODENAMES) |
| 84 | .KATI_READONLY := PLATFORM_VERSION_ALL_CODENAMES |
| 85 | |
| 86 | ifdef PLATFORM_VERSION_ALL_PREVIEW_CODENAMES |
| 87 | $(error Do not set PLATFORM_VERSION_ALL_PREVIEW_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES. value: $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)) |
| 88 | endif |
| 89 | PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := $(RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES) |
| 90 | .KATI_READONLY := PLATFORM_VERSION_ALL_PREVIEW_CODENAMES |
| 91 | |
| 92 | ifdef PLATFORM_VERSION_LAST_STABLE |
| 93 | $(error Do not set PLATFORM_VERSION_LAST_STABLE directly. Use RELEASE_PLATFORM_VERSION_LAST_STABLE. value: $(PLATFORM_VERSION_CODENAME)) |
| 94 | endif |
| 95 | PLATFORM_VERSION_LAST_STABLE := $(RELEASE_PLATFORM_VERSION_LAST_STABLE) |
| 96 | .KATI_READONLY := PLATFORM_VERSION_LAST_STABLE |
| 97 | |
| 98 | |
| 99 | # This are all known codenames. Should this move into the release config? |
| 100 | PLATFORM_VERSION_KNOWN_CODENAMES := \ |
| 101 | Base Base11 Cupcake Donut Eclair Eclair01 EclairMr1 Froyo Gingerbread GingerbreadMr1 \ |
| 102 | Honeycomb HoneycombMr1 HoneycombMr2 IceCreamSandwich IceCreamSandwichMr1 \ |
| 103 | JellyBean JellyBeanMr1 JellyBeanMr2 Kitkat KitkatWatch Lollipop LollipopMr1 M N NMr1 O OMr1 P \ |
| 104 | Q R S Sv2 Tiramisu UpsideDownCake VanillaIceCream |
| 105 | |
| 106 | # Convert from space separated list to comma separated |
| 107 | PLATFORM_VERSION_KNOWN_CODENAMES := \ |
| 108 | $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES)) |
| 109 | .KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES |
satayev | 2d94586 | 2022-02-09 21:59:28 +0000 | [diff] [blame] | 110 | |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 111 | ifndef PLATFORM_VERSION |
| 112 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 113 | PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE) |
| 114 | else |
| 115 | PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 116 | endif |
| 117 | endif |
| 118 | .KATI_READONLY := PLATFORM_VERSION |
| 119 | |
Colin Cross | a492544 | 2022-02-28 18:01:35 -0800 | [diff] [blame] | 120 | ifndef PLATFORM_DISPLAY_VERSION |
| 121 | PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION) |
| 122 | endif |
| 123 | .KATI_READONLY := PLATFORM_DISPLAY_VERSION |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 124 | |
| 125 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 126 | PLATFORM_PREVIEW_SDK_VERSION := 0 |
| 127 | else |
| 128 | ifndef PLATFORM_PREVIEW_SDK_VERSION |
| 129 | # This is the definition of a preview SDK version over and above the current |
| 130 | # platform SDK version. Unlike the platform SDK version, a higher value |
| 131 | # for preview SDK version does NOT mean that all prior preview APIs are |
| 132 | # included. Packages reading this value to determine compatibility with |
| 133 | # known APIs should check that this value is precisely equal to the preview |
| 134 | # SDK version the package was built for, otherwise it should fall back to |
| 135 | # assuming the device can only support APIs as of the previous official |
| 136 | # public release. |
| 137 | # This value will always be forced to 0 for release builds by the logic |
| 138 | # in the "ifeq" block above, so the value below will be used on any |
| 139 | # non-release builds, and it should always be at least 1, to indicate that |
| 140 | # APIs may have changed since the claimed PLATFORM_SDK_VERSION. |
| 141 | PLATFORM_PREVIEW_SDK_VERSION := 1 |
| 142 | endif |
| 143 | endif |
| 144 | .KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION |
| 145 | |
| 146 | ifndef DEFAULT_APP_TARGET_SDK |
| 147 | # This is the default minSdkVersion and targetSdkVersion to use for |
| 148 | # all .apks created by the build system. It can be overridden by explicitly |
| 149 | # setting these in the .apk's AndroidManifest.xml. It is either the code |
| 150 | # name of the development build or, if this is a release build, the official |
| 151 | # SDK version of this release. |
| 152 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 153 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION) |
| 154 | else |
| 155 | DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME) |
| 156 | endif |
| 157 | endif |
| 158 | .KATI_READONLY := DEFAULT_APP_TARGET_SDK |
| 159 | |
| 160 | ifndef PLATFORM_VNDK_VERSION |
| 161 | # 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] | 162 | # With trunk stable, VNDK will not be frozen but deprecated. |
| 163 | # This version will be removed with the VNDK deprecation. |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 164 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
Justin Yun | e952590 | 2023-09-12 16:13:37 +0900 | [diff] [blame] | 165 | ifdef RELEASE_PLATFORM_VNDK_VERSION |
| 166 | PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION) |
| 167 | else |
| 168 | PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION) |
| 169 | endif |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 170 | else |
| 171 | PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME) |
| 172 | endif |
| 173 | endif |
| 174 | .KATI_READONLY := PLATFORM_VNDK_VERSION |
| 175 | |
| 176 | ifndef PLATFORM_SYSTEMSDK_MIN_VERSION |
| 177 | # This is the oldest version of system SDK that the platform supports. Contrary |
| 178 | # to the public SDK where platform essentially supports all previous SDK versions, |
| 179 | # platform supports only a few number of recent system SDK versions as some of |
| 180 | # old system APIs are gradually deprecated, removed and then deleted. |
Nick Kovacs | 2092c97 | 2022-08-08 18:44:42 +0000 | [diff] [blame] | 181 | PLATFORM_SYSTEMSDK_MIN_VERSION := 29 |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 182 | endif |
| 183 | .KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION |
| 184 | |
| 185 | # This is the list of system SDK versions that the current platform supports. |
| 186 | PLATFORM_SYSTEMSDK_VERSIONS := |
| 187 | ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION)) |
| 188 | $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\ |
| 189 | $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION))) |
| 190 | PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION)) |
| 191 | endif |
| 192 | # Platform always supports the current version |
| 193 | ifeq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 194 | PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION) |
| 195 | else |
| 196 | PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES)) |
| 197 | endif |
| 198 | PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS))) |
| 199 | .KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS |
| 200 | |
| 201 | .KATI_READONLY := PLATFORM_SECURITY_PATCH |
| 202 | |
| 203 | ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 204 | # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH. |
| 205 | PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s) |
| 206 | endif |
| 207 | .KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP |
| 208 | |
| 209 | ifndef PLATFORM_BASE_OS |
| 210 | # Used to indicate the base os applied to the device. |
| 211 | # Can be an arbitrary string, but must be a single word. |
| 212 | # |
| 213 | # If there is no $PLATFORM_BASE_OS set, keep it empty. |
| 214 | PLATFORM_BASE_OS := |
| 215 | endif |
| 216 | .KATI_READONLY := PLATFORM_BASE_OS |
| 217 | |
| 218 | ifndef BUILD_ID |
| 219 | # Used to signify special builds. E.g., branches and/or releases, |
| 220 | # like "M5-RC7". Can be an arbitrary string, but must be a single |
| 221 | # word and a valid file name. |
| 222 | # |
| 223 | # If there is no BUILD_ID set, make it obvious. |
| 224 | BUILD_ID := UNKNOWN |
| 225 | endif |
| 226 | .KATI_READONLY := BUILD_ID |
| 227 | |
| 228 | ifndef BUILD_DATETIME |
| 229 | # Used to reproduce builds by setting the same time. Must be the number |
| 230 | # of seconds since the Epoch. |
| 231 | BUILD_DATETIME := $(shell date +%s) |
| 232 | endif |
| 233 | |
| 234 | DATE := date -d @$(BUILD_DATETIME) |
| 235 | .KATI_READONLY := DATE |
| 236 | |
| 237 | # Everything should be using BUILD_DATETIME_FROM_FILE instead. |
| 238 | # BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves |
| 239 | # to soong_ui. |
| 240 | $(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE) |
| 241 | |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 242 | ifndef HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 243 | HAS_BUILD_NUMBER := false |
| 244 | endif |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 245 | .KATI_READONLY := HAS_BUILD_NUMBER |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 246 | |
| 247 | ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |
| 248 | # Used to set minimum supported target sdk version. Apps targeting sdk |
| 249 | # version lower than the set value will result in a warning being shown |
| 250 | # when any activity from the app is started. |
Nick Kovacs | 67ebe09 | 2022-08-05 19:32:08 +0000 | [diff] [blame] | 251 | PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 28 |
Sasha Smundak | 1335903 | 2021-09-12 17:09:01 -0700 | [diff] [blame] | 252 | endif |
| 253 | .KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION |