blob: 457f0f704ac069b448b9eeec554499a9732d54ed [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)))\
86 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
87 $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
88
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.
95PLATFORM_VERSION_ALL_PREVIEW_CODENAMES :=
96$(foreach version,$(ALL_VERSIONS),\
97 $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
98 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\
99 $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename))))
100
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000101# And convert from space separated to comma separated.
102PLATFORM_VERSION_ALL_CODENAMES := \
103 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
Dan Albert4d24cbd2023-03-27 20:30:55 +0000104PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \
105 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)))
Sebastian Ene573fbcd2022-04-27 09:32:39 +0000106
Sasha Smundak13359032021-09-12 17:09:01 -0700107.KATI_READONLY := \
108 PLATFORM_VERSION_CODENAME \
Dan Albert4d24cbd2023-03-27 20:30:55 +0000109 PLATFORM_VERSION_ALL_CODENAMES \
110 PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \
Sasha Smundak13359032021-09-12 17:09:01 -0700111
satayev2d945862022-02-09 21:59:28 +0000112ifneq (REL,$(PLATFORM_VERSION_CODENAME))
113 codenames := \
114 $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES)))
115 ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),)
116 $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \
117 Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES)
118 endif
119endif
120
Sasha Smundak13359032021-09-12 17:09:01 -0700121ifndef PLATFORM_VERSION
122 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
123 PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
124 else
125 PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME)
126 endif
127endif
128.KATI_READONLY := PLATFORM_VERSION
129
Colin Crossa4925442022-02-28 18:01:35 -0800130ifndef PLATFORM_DISPLAY_VERSION
131 PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION)
132endif
133.KATI_READONLY := PLATFORM_DISPLAY_VERSION
Sasha Smundak13359032021-09-12 17:09:01 -0700134
135ifeq (REL,$(PLATFORM_VERSION_CODENAME))
136 PLATFORM_PREVIEW_SDK_VERSION := 0
137else
138 ifndef PLATFORM_PREVIEW_SDK_VERSION
139 # This is the definition of a preview SDK version over and above the current
140 # platform SDK version. Unlike the platform SDK version, a higher value
141 # for preview SDK version does NOT mean that all prior preview APIs are
142 # included. Packages reading this value to determine compatibility with
143 # known APIs should check that this value is precisely equal to the preview
144 # SDK version the package was built for, otherwise it should fall back to
145 # assuming the device can only support APIs as of the previous official
146 # public release.
147 # This value will always be forced to 0 for release builds by the logic
148 # in the "ifeq" block above, so the value below will be used on any
149 # non-release builds, and it should always be at least 1, to indicate that
150 # APIs may have changed since the claimed PLATFORM_SDK_VERSION.
151 PLATFORM_PREVIEW_SDK_VERSION := 1
152 endif
153endif
154.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
155
156ifndef DEFAULT_APP_TARGET_SDK
157 # This is the default minSdkVersion and targetSdkVersion to use for
158 # all .apks created by the build system. It can be overridden by explicitly
159 # setting these in the .apk's AndroidManifest.xml. It is either the code
160 # name of the development build or, if this is a release build, the official
161 # SDK version of this release.
162 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
163 DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
164 else
165 DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
166 endif
167endif
168.KATI_READONLY := DEFAULT_APP_TARGET_SDK
169
170ifndef PLATFORM_VNDK_VERSION
171 # This is the definition of the VNDK version for the current VNDK libraries.
172 # The version is only available when PLATFORM_VERSION_CODENAME == REL.
173 # Otherwise, it will be set to a CODENAME version. The ABI is allowed to be
174 # changed only before the Android version is released. Once
175 # PLATFORM_VNDK_VERSION is set to actual version, the ABI for this version
176 # will be frozon and emit build errors if any ABI for the VNDK libs are
177 # changed.
178 # After that the snapshot of the VNDK with this version will be generated.
179 #
180 # The VNDK version follows PLATFORM_SDK_VERSION.
181 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
182 PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
183 else
184 PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
185 endif
186endif
187.KATI_READONLY := PLATFORM_VNDK_VERSION
188
189ifndef PLATFORM_SYSTEMSDK_MIN_VERSION
190 # This is the oldest version of system SDK that the platform supports. Contrary
191 # to the public SDK where platform essentially supports all previous SDK versions,
192 # platform supports only a few number of recent system SDK versions as some of
193 # old system APIs are gradually deprecated, removed and then deleted.
194 PLATFORM_SYSTEMSDK_MIN_VERSION := 28
195endif
196.KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION
197
198# This is the list of system SDK versions that the current platform supports.
199PLATFORM_SYSTEMSDK_VERSIONS :=
200ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION))
201 $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\
202 $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION)))
203 PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION))
204endif
205# Platform always supports the current version
206ifeq (REL,$(PLATFORM_VERSION_CODENAME))
207 PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION)
208else
209 PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES))
210endif
211PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS)))
212.KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS
213
214.KATI_READONLY := PLATFORM_SECURITY_PATCH
215
216ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP
217 # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
218 PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
219endif
220.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
221
222ifndef PLATFORM_BASE_OS
223 # Used to indicate the base os applied to the device.
224 # Can be an arbitrary string, but must be a single word.
225 #
226 # If there is no $PLATFORM_BASE_OS set, keep it empty.
227 PLATFORM_BASE_OS :=
228endif
229.KATI_READONLY := PLATFORM_BASE_OS
230
231ifndef BUILD_ID
232 # Used to signify special builds. E.g., branches and/or releases,
233 # like "M5-RC7". Can be an arbitrary string, but must be a single
234 # word and a valid file name.
235 #
236 # If there is no BUILD_ID set, make it obvious.
237 BUILD_ID := UNKNOWN
238endif
239.KATI_READONLY := BUILD_ID
240
241ifndef BUILD_DATETIME
242 # Used to reproduce builds by setting the same time. Must be the number
243 # of seconds since the Epoch.
244 BUILD_DATETIME := $(shell date +%s)
245endif
246
247DATE := date -d @$(BUILD_DATETIME)
248.KATI_READONLY := DATE
249
250# Everything should be using BUILD_DATETIME_FROM_FILE instead.
251# BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
252# to soong_ui.
253$(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE)
254
Jeongik Cha05210f92023-04-27 11:05:22 +0900255ifndef HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700256 HAS_BUILD_NUMBER := false
257endif
Jeongik Cha05210f92023-04-27 11:05:22 +0900258.KATI_READONLY := HAS_BUILD_NUMBER
Sasha Smundak13359032021-09-12 17:09:01 -0700259
260ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION
261 # Used to set minimum supported target sdk version. Apps targeting sdk
262 # version lower than the set value will result in a warning being shown
263 # when any activity from the app is started.
Joseph Jangcc1f5e42022-01-26 03:15:15 +0000264 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23
Sasha Smundak13359032021-09-12 17:09:01 -0700265endif
266.KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION