blob: 3a0d4b586af04d2f73503bdfb5b96e3fbfa844da [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
17#
18
19ALLOWED_VERSIONS := $(call allowed-platform-versions,\
20 $(MIN_PLATFORM_VERSION),\
21 $(MAX_PLATFORM_VERSION),\
22 $(DEFAULT_PLATFORM_VERSION))
23
24ifndef TARGET_PLATFORM_VERSION
25 TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
26endif
27
28ifeq (,$(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
59ifndef PLATFORM_VERSION_CODENAME
60 PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
61 ifndef PLATFORM_VERSION_CODENAME
62 # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION
63 PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
64 endif
65
66 # This is all of the *active* development codenames.
67 # This confusing name is needed because
68 # all_codenames has been baked into build.prop for ages.
69 #
70 # Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated
71 # list of additional codenames after PLATFORM_VERSION_CODENAME.
72 PLATFORM_VERSION_ALL_CODENAMES :=
73
74 # Build a list of all active code names. Avoid duplicates, and stop when we
75 # reach a codename that matches PLATFORM_VERSION_CODENAME (anything beyond
76 # that is not included in our build).
77 _versions_in_target := \
78 $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
79 $(foreach version,$(_versions_in_target),\
80 $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
81 $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
82 $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
83
84 # And convert from space separated to comma separated.
85 PLATFORM_VERSION_ALL_CODENAMES := \
86 $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
87
88endif
89.KATI_READONLY := \
90 PLATFORM_VERSION_CODENAME \
91 PLATFORM_VERSION_ALL_CODENAMES
92
satayev2d945862022-02-09 21:59:28 +000093ifneq (REL,$(PLATFORM_VERSION_CODENAME))
94 codenames := \
95 $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES)))
96 ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),)
97 $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \
98 Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES)
99 endif
100endif
101
Sasha Smundak13359032021-09-12 17:09:01 -0700102ifndef PLATFORM_VERSION
103 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
104 PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
105 else
106 PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME)
107 endif
108endif
109.KATI_READONLY := PLATFORM_VERSION
110
Colin Crossa4925442022-02-28 18:01:35 -0800111ifndef PLATFORM_DISPLAY_VERSION
112 PLATFORM_DISPLAY_VERSION := $(PLATFORM_VERSION)
113endif
114.KATI_READONLY := PLATFORM_DISPLAY_VERSION
Sasha Smundak13359032021-09-12 17:09:01 -0700115
116ifeq (REL,$(PLATFORM_VERSION_CODENAME))
117 PLATFORM_PREVIEW_SDK_VERSION := 0
118else
119 ifndef PLATFORM_PREVIEW_SDK_VERSION
120 # This is the definition of a preview SDK version over and above the current
121 # platform SDK version. Unlike the platform SDK version, a higher value
122 # for preview SDK version does NOT mean that all prior preview APIs are
123 # included. Packages reading this value to determine compatibility with
124 # known APIs should check that this value is precisely equal to the preview
125 # SDK version the package was built for, otherwise it should fall back to
126 # assuming the device can only support APIs as of the previous official
127 # public release.
128 # This value will always be forced to 0 for release builds by the logic
129 # in the "ifeq" block above, so the value below will be used on any
130 # non-release builds, and it should always be at least 1, to indicate that
131 # APIs may have changed since the claimed PLATFORM_SDK_VERSION.
132 PLATFORM_PREVIEW_SDK_VERSION := 1
133 endif
134endif
135.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
136
137ifndef DEFAULT_APP_TARGET_SDK
138 # This is the default minSdkVersion and targetSdkVersion to use for
139 # all .apks created by the build system. It can be overridden by explicitly
140 # setting these in the .apk's AndroidManifest.xml. It is either the code
141 # name of the development build or, if this is a release build, the official
142 # SDK version of this release.
143 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
144 DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
145 else
146 DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
147 endif
148endif
149.KATI_READONLY := DEFAULT_APP_TARGET_SDK
150
151ifndef PLATFORM_VNDK_VERSION
152 # This is the definition of the VNDK version for the current VNDK libraries.
153 # The version is only available when PLATFORM_VERSION_CODENAME == REL.
154 # Otherwise, it will be set to a CODENAME version. The ABI is allowed to be
155 # changed only before the Android version is released. Once
156 # PLATFORM_VNDK_VERSION is set to actual version, the ABI for this version
157 # will be frozon and emit build errors if any ABI for the VNDK libs are
158 # changed.
159 # After that the snapshot of the VNDK with this version will be generated.
160 #
161 # The VNDK version follows PLATFORM_SDK_VERSION.
162 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
163 PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
164 else
165 PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
166 endif
167endif
168.KATI_READONLY := PLATFORM_VNDK_VERSION
169
170ifndef PLATFORM_SYSTEMSDK_MIN_VERSION
171 # This is the oldest version of system SDK that the platform supports. Contrary
172 # to the public SDK where platform essentially supports all previous SDK versions,
173 # platform supports only a few number of recent system SDK versions as some of
174 # old system APIs are gradually deprecated, removed and then deleted.
175 PLATFORM_SYSTEMSDK_MIN_VERSION := 28
176endif
177.KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION
178
179# This is the list of system SDK versions that the current platform supports.
180PLATFORM_SYSTEMSDK_VERSIONS :=
181ifneq (,$(PLATFORM_SYSTEMSDK_MIN_VERSION))
182 $(if $(call math_is_number,$(PLATFORM_SYSTEMSDK_MIN_VERSION)),,\
183 $(error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $(PLATFORM_SYSTEMSDK_MIN_VERSION)))
184 PLATFORM_SYSTEMSDK_VERSIONS := $(call int_range_list,$(PLATFORM_SYSTEMSDK_MIN_VERSION),$(PLATFORM_SDK_VERSION))
185endif
186# Platform always supports the current version
187ifeq (REL,$(PLATFORM_VERSION_CODENAME))
188 PLATFORM_SYSTEMSDK_VERSIONS += $(PLATFORM_SDK_VERSION)
189else
190 PLATFORM_SYSTEMSDK_VERSIONS += $(subst $(comma),$(space),$(PLATFORM_VERSION_ALL_CODENAMES))
191endif
192PLATFORM_SYSTEMSDK_VERSIONS := $(strip $(sort $(PLATFORM_SYSTEMSDK_VERSIONS)))
193.KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS
194
195.KATI_READONLY := PLATFORM_SECURITY_PATCH
196
197ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP
198 # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
199 PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
200endif
201.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
202
203ifndef PLATFORM_BASE_OS
204 # Used to indicate the base os applied to the device.
205 # Can be an arbitrary string, but must be a single word.
206 #
207 # If there is no $PLATFORM_BASE_OS set, keep it empty.
208 PLATFORM_BASE_OS :=
209endif
210.KATI_READONLY := PLATFORM_BASE_OS
211
212ifndef BUILD_ID
213 # Used to signify special builds. E.g., branches and/or releases,
214 # like "M5-RC7". Can be an arbitrary string, but must be a single
215 # word and a valid file name.
216 #
217 # If there is no BUILD_ID set, make it obvious.
218 BUILD_ID := UNKNOWN
219endif
220.KATI_READONLY := BUILD_ID
221
222ifndef BUILD_DATETIME
223 # Used to reproduce builds by setting the same time. Must be the number
224 # of seconds since the Epoch.
225 BUILD_DATETIME := $(shell date +%s)
226endif
227
228DATE := date -d @$(BUILD_DATETIME)
229.KATI_READONLY := DATE
230
231# Everything should be using BUILD_DATETIME_FROM_FILE instead.
232# BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
233# to soong_ui.
234$(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE)
235
236HAS_BUILD_NUMBER := true
237ifndef BUILD_NUMBER
238 # BUILD_NUMBER should be set to the source control value that
239 # represents the current state of the source code. E.g., a
240 # perforce changelist number or a git hash. Can be an arbitrary string
241 # (to allow for source control that uses something other than numbers),
242 # but must be a single word and a valid file name.
243 #
244 # If no BUILD_NUMBER is set, create a useful "I am an engineering build
245 # from this date/time" value. Make it start with a non-digit so that
246 # anyone trying to parse it as an integer will probably get "0".
247 BUILD_NUMBER := eng.$(shell echo $${BUILD_USERNAME:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
248 HAS_BUILD_NUMBER := false
249endif
250.KATI_READONLY := BUILD_NUMBER HAS_BUILD_NUMBER
251
252ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION
253 # Used to set minimum supported target sdk version. Apps targeting sdk
254 # version lower than the set value will result in a warning being shown
255 # when any activity from the app is started.
Joseph Jangcc1f5e42022-01-26 03:15:15 +0000256 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23
Sasha Smundak13359032021-09-12 17:09:01 -0700257endif
258.KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION