2009-03-04 11:28:42 +08: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.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Handle various build version information.
|
|
|
|
#
|
|
|
|
# Guarantees that the following are defined:
|
|
|
|
# PLATFORM_VERSION
|
|
|
|
# PLATFORM_SDK_VERSION
|
2009-05-16 09:01:20 +08:00
|
|
|
# PLATFORM_VERSION_CODENAME
|
|
|
|
# DEFAULT_APP_TARGET_SDK
|
2009-03-04 11:28:42 +08:00
|
|
|
# BUILD_ID
|
|
|
|
# BUILD_NUMBER
|
2015-08-12 06:25:12 +08:00
|
|
|
# BUILD_DATETIME
|
2016-07-30 02:52:35 +08:00
|
|
|
# PLATFORM_SECURITY_PATCH
|
2009-03-04 11:28:42 +08: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)
|
2017-02-22 09:23:02 +08:00
|
|
|
ifdef INTERNAL_BUILD_ID_MAKEFILE
|
2009-03-04 11:28:42 +08:00
|
|
|
include $(INTERNAL_BUILD_ID_MAKEFILE)
|
|
|
|
endif
|
|
|
|
|
2017-04-19 07:25:01 +08:00
|
|
|
DEFAULT_PLATFORM_VERSION := OPD1
|
|
|
|
MIN_PLATFORM_VERSION := OPD1
|
2017-03-29 04:07:56 +08:00
|
|
|
MAX_PLATFORM_VERSION := PPR1
|
2017-03-22 08:41:03 +08:00
|
|
|
|
2017-03-29 04:07:56 +08:00
|
|
|
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
|
|
|
|
$(MIN_PLATFORM_VERSION),\
|
|
|
|
$(MAX_PLATFORM_VERSION),\
|
|
|
|
$(DEFAULT_PLATFORM_VERSION))
|
2017-03-22 03:45:29 +08:00
|
|
|
|
2017-03-29 04:07:56 +08:00
|
|
|
ifndef TARGET_PLATFORM_VERSION
|
2017-03-22 08:41:03 +08:00
|
|
|
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
|
2017-05-02 05:21:28 +08:00
|
|
|
else ifeq ($(TARGET_PLATFORM_VERSION),OPR1)
|
|
|
|
# HACK: lunch currently sets TARGET_PLATFORM_VERSION to
|
|
|
|
# DEFAULT_PLATFORM_VERSION, which causes unnecessary pain
|
|
|
|
# when the old DEFAULT_PLATFORM_VERSION becomes invalid.
|
|
|
|
# For now, silently upgrade OPR1 to the current default.
|
|
|
|
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
|
2017-02-17 08:41:26 +08:00
|
|
|
endif
|
|
|
|
|
2017-03-29 04:07:56 +08:00
|
|
|
ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
|
|
|
|
$(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
|
|
|
|
$(error $(ALLOWED_VERSIONS))
|
2017-02-17 08:41:26 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-18 08:28:16 +08:00
|
|
|
# Default versions for each TARGET_PLATFORM_VERSION
|
2017-03-29 04:07:56 +08:00
|
|
|
# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
|
|
|
|
# on this
|
2016-11-24 03:59:25 +08:00
|
|
|
|
2017-02-18 08:28:16 +08:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
# When you add a new PLATFORM_VERSION which will result in a new
|
|
|
|
# PLATFORM_SDK_VERSION please ensure you add a corresponding isAtLeast*
|
|
|
|
# method in the following java file:
|
|
|
|
# frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
|
|
|
|
|
|
|
|
# When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
|
|
|
|
# please add that PLATFORM_VERSION to the following text file:
|
|
|
|
# cts/tests/tests/os/assets/platform_versions.txt
|
2017-06-06 23:47:48 +08:00
|
|
|
PLATFORM_VERSION.OPD1 := 8.0.1
|
2017-04-19 07:25:01 +08:00
|
|
|
PLATFORM_VERSION.OPM1 := OMR1
|
2017-03-22 14:06:22 +08:00
|
|
|
PLATFORM_VERSION.PPR1 := P
|
2017-02-18 08:28:16 +08:00
|
|
|
|
2017-04-19 07:25:01 +08:00
|
|
|
# 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".
|
2017-05-23 04:09:21 +08:00
|
|
|
PLATFORM_VERSION_CODENAME.OPD1 := REL
|
2017-04-19 07:25:01 +08:00
|
|
|
PLATFORM_VERSION_CODENAME.OPM1 := OMR1
|
2017-03-22 14:06:22 +08:00
|
|
|
PLATFORM_VERSION_CODENAME.PPR1 := P
|
2017-02-18 08:28:16 +08:00
|
|
|
|
|
|
|
ifndef PLATFORM_VERSION
|
|
|
|
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
|
|
|
|
ifndef PLATFORM_VERSION
|
|
|
|
# PLATFORM_VERSION falls back to TARGET_PLATFORM_VERSION
|
|
|
|
PLATFORM_VERSION := $(TARGET_PLATFORM_VERSION)
|
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_SDK_VERSION
|
2009-03-04 11:28:42 +08:00
|
|
|
# This is the canonical definition of the SDK version, which defines
|
2009-05-09 03:06:17 +08:00
|
|
|
# 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.
|
2016-11-04 08:09:25 +08:00
|
|
|
|
|
|
|
# When you change PLATFORM_SDK_VERSION please ensure you also update the
|
|
|
|
# corresponding methods for isAtLeast* in the following java file:
|
2016-11-24 03:59:25 +08:00
|
|
|
# frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
|
|
|
|
|
|
|
|
# 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
|
2017-05-04 08:09:37 +08:00
|
|
|
PLATFORM_SDK_VERSION := 26
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_JACK_MIN_SDK_VERSION
|
2016-03-10 00:19:58 +08:00
|
|
|
# This is definition of the min SDK version given to Jack for the current
|
|
|
|
# platform. For released version it should be the same as
|
|
|
|
# PLATFORM_SDK_VERSION. During development, this number may be incremented
|
2017-05-04 08:09:37 +08:00
|
|
|
# before PLATFORM_SDK_VERSION if the platform starts to add new java
|
2016-03-10 00:19:58 +08:00
|
|
|
# language supports.
|
2016-11-19 02:30:28 +08:00
|
|
|
PLATFORM_JACK_MIN_SDK_VERSION := o-b1
|
2016-03-10 00:19:58 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_VERSION_CODENAME
|
2017-02-18 08:28:16 +08:00
|
|
|
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)
|
|
|
|
endif
|
2014-04-25 07:19:14 +08:00
|
|
|
|
|
|
|
# This is all of the development codenames that are active. Should be either
|
|
|
|
# the same as PLATFORM_VERSION_CODENAME or a comma-separated list of additional
|
|
|
|
# codenames after PLATFORM_VERSION_CODENAME.
|
2017-03-29 03:41:18 +08:00
|
|
|
PLATFORM_VERSION_ALL_CODENAMES :=
|
|
|
|
|
|
|
|
# Build a list of all possible 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))))
|
|
|
|
|
|
|
|
# And convert from space separated to comma separated.
|
|
|
|
PLATFORM_VERSION_ALL_CODENAMES := \
|
|
|
|
$(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
|
|
|
|
|
2009-05-09 03:06:17 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
|
2015-05-22 04:49:05 +08:00
|
|
|
PLATFORM_PREVIEW_SDK_VERSION := 0
|
|
|
|
else
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_PREVIEW_SDK_VERSION
|
2015-05-22 04:49:05 +08:00
|
|
|
# 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 0 for release builds.
|
2017-04-19 07:25:01 +08:00
|
|
|
PLATFORM_PREVIEW_SDK_VERSION := 1
|
2015-05-22 04:49:05 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef DEFAULT_APP_TARGET_SDK
|
2009-05-16 09:01:20 +08:00
|
|
|
# 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.
|
2017-02-22 09:23:02 +08:00
|
|
|
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
|
2009-05-16 09:01:20 +08:00
|
|
|
DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
|
|
|
|
else
|
|
|
|
DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_SECURITY_PATCH
|
2016-08-26 10:46:06 +08:00
|
|
|
# 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.
|
2017-06-10 01:50:47 +08:00
|
|
|
PLATFORM_SECURITY_PATCH := 2017-08-05
|
2015-08-13 07:11:20 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef PLATFORM_BASE_OS
|
2015-08-13 07:11:20 +08:00
|
|
|
# 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 :=
|
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef BUILD_ID
|
2009-03-04 11:28:42 +08:00
|
|
|
# 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
|
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef BUILD_DATETIME
|
2015-08-12 06:25:12 +08:00
|
|
|
# Used to reproduce builds by setting the same time. Must be the number
|
|
|
|
# of seconds since the Epoch.
|
|
|
|
BUILD_DATETIME := $(shell date +%s)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(findstring Darwin,$(shell uname -sm)))
|
|
|
|
DATE := date -r $(BUILD_DATETIME)
|
|
|
|
else
|
|
|
|
DATE := date -d @$(BUILD_DATETIME)
|
|
|
|
endif
|
|
|
|
|
2017-02-22 09:23:02 +08:00
|
|
|
ifndef BUILD_NUMBER
|
2009-03-04 11:28:42 +08:00
|
|
|
# BUILD_NUMBER should be set to the source control value that
|
|
|
|
# represents the current state of the source code. E.g., a
|
|
|
|
# perforce changelist number or a git hash. Can be an arbitrary string
|
|
|
|
# (to allow for source control that uses something other than numbers),
|
|
|
|
# but must be a single word and a valid file name.
|
|
|
|
#
|
|
|
|
# If no BUILD_NUMBER is set, create a useful "I am an engineering build
|
|
|
|
# from this date/time" value. Make it start with a non-digit so that
|
|
|
|
# anyone trying to parse it as an integer will probably get "0".
|
2015-12-15 15:57:22 +08:00
|
|
|
BUILD_NUMBER := eng.$(shell echo $${USER:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|