Partially revert BUILD_DATETIME change

Change Ibe4ceb1b224c5e8f3e1a8a59cfee89217765a901 caused kati to
regenerate on every build:
$(shell cat out/build_date.txt) was changed, regenerating...
Switch back to $(shell date +%s) which is special cased in kati
to not cause a regeneration.  Everything besides DATE will still
use BUILD_DATETIME_FROM_FILE from soong_ui.

Once BUILD_NUMBER is moved to soong_ui $(DATE) is no longer
necessary and the whole thing can be removed.

Bug: 70351683
Bug: 73352417
Test: m && m doesn't regenerate
Test: m BUILD_DATETIME=1234 shows up in ro.build.version.incremental
Change-Id: I8444beb2b47a49095ef760083fc85f220821bffe
This commit is contained in:
Colin Cross 2018-02-16 09:14:01 -08:00
parent dc6e822374
commit ce8c05196d
1 changed files with 15 additions and 4 deletions

View File

@ -254,12 +254,23 @@ ifndef BUILD_ID
BUILD_ID := UNKNOWN
endif
ifneq (,$(findstring Darwin,$(UNAME)))
DATE := date -r $(shell cat $(BUILD_DATETIME_FILE))
else
DATE := date -d @$(shell cat $(BUILD_DATETIME_FILE))
ifndef BUILD_DATETIME
# Used to reproduce builds by setting the same time. Must be the number
# of seconds since the Epoch.
BUILD_DATETIME := $(shell date +%s)
endif
ifneq (,$(findstring Darwin,$(UNAME)))
DATE := date -r $(BUILD_DATETIME)
else
DATE := date -d @$(BUILD_DATETIME)
endif
# Everything should be using BUILD_DATETIME_FROM_FILE instead.
# BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
# to soong_ui.
BUILD_DATETIME :=
ifndef BUILD_NUMBER
# BUILD_NUMBER should be set to the source control value that
# represents the current state of the source code. E.g., a