summaryrefslogtreecommitdiff
path: root/brillo_config/Android.mk
diff options
context:
space:
mode:
Diffstat (limited to 'brillo_config/Android.mk')
-rw-r--r--brillo_config/Android.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/brillo_config/Android.mk b/brillo_config/Android.mk
index 87ea7cb8..8946e784 100644
--- a/brillo_config/Android.mk
+++ b/brillo_config/Android.mk
@@ -40,9 +40,18 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
include $(BUILD_SYSTEM)/base_rules.mk
-# The version is set to 0.0.0 if the user did not set the actual version.
+
+# The version is set to 0.0.0 if the user did not set the actual version and
+# a version cannot be loaded from the product cfgtree.
# This allows us to have a valid version number while being easy to filter.
-BRILLO_PRODUCT_VERSION ?= "0.0.0"
+ifeq ($(BRILLO_PRODUCT_VERSION),)
+# Load from file first
+BRILLO_PRODUCT_VERSION := $(call cfgtree-get-if-exists,brillo/product_version)
+endif
+# If the version is still empty, override it with 0.0.0
+ifeq ($(BRILLO_PRODUCT_VERSION),)
+BRILLO_PRODUCT_VERSION := "0.0.0"
+endif
ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),)
$(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \
three numbers separated by dots. Example: "1.2.0")