Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c096382 authored by Baligh Uddin's avatar Baligh Uddin Committed by Gerrit Code Review
Browse files

Merge "Move most version variable out to relase configs." into main

parents ea9d5cfb 426a9f8f
Loading
Loading
Loading
Loading

core/all_versions.bzl

deleted100644 → 0
+0 −23
Original line number Diff line number Diff line
# Copyright (C) 2023 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.

_all_versions = ["OPR1", "OPD1", "OPD2", "OPM1", "OPM2", "PPR1", "PPD1", "PPD2", "PPM1", "PPM2", "QPR1"] + [
    version + subversion
    for version in ["Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
    for subversion in ["P1A", "P1B", "P2A", "P2B", "D1A", "D1B", "D2A", "D2B", "Q1A", "Q1B", "Q2A", "Q2B", "Q3A", "Q3B"]
]

variables_to_export_to_make = {
    "ALL_VERSIONS": _all_versions,
}
+7 −36
Original line number Diff line number Diff line
@@ -51,44 +51,15 @@ endef
include $(BUILD_SYSTEM)/release_config.mk

# ---------------------------------------------------------------
# defines ALL_VERSIONS
$(call run-starlark,build/make/core/all_versions.bzl)

# Filters ALL_VERSIONS down to the range [$1, $2], and errors if $1 > $2 or $3 is
# not in [$1, $2]
# $(1): min platform version
# $(2): max platform version
# $(3): default platform version
define allowed-platform-versions
$(strip \
  $(if $(filter $(ALL_VERSIONS),$(1)),,
    $(error Invalid MIN_PLATFORM_VERSION '$(1)'))
  $(if $(filter $(ALL_VERSIONS),$(2)),,
    $(error Invalid MAX_PLATFORM_VERSION '$(2)'))
  $(if $(filter $(ALL_VERSIONS),$(3)),,
    $(error Invalid RELEASE_PLATFORM_VERSION '$(3)'))

  $(eval allowed_versions_ := $(call find_and_earlier,$(ALL_VERSIONS),$(2)))

  $(if $(filter $(allowed_versions_),$(1)),,
    $(error MIN_PLATFORM_VERSION '$(1)' must be before MAX_PLATFORM_VERSION '$(2)'))

  $(eval allowed_versions_ := $(1) \
    $(filter-out $(call find_and_earlier,$(allowed_versions_),$(1)),$(allowed_versions_)))

  $(if $(filter $(allowed_versions_),$(3)),,
    $(error RELEASE_PLATFORM_VERSION '$(3)' must be between MIN_PLATFORM_VERSION '$(1)' and MAX_PLATFORM_VERSION '$(2)'))

  $(allowed_versions_))
endef

#$(warning $(call allowed-platform-versions,OPR1,PPR1,OPR1))
#$(warning $(call allowed-platform-versions,OPM1,PPR1,OPR1))
# Set up version information
include $(BUILD_SYSTEM)/version_util.mk

# Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk
# This used to be calculated, but is now fixed and not expected
# to change over time anymore. New code attempting to use a
# variable like IS_AT_LAST_* should instead use a
# build system flag.

ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
ENABLED_VERSIONS := "OPR1 OPD1 OPD2 OPM1 OPM2 PPR1 PPD1 PPD2 PPM1 PPM2 QPR1 QP1A QP1B QP2A QP2B QD1A QD1B QD2A QD2B QQ1A QQ1B QQ2A QQ2B QQ3A QQ3B RP1A RP1B RP2A RP2B RD1A RD1B RD2A RD2B RQ1A RQ1B RQ2A RQ2B RQ3A RQ3B SP1A SP1B SP2A SP2B SD1A SD1B SD2A SD2B SQ1A SQ1B SQ2A SQ2B SQ3A SQ3B TP1A TP1B TP2A TP2B TD1A TD1B TD2A TD2B TQ1A TQ1B TQ2A TQ2B TQ3A TQ3B UP1A UP1B UP2A UP2B UD1A UD1B UD2A UD2B UQ1A UQ1B UQ2A UQ2B UQ3A UQ3B"

$(foreach v,$(ENABLED_VERSIONS), \
  $(eval IS_AT_LEAST_$(v) := true))
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ ifneq (,$(wildcard cts/))
  cts_platform_release_path := cts/tests/tests/os/assets/platform_releases.txt
  cts_platform_release_string := $(shell cat $(cts_platform_release_path))

  ifeq ($(RELEASE_PLATFORM_VERSION_CODENAME_REL),)
  ifneq (REL,$(PLATFORM_VERSION_CODENAME))
    ifeq (,$(findstring $(PLATFORM_VERSION),$(cts_platform_version_string)))
      define error_msg
        ============================================================

core/version_defaults.mk

deleted100644 → 0
+0 −111
Original line number Diff line number Diff line
#
# 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.
#

#
# Handle various build version information.
#
# Guarantees that the following are defined:
#     PLATFORM_VERSION
#     PLATFORM_DISPLAY_VERSION
#     PLATFORM_SDK_VERSION
#     PLATFORM_VERSION_CODENAME
#     DEFAULT_APP_TARGET_SDK
#     BUILD_ID
#     BUILD_NUMBER
#     PLATFORM_SECURITY_PATCH
#     PLATFORM_VNDK_VERSION
#     PLATFORM_SYSTEMSDK_VERSIONS
#

# 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)
ifdef INTERNAL_BUILD_ID_MAKEFILE
  include $(INTERNAL_BUILD_ID_MAKEFILE)
endif

# Set release configuration. The default resides in build/release/build_flags.mk.
MIN_PLATFORM_VERSION := UP1A
MAX_PLATFORM_VERSION := VP1A

# The last stable version name of the platform that was released.  During
# development, this stays at that previous version, while the codename indicates
# further work based on the previous version.
PLATFORM_VERSION_LAST_STABLE := 14
.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE

# These are the current development codenames, if the build is not a final
# release build.  If this is a final release build, it is simply "REL".
# Note that this may be overridden by RELEASE_VERSION_CODENAME_REL in
# version_util.mk.
PLATFORM_VERSION_CODENAME.UP1A := UpsideDownCake
PLATFORM_VERSION_CODENAME.VP1A := VanillaIceCream

# This is the user-visible version.  In a final release build it should
# be empty to use PLATFORM_VERSION as the user-visible version.  For
# a preview release it can be set to a user-friendly value like `12 Preview 1`
PLATFORM_DISPLAY_VERSION :=

ifndef PLATFORM_SDK_VERSION
  # This is the canonical definition of the SDK version, which defines
  # the set of APIs and functionality available in the platform.  It
  # is a single integer that increases monotonically as updates to
  # the SDK are released.  It should only be incremented when the APIs for
  # the new release are frozen (so that developers don't write apps against
  # intermediate builds).  During development, this number remains at the
  # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
  # the code-name of the new development work.

  # When you increment the PLATFORM_SDK_VERSION please ensure you also
  # clear out the following text file of all older PLATFORM_VERSION's:
  # cts/tests/tests/os/assets/platform_versions.txt
  PLATFORM_SDK_VERSION := 34
endif
.KATI_READONLY := PLATFORM_SDK_VERSION

# This is the sdk extension version of this tree.
PLATFORM_SDK_EXTENSION_VERSION := 7
.KATI_READONLY := PLATFORM_SDK_EXTENSION_VERSION

# 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

# This are all known codenames.
PLATFORM_VERSION_KNOWN_CODENAMES := \
Base Base11 Cupcake Donut Eclair Eclair01 EclairMr1 Froyo Gingerbread GingerbreadMr1 \
Honeycomb HoneycombMr1 HoneycombMr2 IceCreamSandwich IceCreamSandwichMr1 \
JellyBean JellyBeanMr1 JellyBeanMr2 Kitkat KitkatWatch Lollipop LollipopMr1 M N NMr1 O OMr1 P \
Q R S Sv2 Tiramisu UpsideDownCake VanillaIceCream

# Convert from space separated list to comma separated
PLATFORM_VERSION_KNOWN_CODENAMES := \
  $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES))
