android_vendor_crdroid/config/version.mk
Michael Bestas 1667b61789 config: Move version setup to version.mk
Change-Id: I24f6dd25d0986863f6f9cc116c5ae9cdf15be292
2022-03-14 17:19:28 +01:00

79 lines
3.0 KiB
Makefile

PRODUCT_VERSION_MAJOR = 19
PRODUCT_VERSION_MINOR = 1
# Set LINEAGE_BUILDTYPE from the env RELEASE_TYPE, for jenkins compat
ifndef LINEAGE_BUILDTYPE
ifdef RELEASE_TYPE
# Starting with "LINEAGE_" is optional
RELEASE_TYPE := $(shell echo $(RELEASE_TYPE) | sed -e 's|^LINEAGE_||g')
LINEAGE_BUILDTYPE := $(RELEASE_TYPE)
endif
endif
# Filter out random types, so it'll reset to UNOFFICIAL
ifeq ($(filter RELEASE NIGHTLY SNAPSHOT EXPERIMENTAL,$(LINEAGE_BUILDTYPE)),)
LINEAGE_BUILDTYPE :=
endif
ifdef LINEAGE_BUILDTYPE
ifneq ($(LINEAGE_BUILDTYPE), SNAPSHOT)
ifdef LINEAGE_EXTRAVERSION
# Force build type to EXPERIMENTAL
LINEAGE_BUILDTYPE := EXPERIMENTAL
# Remove leading dash from LINEAGE_EXTRAVERSION
LINEAGE_EXTRAVERSION := $(shell echo $(LINEAGE_EXTRAVERSION) | sed 's/-//')
# Add leading dash to LINEAGE_EXTRAVERSION
LINEAGE_EXTRAVERSION := -$(LINEAGE_EXTRAVERSION)
endif
else
ifndef LINEAGE_EXTRAVERSION
# Force build type to EXPERIMENTAL, SNAPSHOT mandates a tag
LINEAGE_BUILDTYPE := EXPERIMENTAL
else
# Remove leading dash from LINEAGE_EXTRAVERSION
LINEAGE_EXTRAVERSION := $(shell echo $(LINEAGE_EXTRAVERSION) | sed 's/-//')
# Add leading dash to LINEAGE_EXTRAVERSION
LINEAGE_EXTRAVERSION := -$(LINEAGE_EXTRAVERSION)
endif
endif
else
# If LINEAGE_BUILDTYPE is not defined, set to UNOFFICIAL
LINEAGE_BUILDTYPE := UNOFFICIAL
LINEAGE_EXTRAVERSION :=
endif
ifeq ($(LINEAGE_BUILDTYPE), UNOFFICIAL)
ifneq ($(TARGET_UNOFFICIAL_BUILD_ID),)
LINEAGE_EXTRAVERSION := -$(TARGET_UNOFFICIAL_BUILD_ID)
endif
endif
ifeq ($(LINEAGE_BUILDTYPE), RELEASE)
LINEAGE_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR).$(PRODUCT_VERSION_DEVICE_SPECIFIC)-$(LINEAGE_BUILD)
else
ifeq ($(LINEAGE_VERSION_APPEND_TIME_OF_DAY),true)
LINEAGE_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR)-$(shell date -u +%Y%m%d_%H%M%S)-$(LINEAGE_BUILDTYPE)$(LINEAGE_EXTRAVERSION)-$(LINEAGE_BUILD)
else
LINEAGE_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR)-$(shell date -u +%Y%m%d)-$(LINEAGE_BUILDTYPE)$(LINEAGE_EXTRAVERSION)-$(LINEAGE_BUILD)
endif
endif
# Display version
LINEAGE_DISPLAY_VERSION := $(LINEAGE_VERSION)
ifneq ($(PRODUCT_DEFAULT_DEV_CERTIFICATE),)
ifneq ($(PRODUCT_DEFAULT_DEV_CERTIFICATE),build/target/product/security/testkey)
ifneq ($(LINEAGE_BUILDTYPE), UNOFFICIAL)
ifneq ($(LINEAGE_EXTRAVERSION),)
# Remove leading dash from LINEAGE_EXTRAVERSION
LINEAGE_EXTRAVERSION := $(shell echo $(LINEAGE_EXTRAVERSION) | sed 's/-//')
TARGET_VENDOR_RELEASE_BUILD_ID := $(LINEAGE_EXTRAVERSION)
else
TARGET_VENDOR_RELEASE_BUILD_ID := $(shell date -u +%Y%m%d)
endif
LINEAGE_DISPLAY_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR)-$(TARGET_VENDOR_RELEASE_BUILD_ID)-$(LINEAGE_BUILD)
endif
endif
endif