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