.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES

ifndef PLATFORM_SECURITY_PATCH
    #  Used to indicate the security patch that has been applied to the device.
    #  It must signify that the build includes all security patches issued up through the designated Android Public Security Bulletin.
    #  It must be of the form "YYYY-MM-DD" on production devices.
    #  It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
    #  If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
    PLATFORM_SECURITY_PATCH := 2023-10-05
endif

include $(BUILD_SYSTEM)/version_util.mk
+74 −94
Original line number Diff line number Diff line
@@ -14,119 +14,99 @@
# limitations under the License.
#

ALLOWED_VERSIONS := $(call allowed-platform-versions,\
  $(MIN_PLATFORM_VERSION),\
  $(MAX_PLATFORM_VERSION),\
  $(RELEASE_PLATFORM_VERSION))

#
# 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_VNDK_VERSION
#     PLATFORM_SYSTEMSDK_VERSIONS
#     PLATFORM_VERSION_LAST_STABLE
#

# 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)
ifdef INTERNAL_BUILD_ID_MAKEFILE
  include $(INTERNAL_BUILD_ID_MAKEFILE)
endif

ifdef TARGET_PLATFORM_VERSION
  $(error Do not set TARGET_PLATFORM_VERSION directly. Use RELEASE_PLATFORM_VERSION. value: $(TARGET_PLATFORM_VERSION))
