Skip to content

Commit f01bc21

Browse files
committed
brillo_config: pull PRODUCT_VERSION from cfgtree
Add support to read the product version from config/brillo/product_version Change-Id: Iee2394810b42fbab8be1e318373140f289f91346
1 parent de10459 commit f01bc21

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

brillo_config/Android.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,18 @@ LOCAL_MODULE_CLASS := ETC
4040
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
4141
include $(BUILD_SYSTEM)/base_rules.mk
4242

43-
# The version is set to 0.0.0 if the user did not set the actual version.
43+
44+
# The version is set to 0.0.0 if the user did not set the actual version and
45+
# a version cannot be loaded from the product cfgtree.
4446
# This allows us to have a valid version number while being easy to filter.
45-
BRILLO_PRODUCT_VERSION ?= "0.0.0"
47+
ifeq ($(BRILLO_PRODUCT_VERSION),)
48+
# Load from file first
49+
BRILLO_PRODUCT_VERSION := $(call cfgtree-get-if-exists,brillo/product_version)
50+
endif
51+
# If the version is still empty, override it with 0.0.0
52+
ifeq ($(BRILLO_PRODUCT_VERSION),)
53+
BRILLO_PRODUCT_VERSION := "0.0.0"
54+
endif
4655
ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),)
4756
$(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \
4857
three numbers separated by dots. Example: "1.2.0")

0 commit comments

Comments
 (0)