2021-09-13 02:09:01 +02:00
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
2023-10-19 06:54:15 +02:00
#
# Handle various build version information.
#
# Guarantees that the following are defined:
# PLATFORM_VERSION
# PLATFORM_DISPLAY_VERSION
# PLATFORM_SDK_VERSION
# PLATFORM_SDK_EXTENSION_VERSION
# PLATFORM_VERSION_CODENAME
# DEFAULT_APP_TARGET_SDK
# BUILD_ID
# BUILD_NUMBER
# PLATFORM_SECURITY_PATCH
# PLATFORM_SYSTEMSDK_VERSIONS
# PLATFORM_VERSION_LAST_STABLE
2024-02-21 18:12:16 +01:00
# PLATFORM_VERSION_KNOWN_CODENAMES
2023-10-19 06:54:15 +02:00
#
# Look for an optional file containing overrides of the defaults,
# but don't cry if we don't find it. We could just use -include, but
# the build.prop target also wants INTERNAL_BUILD_ID_MAKEFILE to be set
# if the file exists.
#
INTERNAL_BUILD_ID_MAKEFILE := $( wildcard $( BUILD_SYSTEM) /build_id.mk)
i f d e f I N T E R N A L _ B U I L D _ I D _ M A K E F I L E
include $( INTERNAL_BUILD_ID_MAKEFILE)
e n d i f
2021-09-13 02:09:01 +02:00
2023-06-06 01:43:55 +02:00
i f d e f T A R G E T _ P L A T F O R M _ V E R S I O N
$( error Do not set TARGET_PLATFORM_VERSION directly. Use RELEASE_PLATFORM_VERSION. value: $( TARGET_PLATFORM_VERSION) )
2021-09-13 02:09:01 +02:00
e n d i f
2023-06-06 01:43:55 +02:00
TARGET_PLATFORM_VERSION := $( RELEASE_PLATFORM_VERSION)
2023-10-19 06:54:15 +02:00
.KATI_READONLY := TARGET_PLATFORM_VERSION
2023-06-06 01:43:55 +02:00
2023-10-19 06:54:15 +02:00
i f d e f P L A T F O R M _ S E C U R I T Y _ P A T C H
$( error Do not set PLATFORM_SECURITY_PATCH directly. Use RELEASE_PLATFORM_SECURITY_PATCH. value: $( PLATFORM_SECURITY_PATCH) )
2021-09-13 02:09:01 +02:00
e n d i f
2023-10-19 06:54:15 +02:00
PLATFORM_SECURITY_PATCH := $( RELEASE_PLATFORM_SECURITY_PATCH)
.KATI_READONLY := PLATFORM_SECURITY_PATCH
2021-09-13 02:09:01 +02:00
2023-10-19 06:54:15 +02:00
i f d e f P L A T F O R M _ S D K _ V E R S I O N
$( error Do not set PLATFORM_SDK_VERSION directly. Use RELEASE_PLATFORM_SDK_VERSION. value: $( PLATFORM_SDK_VERSION) )
e n d i f
PLATFORM_SDK_VERSION := $( RELEASE_PLATFORM_SDK_VERSION)
.KATI_READONLY := PLATFORM_SDK_VERSION
2021-09-13 02:09:01 +02:00
2023-10-19 06:54:15 +02:00
i f d e f P L A T F O R M _ S D K _ E X T E N S I O N _ V E R S I O N
$( error Do not set PLATFORM_SDK_EXTENSION_VERSION directly. Use RELEASE_PLATFORM_SDK_EXTENSION_VERSION. value: $( PLATFORM_SDK_EXTENSION_VERSION) )
2023-07-14 23:16:11 +02:00
e n d i f
2023-10-19 06:54:15 +02:00
PLATFORM_SDK_EXTENSION_VERSION := $( RELEASE_PLATFORM_SDK_EXTENSION_VERSION)
.KATI_READONLY := PLATFORM_SDK_EXTENSION_VERSION
2023-07-14 23:16:11 +02:00
2023-10-19 06:54:15 +02:00
# This is the sdk extension version that PLATFORM_SDK_VERSION ships with.
PLATFORM_BASE_SDK_EXTENSION_VERSION := $( PLATFORM_SDK_EXTENSION_VERSION)
.KATI_READONLY := PLATFORM_BASE_SDK_EXTENSION_VERSION
i f d e f P L A T F O R M _ V E R S I O N _ C O D E N A M E
$( error Do not set PLATFORM_VERSION_CODENAME directly. Use RELEASE_PLATFORM_VERSION. value: $( PLATFORM_VERSION_CODENAME) )
2022-04-27 11:32:39 +02:00
e n d i f
2023-10-19 06:54:15 +02:00
PLATFORM_VERSION_CODENAME := $( RELEASE_PLATFORM_VERSION_CODENAME)
.KATI_READONLY := PLATFORM_VERSION_CODENAME
2021-09-13 02:09:01 +02:00
2023-10-19 06:54:15 +02:00
i f d e f P L A T F O R M _ V E R S I O N _ A L L _ C O D E N A M E S
$( error Do not set PLATFORM_VERSION_ALL_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_CODENAMES. value: $( PLATFORM_VERSION_ALL_CODENAMES) )
e n d i f
PLATFORM_VERSION_ALL_CODENAMES := $( RELEASE_PLATFORM_VERSION_ALL_CODENAMES)
.KATI_READONLY := PLATFORM_VERSION_ALL_CODENAMES
i f d e f P L A T F O R M _ V E R S I O N _ A L L _ P R E V I E W _ C O D E N A M E S
$( error Do not set PLATFORM_VERSION_ALL_PREVIEW_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES. value: $( PLATFORM_VERSION_ALL_PREVIEW_CODENAMES) )
2022-02-09 22:59:28 +01:00
e n d i f
2023-10-19 06:54:15 +02:00
PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := $( RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)
.KATI_READONLY := PLATFORM_VERSION_ALL_PREVIEW_CODENAMES
i f d e f P L A T F O R M _ V E R S I O N _ L A S T _ S T A B L E
$( error Do not set PLATFORM_VERSION_LAST_STABLE directly. Use RELEASE_PLATFORM_VERSION_LAST_STABLE. value: $( PLATFORM_VERSION_CODENAME) )
e n d i f
PLATFORM_VERSION_LAST_STABLE := $( RELEASE_PLATFORM_VERSION_LAST_STABLE)
.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE
2024-02-21 18:12:16 +01:00
i f d e f P L A T F O R M _ V E R S I O N _ K N O W N _ C O D E N A M E S
$( error Do not set PLATFORM_VERSION_KNOWN_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_KNOWN_CODENAMES. value: $( PLATFORM_VERSION_KNOWN_CODENAMES) )
e n d i f
PLATFORM_VERSION_KNOWN_CODENAMES := $( RELEASE_PLATFORM_VERSION_KNOWN_CODENAMES)
2023-10-19 06:54:15 +02:00
.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES
2022-02-09 22:59:28 +01:00
2021-09-13 02:09:01 +02:00
i f n d e f P L A T F O R M _ V E R S I O N
ifeq ( REL,$( PLATFORM_VERSION_CODENAME) )
PLATFORM_VERSION := $( PLATFORM_VERSION_LAST_STABLE)
else
PLATFORM_VERSION := $( PLATFORM_VERSION_CODENAME)
endif
e n d i f
.KATI_READONLY := PLATFORM_VERSION
2022-03-01 03:01:35 +01:00
i f n d e f P L A T F O R M _ D I S P L A Y _ V E R S I O N
PLATFORM_DISPLAY_VERSION := $( PLATFORM_VERSION)
e n d i f
.KATI_READONLY := PLATFORM_DISPLAY_VERSION
2021-09-13 02:09:01 +02:00
i f e q ( R E L , $( PLATFORM_VERSION_CODENAME ) )
PLATFORM_PREVIEW_SDK_VERSION := 0
e l s e
ifndef PLATFORM_PREVIEW_SDK_VERSION
# This is the definition of a preview SDK version over and above the current
# platform SDK version. Unlike the platform SDK version, a higher value
# for preview SDK version does NOT mean that all prior preview APIs are
# included. Packages reading this value to determine compatibility with
# known APIs should check that this value is precisely equal to the preview
# SDK version the package was built for, otherwise it should fall back to
# assuming the device can only support APIs as of the previous official
# public release.
# This value will always be forced to 0 for release builds by the logic
# in the "ifeq" block above, so the value below will be used on any
# non-release builds, and it should always be at least 1, to indicate that
# APIs may have changed since the claimed PLATFORM_SDK_VERSION.
PLATFORM_PREVIEW_SDK_VERSION := 1
endif
e n d i f
.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
i f n d e f D E F A U L T _ A P P _ T A R G E T _ S D K
# This is the default minSdkVersion and targetSdkVersion to use for
# all .apks created by the build system. It can be overridden by explicitly
# setting these in the .apk's AndroidManifest.xml. It is either the code
# name of the development build or, if this is a release build, the official
# SDK version of this release.
ifeq ( REL,$( PLATFORM_VERSION_CODENAME) )
DEFAULT_APP_TARGET_SDK := $( PLATFORM_SDK_VERSION)
else
DEFAULT_APP_TARGET_SDK := $( PLATFORM_VERSION_CODENAME)
endif
e n d i f
.KATI_READONLY := DEFAULT_APP_TARGET_SDK
i f n d e f P L A T F O R M _ S Y S T E M S D K _ M I N _ V E R S I O N
# This is the oldest version of system SDK that the platform supports. Contrary
# to the public SDK where platform essentially supports all previous SDK versions,
# platform supports only a few number of recent system SDK versions as some of
# old system APIs are gradually deprecated, removed and then deleted.
2022-08-08 20:44:42 +02:00
PLATFORM_SYSTEMSDK_MIN_VERSION := 29
2021-09-13 02:09:01 +02:00
e n d i f
.KATI_READONLY := PLATFORM_SYSTEMSDK_MIN_VERSION
# This is the list of system SDK versions that the current platform supports.
PLATFORM_SYSTEMSDK_VERSIONS :=
i f n e q ( , $( PLATFORM_SYSTEMSDK_MIN_VERSION ) )
$( if $( call math_is_number,$( PLATFORM_SYSTEMSDK_MIN_VERSION) ) ,,\
$( error PLATFORM_SYSTEMSDK_MIN_VERSION must be a number, but was $( PLATFORM_SYSTEMSDK_MIN_VERSION) ) )
PLATFORM_SYSTEMSDK_VERSIONS := $( call int_range_list,$( PLATFORM_SYSTEMSDK_MIN_VERSION) ,$( PLATFORM_SDK_VERSION) )
e n d i f
# Platform always supports the current version
i f e q ( R E L , $( PLATFORM_VERSION_CODENAME ) )
PLATFORM_SYSTEMSDK_VERSIONS += $( PLATFORM_SDK_VERSION)
e l s e
PLATFORM_SYSTEMSDK_VERSIONS += $( subst $( comma) ,$( space) ,$( PLATFORM_VERSION_ALL_CODENAMES) )
e n d i f
PLATFORM_SYSTEMSDK_VERSIONS := $( strip $( sort $( PLATFORM_SYSTEMSDK_VERSIONS) ) )
.KATI_READONLY := PLATFORM_SYSTEMSDK_VERSIONS
.KATI_READONLY := PLATFORM_SECURITY_PATCH
i f n d e f P L A T F O R M _ S E C U R I T Y _ P A T C H _ T I M E S T A M P
# Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
PLATFORM_SECURITY_PATCH_TIMESTAMP := $( shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
e n d i f
.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
i f n d e f P L A T F O R M _ B A S E _ O S
# Used to indicate the base os applied to the device.
# Can be an arbitrary string, but must be a single word.
#
# If there is no $PLATFORM_BASE_OS set, keep it empty.
PLATFORM_BASE_OS :=
e n d i f
.KATI_READONLY := PLATFORM_BASE_OS
i f n d e f B U I L D _ I D
# Used to signify special builds. E.g., branches and/or releases,
# like "M5-RC7". Can be an arbitrary string, but must be a single
# word and a valid file name.
#
# If there is no BUILD_ID set, make it obvious.
BUILD_ID := UNKNOWN
e n d i f
.KATI_READONLY := BUILD_ID
i f n d e f B U I L D _ D A T E T I M E
# Used to reproduce builds by setting the same time. Must be the number
# of seconds since the Epoch.
BUILD_DATETIME := $( shell date +%s)
e n d i f
DATE := date -d @$( BUILD_DATETIME)
.KATI_READONLY := DATE
# Everything should be using BUILD_DATETIME_FROM_FILE instead.
# BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
# to soong_ui.
$( KATI_obsolete_var BUILD_DATETIME ,Use BUILD_DATETIME_FROM_FILE )
2023-04-27 04:05:22 +02:00
i f n d e f H A S _ B U I L D _ N U M B E R
2021-09-13 02:09:01 +02:00
HAS_BUILD_NUMBER := false
e n d i f
2023-04-27 04:05:22 +02:00
.KATI_READONLY := HAS_BUILD_NUMBER
2021-09-13 02:09:01 +02:00
2024-04-12 12:18:06 +02:00
i f d e f P L A T F O R M _ M I N _ S U P P O R T E D _ T A R G E T _ S D K _ V E R S I O N
$( 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) )
2021-09-13 02:09:01 +02:00
e n d i f
2024-04-12 12:18:06 +02:00
PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := $( RELEASE_PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)
2021-09-13 02:09:01 +02:00
.KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION