config: Move version setup to version.mk

Change-Id: I24f6dd25d0986863f6f9cc116c5ae9cdf15be292
This commit is contained in:
Michael Bestas 2022-03-13 20:58:55 +02:00
parent a6ba1d16f1
commit 1667b61789
2 changed files with 80 additions and 78 deletions

View file

@ -197,88 +197,12 @@ PRODUCT_PACKAGE_OVERLAYS += \
PRODUCT_PACKAGES += \
TrebuchetOverlay
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
PRODUCT_EXTRA_RECOVERY_KEYS += \
vendor/lineage/build/target/product/security/lineage
include vendor/lineage/config/version.mk
-include vendor/lineage-priv/keys/keys.mk
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
-include $(WORKSPACE)/build_env/image-auto-bits.mk
-include vendor/lineage/config/partner_gms.mk

78
config/version.mk Normal file
View file

@ -0,0 +1,78 @@
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