Loading Changes.md +17 −0 Original line number Diff line number Diff line # Build System Changes for Android.mk Writers ## `BUILD_NUMBER` removal from Android.mk {#BUILD_NUMBER} `BUILD_NUMBER` should not be used directly in Android.mk files, as it would trigger them to be re-read every time the `BUILD_NUMBER` changes (which it does on every build server build). If possible, just remove the use so that your builds are more reproducible. If you do need it, use `BUILD_NUMBER_FROM_FILE`: ``` make $(LOCAL_BUILT_MODULE): mytool --build_number $(BUILD_NUMBER_FROM_FILE) -o $@ ``` That will expand out to a subshell that will read the current `BUILD_NUMBER` whenever it's run. It will not re-run your command if the build number has changed, so incremental builds will have the build number from the last time the particular output was rebuilt. ## `DIST_DIR`, `dist_goal`, and `dist-for-goals` {#dist} `DIST_DIR` and `dist_goal` are no longer available when reading Android.mk Loading core/main.mk +4 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,15 @@ include $(BUILD_SYSTEM)/clang/config.mk $(shell mkdir -p $(OUT_DIR) && \ echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt) BUILD_NUMBER_FILE := $(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) ifeq ($(HOST_OS),darwin) DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE) else DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE) endif .KATI_READONLY := DATE_FROM_FILE # Pick a reasonable string to use to identify files. ifeq ($(strip $(HAS_BUILD_NUMBER)),false) Loading @@ -81,6 +84,7 @@ ifeq ($(strip $(HAS_BUILD_NUMBER)),false) else FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE)) endif .KATI_READONLY := FILE_NAME_TAG # Make an empty directory, which can be used to make empty jars EMPTY_DIRECTORY := $(OUT_DIR)/empty Loading Loading
Changes.md +17 −0 Original line number Diff line number Diff line # Build System Changes for Android.mk Writers ## `BUILD_NUMBER` removal from Android.mk {#BUILD_NUMBER} `BUILD_NUMBER` should not be used directly in Android.mk files, as it would trigger them to be re-read every time the `BUILD_NUMBER` changes (which it does on every build server build). If possible, just remove the use so that your builds are more reproducible. If you do need it, use `BUILD_NUMBER_FROM_FILE`: ``` make $(LOCAL_BUILT_MODULE): mytool --build_number $(BUILD_NUMBER_FROM_FILE) -o $@ ``` That will expand out to a subshell that will read the current `BUILD_NUMBER` whenever it's run. It will not re-run your command if the build number has changed, so incremental builds will have the build number from the last time the particular output was rebuilt. ## `DIST_DIR`, `dist_goal`, and `dist-for-goals` {#dist} `DIST_DIR` and `dist_goal` are no longer available when reading Android.mk Loading
core/main.mk +4 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,15 @@ include $(BUILD_SYSTEM)/clang/config.mk $(shell mkdir -p $(OUT_DIR) && \ echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt) BUILD_NUMBER_FILE := $(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) ifeq ($(HOST_OS),darwin) DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE) else DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE) endif .KATI_READONLY := DATE_FROM_FILE # Pick a reasonable string to use to identify files. ifeq ($(strip $(HAS_BUILD_NUMBER)),false) Loading @@ -81,6 +84,7 @@ ifeq ($(strip $(HAS_BUILD_NUMBER)),false) else FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE)) endif .KATI_READONLY := FILE_NAME_TAG # Make an empty directory, which can be used to make empty jars EMPTY_DIRECTORY := $(OUT_DIR)/empty Loading