endif

TARGET_PLATFORM_VERSION := $(RELEASE_PLATFORM_VERSION)

ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
  $(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
  $(error $(ALLOWED_VERSIONS))
endif
ALLOWED_VERSIONS :=
MIN_PLATFORM_VERSION :=
MAX_PLATFORM_VERSION :=

.KATI_READONLY := TARGET_PLATFORM_VERSION

# Default versions for each TARGET_PLATFORM_VERSION
# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
# on this
ifdef PLATFORM_SECURITY_PATCH
  $(error Do not set PLATFORM_SECURITY_PATCH directly. Use RELEASE_PLATFORM_SECURITY_PATCH. value: $(PLATFORM_SECURITY_PATCH))
endif
PLATFORM_SECURITY_PATCH := $(RELEASE_PLATFORM_SECURITY_PATCH)
.KATI_READONLY := PLATFORM_SECURITY_PATCH

# This is the canonical definition of the platform version,
# which is the version that we reveal to the end user.
# Update this value when the platform version changes (rather
# than overriding it somewhere else).  Can be an arbitrary string.
ifdef PLATFORM_SDK_VERSION
  $(error Do not set PLATFORM_SDK_VERSION directly. Use RELEASE_PLATFORM_SDK_VERSION. value: $(PLATFORM_SDK_VERSION))
endif
PLATFORM_SDK_VERSION := $(RELEASE_PLATFORM_SDK_VERSION)
.KATI_READONLY := PLATFORM_SDK_VERSION

# When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
# please add that PLATFORM_VERSION as well as clean up obsolete PLATFORM_VERSION's
# in the following text file:
# cts/tests/tests/os/assets/platform_versions.txt
ifdef PLATFORM_SDK_EXTENSION_VERSION
  $(error Do not set PLATFORM_SDK_EXTENSION_VERSION directly. Use RELEASE_PLATFORM_SDK_EXTENSION_VERSION. value: $(PLATFORM_SDK_EXTENSION_VERSION))
endif
PLATFORM_SDK_EXTENSION_VERSION := $(RELEASE_PLATFORM_SDK_EXTENSION_VERSION)
.KATI_READONLY := PLATFORM_SDK_EXTENSION_VERSION

# Note that there should be one PLATFORM_VERSION and PLATFORM_VERSION_CODENAME
# entry for each unreleased API level, regardless of
# MIN_PLATFORM_VERSION/MAX_PLATFORM_VERSION. PLATFORM_VERSION is used to
# generate the range of allowed SDK versions, so it must have an entry for every
# unreleased API level targetable by this branch, not just those that are valid
# lunch targets for this branch.
# 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

# Release config flag to override the current version to REL.  Note that the
# codename can also be locked to REL by setting it in versino_defaults.mk.
ifneq ($(RELEASE_PLATFORM_VERSION_CODENAME_REL),)
  PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION) := REL
ifdef PLATFORM_VERSION_CODENAME
  $(error Do not set PLATFORM_VERSION_CODENAME directly. Use RELEASE_PLATFORM_VERSION. value: $(PLATFORM_VERSION_CODENAME))
endif
PLATFORM_VERSION_CODENAME := $(RELEASE_PLATFORM_VERSION_CODENAME)
.KATI_READONLY := PLATFORM_VERSION_CODENAME

PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
ifndef PLATFORM_VERSION_CODENAME
  # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION
  PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
ifdef PLATFORM_VERSION_ALL_CODENAMES
  $(error Do not set PLATFORM_VERSION_ALL_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_CODENAMES. value: $(PLATFORM_VERSION_ALL_CODENAMES))
