Use HAS_BUILD_NUMBER to check engineering build
And use BUILD_NUMBER_FROM_FILE instead of BUILD_NUMBER to reduce build
reruns.
Test: m -j32
Bug: b/70351683
Change-Id: I95fcc5c92130182a3720f3c08469f196d7f7b4f9
diff --git a/version.mk b/version.mk
index 7b38210..3424b9d 100644
--- a/version.mk
+++ b/version.mk
@@ -43,7 +43,7 @@
#####################################################
#####################################################
# Collect automatic version code parameters
-ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
+ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
# This is an eng build
base_version_buildtype := 0
else
@@ -85,7 +85,7 @@
# where nnnnnn is the build number from the build server (no zero-padding)
# On eng builds, the BUILD_NUMBER has the user and timestamp inline
ifdef TARGET_BUILD_APPS
-ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
+ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
date_string := $$(date +%m%d%y_%H%M%S)
version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density))