blob: f08b2f94c74d32a0acbd70c353923bd1dc166948 [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).
Dan Albert5346f7d2023-10-04 23:03:13 +000082#
83# REL is filtered out of the list. The codename of the current release is
84# replaced by "REL" when the build is configured as a release rather than a
85# preview. For example, PLATFORM_VERSION_CODENAME.UpsideDownCake will be "REL"
86# rather than UpsideDownCake in a -next target when the upcoming release is
87# UpsideDownCake. "REL" shouldn't really be treated as a codename though. It's a
88# placeholder to indicate that the build is a release and so doesn't really have
89# a codename. The list of all codenames ends up in
90# ro.build.version.all_codenames, and also ends up feeding the logic for stub
91# generation in soong, neither of which are places that should include REL.
Sebastian Ene573fbcd2022-04-27 09:32:39 +000092_versions_in_target := \
93 $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
94$(foreach version,$(_versions_in_target),\
95 $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
Dan Albert5346f7d2023-10-04 23:03:13 +000096 $(if $(filter REL,$(_codename)),,\
97 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
98 $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename)))))
Sebastian Ene573fbcd2022-04-27 09:32:39 +000099
Dan Albert4d24cbd2023-03-27 20:30:55 +0000100# And the list of actually all the codenames that are in preview. The
101# ALL_CODENAMES variable is sort of a lie for historical reasons and only
102# includes codenames up to and including the currently active codename, whereas
103# this variable also includes future codenames. For example, while AOSP is still
104# merging into U, but V development has started, ALL_CODENAMES will only be U,
105# but ALL_PREVIEW_CODENAMES will be U and V.
106PLATFORM_VERSION_ALL_PREVIEW_CODENAMES :=
107$(foreach version,$(ALL_VERSIONS),\
108 $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
109 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\
110 $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename))))
111
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000112# And convert from space separated to comma separated.
113PLATFORM_VERSION_ALL_CODENAMES := \
114 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
Dan Albert4d24cbd2023-03-27 20:30:55 +0000115PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \
116 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)))
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000117
Sasha Smundak13359032021-09-12 17:09:01 -0700118.KATI_READONLY := \
119 PLATFORM_VERSION_CODENAME \
Dan Albert4d24cbd2023-03-27 20:30:55 +0000120 PLATFORM_VERSION_ALL_CODENAMES \
121 PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \
Sasha Smundak13359032021-09-12 17:09:01 -0700122
satayev2d945862022-02-09 21:59:28 +0000123ifneq (REL,$(PLATFORM_VERSION_CODENAME))
124 codenames := \
125 $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES)))
126 ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),)
127 $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \
128 Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES)
129 endif
130endif
131
Sasha Smundak13359032021-09-12 17:09:01 -0700132ifndef PLATFORM_VERSION
133 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
134 PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
135 else
136 PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME)
137 endif
138endif
139.KATI_READONLY := PLATFORM_VERSION
140
Colin Crossa4925442022-02-28 18:01:35 -0800141ifndef PLATFORM_DISPLAY_VERSION
142 PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION)
143endif
144.KATI_READONLY := PLATFORM_DISPLAY_VERSION
Sasha Smundak13359032021-09-12 17:09:01 -0700145
146ifeq (REL,$(PLATFORM_VERSION_CODENAME))
147 PLATFORM_PREVIEW_SDK_VERSION := 0
148else
149 ifndef PLATFORM_PREVIEW_SDK_VERSION
150 # This is the definition of a preview SDK version over and above the current
151 # platform SDK version. Unlike the platform SDK version, a higher value
152 # for preview SDK version does NOT mean that all prior preview APIs are
153 # included. Packages reading this value to determine compatibility with
154 # known APIs should check that this value is precisely equal to the preview
155 # SDK version the package was built for, otherwise it should fall back to
156 # assuming the device can only support APIs as of the previous official
157 # public release.
158 # This value will always be forced to 0 for release builds by the logic
159 # in the "ifeq" block above, so the value below will be used on any
160 # non-release builds, and it should always be at least 1, to indicate that
161 # APIs may have changed since the claimed PLATFORM_SDK_VERSION.
162 PLATFORM_PREVIEW_SDK_VERSION := 1
163 endif
164endif
165.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
166
167ifndef DEFAULT_APP_TARGET_SDK
168 # This is the default minSdkVersion and targetSdkVersion to use for
169 # all .apks created by the build system. It can be overridden by explicitly
170 # setting these in the .apk's AndroidManifest.xml. It is either the code
171 # name of the development build or, if this is a release build, the official
172 # SDK version of this release.
173 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
174 DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
175 else
176 DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
177 endif
178endif
179.KATI_READONLY := DEFAULT_APP_TARGET_SDK
180
181ifndef PLATFORM_VNDK_VERSION
182 # This is the definition of the VNDK version for the current VNDK libraries.
Justin Yune9525902023-09-12 16:13:37 +0900183 # With trunk stable, VNDK will not be frozen but deprecated.
184 # This version will be removed with the VNDK deprecation.
Sasha Smundak13359032021-09-12 17:09:01 -0700185 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
Justin Yune9525902023-09-12 16:13:37 +0900186 ifdef RELEASE_PLATFORM_VNDK_VERSION
187 PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION)
188 else
189 PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
190 endif
Sasha Smundak13359032021-09-12 17:09:01 -0700191 else
192 PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
193 endif
194endif
195.KATI_READONLY := PLATFORM_VNDK_VERSION
196
197ifndef PLATFORM_SYSTEMSDK_MIN_VERSION
198 # This is the oldest version of system SDK that the platform supports. Contrary
199 # to the public SDK where platform essentially supports all previous SDK versions,
200 # platform supports only a few number of recent system SDK versions as some of
201 # old system APIs are gradually deprecated, removed and then deleted.
202 PLATFORM_SYSTEMSDK_MIN_VERSION := 28
203endif
204.KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION
205
206# This is the list of system SDK versions that the current platform supports.
207PLATFORM_SYSTEMSDK_VERSIONS :=
208ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION))
209 $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\
210 $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION)))
211 PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION))
212endif
213# Platform always supports the current version
214ifeq (REL,$(PLATFORM_VERSION_CODENAME))
215 PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION)
216else
217 PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES))
218endif
219PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS)))
220.KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS
221
222.KATI_READONLY := PLATFORM_SECURITY_PATCH
223
224ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP
225 # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
226 PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
227endif
228.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
229
230ifndef PLATFORM_BASE_OS
231 # Used to indicate the base os applied to the device.
232 # Can be an arbitrary string, but must be a single word.
233 #
234 # If there is no $PLATFORM_BASE_OS set, keep it empty.
235 PLATFORM_BASE_OS :=
236endif
237.KATI_READONLY := PLATFORM_BASE_OS
238
239ifndef BUILD_ID
240 # Used to signify special builds. E.g., branches and/or releases,
241 # like "M5-RC7". Can be an arbitrary string, but must be a single
242 # word and a valid file name.
243 #
244 # If there is no BUILD_ID set, make it obvious.
245 BUILD_ID := UNKNOWN
246endif
247.KATI_READONLY := BUILD_ID
248
249ifndef BUILD_DATETIME
250 # Used to reproduce builds by setting the same time. Must be the number
251 # of seconds since the Epoch.
252 BUILD_DATETIME := $(shell date +%s)
253endif
254
255DATE := date -d @$(BUILD_DATETIME)
256.KATI_READONLY := DATE
257
258# Everything should be using BUILD_DATETIME_FROM_FILE instead.
259# BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
260# to soong_ui.
261$(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE)
262
Jeongik Cha05210f92023-04-27 11:05:22 +0900263ifndef HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700264 HAS_BUILD_NUMBER := false
265endif
Jeongik Cha05210f92023-04-27 11:05:22 +0900266.KATI_READONLY := HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700267
268ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION
269 # Used to set minimum supported target sdk version. Apps targeting sdk
270 # version lower than the set value will result in a warning being shown
271 # when any activity from the app is started.
Joseph Jangcc1f5e42022-01-26 03:15:15 +0000272 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23
Sasha Smundak13359032021-09-12 17:09:01 -0700273endif
274.KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION