blob: 0cc3442238ed748e8eaecd1d3d6ce25da2aa6987 [file] [log] [blame]
Sasha Smundak13359032021-09-12 17:09:01 -07001#
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 Smundak13359032021-09-12 17:09:01 -070017ALLOWED_VERSIONS := $(call allowed-platform-versions,\
18 $(MIN_PLATFORM_VERSION),\
19 $(MAX_PLATFORM_VERSION),\
Joe Onorato6d7afa02023-06-05 16:43:55 -070020 $(RELEASE_PLATFORM_VERSION))
Sasha Smundak13359032021-09-12 17:09:01 -070021
Joe Onorato6d7afa02023-06-05 16:43:55 -070022ifdef TARGET_PLATFORM_VERSION
23 $(error Do not set TARGET_PLATFORM_VERSION directly. Use RELEASE_PLATFORM_VERSION. value: $(TARGET_PLATFORM_VERSION))
Sasha Smundak13359032021-09-12 17:09:01 -070024endif
25
Joe Onorato6d7afa02023-06-05 16:43:55 -070026TARGET_PLATFORM_VERSION := $(RELEASE_PLATFORM_VERSION)
27
Sasha Smundak13359032021-09-12 17:09:01 -070028ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
29 $(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
30 $(error $(ALLOWED_VERSIONS))
31endif
32ALLOWED_VERSIONS :=
33MIN_PLATFORM_VERSION :=
34MAX_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 Onorato89f17ef2023-07-14 14:16:11 -070059# 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.
61ifneq ($(RELEASE_PLATFORM_VERSION_CODENAME_REL),)
62 PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION) := REL
63endif
64
Sebastian Ene573fbcd2022-04-27 09:32:39 +000065PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
Sasha Smundak13359032021-09-12 17:09:01 -070066ifndef PLATFORM_VERSION_CODENAME
Sebastian Ene573fbcd2022-04-27 09:32:39 +000067 # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION
68 PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
Sasha Smundak13359032021-09-12 17:09:01 -070069endif
Sebastian Ene573fbcd2022-04-27 09:32:39 +000070
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.
77PLATFORM_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 Shid6371902023-10-05 06:07:52 +000086 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
87 $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
Sebastian Ene573fbcd2022-04-27 09:32:39 +000088
Dan Albert4d24cbd2023-03-27 20:30:55 +000089# 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 Albert2610a322023-10-05 20:23:55 +000095#
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 Albert4d24cbd2023-03-27 20:30:55 +0000104PLATFORM_VERSION_ALL_PREVIEW_CODENAMES :=
105$(foreach version,$(ALL_VERSIONS),\
106 $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
Dan Albert2610a322023-10-05 20:23:55 +0000107 $(if $(filter REL,$(_codename)),,\
108 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\
109 $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename)))))
Dan Albert4d24cbd2023-03-27 20:30:55 +0000110
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000111# And convert from space separated to comma separated.
112PLATFORM_VERSION_ALL_CODENAMES := \
113 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
Dan Albert4d24cbd2023-03-27 20:30:55 +0000114PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \
115 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)))
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000116
Sasha Smundak13359032021-09-12 17:09:01 -0700117.KATI_READONLY := \
118 PLATFORM_VERSION_CODENAME \
Dan Albert4d24cbd2023-03-27 20:30:55 +0000119 PLATFORM_VERSION_ALL_CODENAMES \
120 PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \
Sasha Smundak13359032021-09-12 17:09:01 -0700121
satayev2d945862022-02-09 21:59:28 +0000122ifneq (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
129endif
130
Sasha Smundak13359032021-09-12 17:09:01 -0700131ifndef 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
137endif
138.KATI_READONLY := PLATFORM_VERSION
139
Colin Crossa4925442022-02-28 18:01:35 -0800140ifndef PLATFORM_DISPLAY_VERSION
141 PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION)
142endif
143.KATI_READONLY := PLATFORM_DISPLAY_VERSION
Sasha Smundak13359032021-09-12 17:09:01 -0700144
145ifeq (REL,$(PLATFORM_VERSION_CODENAME))
146 PLATFORM_PREVIEW_SDK_VERSION := 0
147else
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
163endif
164.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
165
166ifndef 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
177endif
178.KATI_READONLY := DEFAULT_APP_TARGET_SDK
179
180ifndef PLATFORM_VNDK_VERSION
181 # This is the definition of the VNDK version for the current VNDK libraries.
Justin Yune9525902023-09-12 16:13:37 +0900182 # With trunk stable, VNDK will not be frozen but deprecated.
183 # This version will be removed with the VNDK deprecation.
Sasha Smundak13359032021-09-12 17:09:01 -0700184 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
Justin Yune9525902023-09-12 16:13:37 +0900185 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 Smundak13359032021-09-12 17:09:01 -0700190 else
191 PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
192 endif
193endif
194.KATI_READONLY := PLATFORM_VNDK_VERSION
195
196ifndef 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 Kovacs2092c972022-08-08 18:44:42 +0000201 PLATFORM_SYSTEMSDK_MIN_VERSION := 29
Sasha Smundak13359032021-09-12 17:09:01 -0700202endif
203.KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION
204
205# This is the list of system SDK versions that the current platform supports.
206PLATFORM_SYSTEMSDK_VERSIONS :=
207ifneq (,$(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))
211endif
212# Platform always supports the current version
213ifeq (REL,$(PLATFORM_VERSION_CODENAME))
214 PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION)
215else
216 PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES))
217endif
218PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS)))
219.KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS
220
221.KATI_READONLY := PLATFORM_SECURITY_PATCH
222
223ifndef 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)
226endif
227.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
228
229ifndef 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 :=
235endif
236.KATI_READONLY := PLATFORM_BASE_OS
237
238ifndef 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
245endif
246.KATI_READONLY := BUILD_ID
247
248ifndef 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)
252endif
253
254DATE := 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 Cha05210f92023-04-27 11:05:22 +0900262ifndef HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700263 HAS_BUILD_NUMBER := false
264endif
Jeongik Cha05210f92023-04-27 11:05:22 +0900265.KATI_READONLY := HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700266
267ifndef 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 Kovacs67ebe092022-08-05 19:32:08 +0000271 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 28
Sasha Smundak13359032021-09-12 17:09:01 -0700272endif
273.KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION