Move auto installclean to soong_ui

This way kati doesn't need to keep state for which build got run last,
and we have to run kati less often. This was forcing another kati run
for an empty out directory, and a kati run (or two) every time you
switched products that shared a device.

Bug: 35970961
Test: m clean; m -j blueprint_tools; m -j blueprint_tools; m -j blueprint_tools
Test: lunch aosp_arm-eng; m -j blueprint_tools; lunch full-eng; m -j blueprint_tools; <repeat>
Change-Id: I825a0868fb7059016a940c76244527432e3e7cff
This commit is contained in:
Dan Willemsen
2017-05-12 19:28:46 -07:00
parent 3eb44160e0
commit 85e55ceff2

View File

@@ -144,52 +144,6 @@ INTERNAL_CLEAN_BUILD_VERSION :=
endif # if not ONE_SHOT_MAKEFILE dont_bother NO_ANDROID_CLEANSPEC endif # if not ONE_SHOT_MAKEFILE dont_bother NO_ANDROID_CLEANSPEC
# Since products and build variants (unfortunately) share the same
# PRODUCT_OUT staging directory, things can get out of sync if different
# build configurations are built in the same tree. The following logic
# will notice when the configuration has changed and remove the files
# necessary to keep things consistent.
previous_build_config_file := $(PRODUCT_OUT)/previous_build_config.mk
current_build_config_file := $(PRODUCT_OUT)/current_build_config.mk
current_build_config := \
$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
force_installclean := false
# Read the current state from the file, if present.
# Will set PREVIOUS_BUILD_CONFIG.
#
PREVIOUS_BUILD_CONFIG :=
-include $(previous_build_config_file)
PREVIOUS_BUILD_CONFIG := $(strip $(PREVIOUS_BUILD_CONFIG))
ifdef PREVIOUS_BUILD_CONFIG
ifneq ($(current_build_config),$(PREVIOUS_BUILD_CONFIG))
$(info *** Build configuration changed: "$(PREVIOUS_BUILD_CONFIG)" -> "$(current_build_config)")
ifneq ($(DISABLE_AUTO_INSTALLCLEAN),true)
force_installclean := true
else
$(info DISABLE_AUTO_INSTALLCLEAN is set; skipping auto-clean. Your tree may be in an inconsistent state.)
endif
endif
endif # else, this is the first build, so no need to clean.
# Write the new state to the file.
#
$(shell \
mkdir -p $(dir $(current_build_config_file)) && \
echo "PREVIOUS_BUILD_CONFIG := $(current_build_config)" > \
$(current_build_config_file) \
)
$(shell cmp $(current_build_config_file) $(previous_build_config_file) > /dev/null 2>&1 || \
mv -f $(current_build_config_file) $(previous_build_config_file))
PREVIOUS_BUILD_CONFIG :=
previous_build_config_file :=
current_build_config_file :=
current_build_config :=
# #
# installclean logic # installclean logic
# #
@@ -272,14 +226,6 @@ installclean: dataclean
$(hide) rm -rf $(FILES) $(hide) rm -rf $(FILES)
@echo "Deleted images and staging directories." @echo "Deleted images and staging directories."
ifeq ($(force_installclean),true)
$(info *** Forcing "make installclean"...)
$(info *** rm -rf $(dataclean_files) $(installclean_files))
$(shell rm -rf $(dataclean_files) $(installclean_files))
$(info *** Done with the cleaning, now starting the real build.)
endif
force_installclean :=
########################################################### ###########################################################
.PHONY: clean-jack-files .PHONY: clean-jack-files