endif
PLATFORM_VERSION_ALL_CODENAMES := $(RELEASE_PLATFORM_VERSION_ALL_CODENAMES)
.KATI_READONLY := PLATFORM_VERSION_ALL_CODENAMES

# This is all of the *active* development codenames.
# This confusing name is needed because
# all_codenames has been baked into build.prop for ages.
#
# Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated
# list of additional codenames after PLATFORM_VERSION_CODENAME.
PLATFORM_VERSION_ALL_CODENAMES :=

# Build a list of all active code names. Avoid duplicates, and stop when we
# reach a codename that matches PLATFORM_VERSION_CODENAME (anything beyond
# that is not included in our build).
_versions_in_target := \
  $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
$(foreach version,$(_versions_in_target),\
  $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
  $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
    $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
ifdef PLATFORM_VERSION_ALL_PREVIEW_CODENAMES
  $(error Do not set PLATFORM_VERSION_ALL_PREVIEW_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES. value: $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES))
endif
PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := $(RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)
.KATI_READONLY := PLATFORM_VERSION_ALL_PREVIEW_CODENAMES

# And the list of actually all the codenames that are in preview. The
# ALL_CODENAMES variable is sort of a lie for historical reasons and only
# includes codenames up to and including the currently active codename, whereas
# this variable also includes future codenames. For example, while AOSP is still
# merging into U, but V development has started, ALL_CODENAMES will only be U,
# but ALL_PREVIEW_CODENAMES will be U and V.
#
# REL is filtered out of the list. The codename of the current release is
# replaced by "REL" when the build is configured as a release rather than a
# preview. For example, PLATFORM_VERSION_CODENAME.UpsideDownCake will be "REL"
# rather than UpsideDownCake in a -next target when the upcoming release is
# UpsideDownCake. "REL" is a codename (and android.os.Build relies on this:
# https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/os/Build.java;l=484-487;drc=316e3d16c9f34212f3beace7695289651d15a071),
# so it should be in PLATFORM_VERSION_ALL_CODENAMES, but it definitely is not a
# preview codename.
PLATFORM_VERSION_ALL_PREVIEW_CODENAMES :=
$(foreach version,$(ALL_VERSIONS),\
  $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
  $(if $(filter REL,$(_codename)),,\
      $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)),,\
        $(eval PLATFORM_VERSION_ALL_PREVIEW_CODENAMES += $(_codename)))))
ifdef PLATFORM_VERSION_LAST_STABLE
  $(error Do not set PLATFORM_VERSION_LAST_STABLE directly. Use RELEASE_PLATFORM_VERSION_LAST_STABLE. value: $(PLATFORM_VERSION_CODENAME))
endif
PLATFORM_VERSION_LAST_STABLE := $(RELEASE_PLATFORM_VERSION_LAST_STABLE)
.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE

# And convert from space separated to comma separated.
PLATFORM_VERSION_ALL_CODENAMES := \
  $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
PLATFORM_VERSION_ALL_PREVIEW_CODENAMES := \
  $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_PREVIEW_CODENAMES)))

.KATI_READONLY := \
  PLATFORM_VERSION_CODENAME \
  PLATFORM_VERSION_ALL_CODENAMES \
  PLATFORM_VERSION_ALL_PREVIEW_CODENAMES \
# This are all known codenames. Should this move into the release config?
PLATFORM_VERSION_KNOWN_CODENAMES := \
Base Base11 Cupcake Donut Eclair Eclair01 EclairMr1 Froyo Gingerbread GingerbreadMr1 \
Honeycomb HoneycombMr1 HoneycombMr2 IceCreamSandwich IceCreamSandwichMr1 \
JellyBean JellyBeanMr1 JellyBeanMr2 Kitkat KitkatWatch Lollipop LollipopMr1 M N NMr1 O OMr1 P \
Q R S Sv2 Tiramisu UpsideDownCake VanillaIceCream

ifneq (REL,$(PLATFORM_VERSION_CODENAME))
  codenames := \
    $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES)))
  ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),)
    $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \
        Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES)
  endif
endif
# Convert from space separated list to comma separated
PLATFORM_VERSION_KNOWN_CODENAMES := \
  $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES))
.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES

ifndef PLATFORM_VERSION
  ifeq (REL,$(PLATFORM_VERSION_CODENAME))