Move build number file to out/soong

Move the build number file to out/soong so Soong can treat it
as an output path, and pass the name of the file to Soong instead
of the command to read it.

Test: m checkbuild
Change-Id: I9e1aecf33d11fe4fde34cd57cc9b1f1ad49b0424
This commit is contained in:
Colin Cross 2020-02-21 17:29:37 -08:00
parent 9581181338
commit d68a88402f
3 changed files with 7 additions and 5 deletions

View File

@ -820,7 +820,7 @@ else
MAINLINE_SEPOLICY_DEV_CERTIFICATES := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
endif
BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
BUILD_NUMBER_FROM_FILE := $$(cat $(SOONG_OUT_DIR)/build_number.txt)
BUILD_DATETIME_FROM_FILE := $$(cat $(BUILD_DATETIME_FILE))
# SEPolicy versions

View File

@ -38,11 +38,13 @@ include $(BUILD_SYSTEM)/clang/config.mk
# Write the build number to a file so it can be read back in
# without changing the command line every time. Avoids rebuilds
# when using ninja.
$(shell mkdir -p $(OUT_DIR) && \
echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt)
BUILD_NUMBER_FILE := $(OUT_DIR)/build_number.txt
$(shell mkdir -p $(SOONG_OUT_DIR) && \
echo -n $(BUILD_NUMBER) > $(SOONG_OUT_DIR)/build_number.txt)
BUILD_NUMBER_FILE := $(SOONG_OUT_DIR)/build_number.txt
.KATI_READONLY := BUILD_NUMBER_FILE
$(KATI_obsolete_var BUILD_NUMBER,See https://android.googlesource.com/platform/build/+/master/Changes.md#BUILD_NUMBER)
$(BUILD_NUMBER_FILE):
touch $@
DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
.KATI_READONLY := DATE_FROM_FILE

View File

@ -25,7 +25,7 @@ $(call json_start)
$(call add_json_str, Make_suffix, -$(TARGET_PRODUCT))
$(call add_json_str, BuildId, $(BUILD_ID))
$(call add_json_str, BuildNumberFromFile, $(BUILD_NUMBER_FROM_FILE))
$(call add_json_str, BuildNumberFile, build_number.txt)
$(call add_json_str, Platform_version_name, $(PLATFORM_VERSION))
$(call add_json_val, Platform_sdk_version, $(PLATFORM_SDK_VERSION))