Merge "Add min and max supported versions" am: ae4779e254 am: e611741d85

am: 4859177dd9

Change-Id: I8d5501607db18382dec51a7cfa490536a0218406
This commit is contained in:
Colin Cross 2017-03-29 00:53:26 +00:00 committed by android-build-merger
commit 99a995157b
2 changed files with 68 additions and 37 deletions

View file

@ -11,9 +11,65 @@
# This can be useful if you set OUT_DIR to be a different directory # This can be useful if you set OUT_DIR to be a different directory
# than other outputs of your build system. # than other outputs of your build system.
# Returns all words in $1 up to and including $2
define find_and_earlier
$(strip $(if $(1),
$(firstword $(1))
$(if $(filter $(firstword $(1)),$(2)),,
$(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
endef
#$(warning $(call find_and_earlier,A B C,A))
#$(warning $(call find_and_earlier,A B C,B))
#$(warning $(call find_and_earlier,A B C,C))
#$(warning $(call find_and_earlier,A B C,D))
define version-list
$(1)PR1 $(1)PD1 $(1)PD2 $(1)PM1 $(1)PM2
endef
ALL_VERSIONS := O P Q R S T U V W X Y Z
ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
# 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 DEFAULT_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 DEFAULT_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. # Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk include $(BUILD_SYSTEM)/version_defaults.mk
ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
$(foreach v,$(ENABLED_VERSIONS), \
$(eval IS_AT_LEAST_$(v) := true))
# --------------------------------------------------------------- # ---------------------------------------------------------------
# If you update the build system such that the environment setup # If you update the build system such that the environment setup
# or buildspec.mk need to be updated, increment this number, and # or buildspec.mk need to be updated, increment this number, and

View file

@ -38,52 +38,27 @@ ifdef INTERNAL_BUILD_ID_MAKEFILE
include $(INTERNAL_BUILD_ID_MAKEFILE) include $(INTERNAL_BUILD_ID_MAKEFILE)
endif endif
# Returns all words in $1 up to and including $2
define find_and_earlier
$(strip $(if $(1),
$(firstword $(1))
$(if $(filter $(firstword $(1)),$(2)),,
$(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
endef
#$(warning $(call find_and_earlier,A B C,A))
#$(warning $(call find_and_earlier,A B C,B))
#$(warning $(call find_and_earlier,A B C,C))
#$(warning $(call find_and_earlier,A B C,D))
define version-list
$(1)PR1 $(1)PD1 $(1)PD2 $(1)PM1 $(1)PM2
endef
ALL_VERSIONS := O P
ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
DEFAULT_PLATFORM_VERSION := OPR1 DEFAULT_PLATFORM_VERSION := OPR1
MIN_PLATFORM_VERSION := OPR1
MAX_PLATFORM_VERSION := PPR1
# HACK: forward P to PPR1 until the build server config is updated ALLOWED_VERSIONS := $(call allowed-platform-versions,\
ifeq (P,$(TARGET_PLATFORM_VERSION)) $(MIN_PLATFORM_VERSION),\
TARGET_PLATFORM_VERSION := PPR1 $(MAX_PLATFORM_VERSION),\
endif $(DEFAULT_PLATFORM_VERSION))
ifeq (,$(TARGET_PLATFORM_VERSION)) ifndef TARGET_PLATFORM_VERSION
# Default targeted platform version
# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
# on this
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION) TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
endif endif
ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION))) ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
$(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of) $(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
$(warning $(ALL_VERSIONS)) $(error $(ALLOWED_VERSIONS))
$(error Stopping...)
endif endif
ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
$(foreach v,$(ENABLED_VERSIONS), \
$(eval IS_AT_LEAST_$(v) := true))
# Default versions for each TARGET_PLATFORM_VERSION # Default versions for each TARGET_PLATFORM_VERSION
# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
# on this
# This is the canonical definition of the platform version, # This is the canonical definition of the platform version,
# which is the version that we reveal to the end user. # which is the version that we reveal to the end user.