forked from openkylin/platform_build
Decentralizes cleanspecs.
After this change, you should add-clean-step at the end of CleanSpec.mk in your project, instead of the centralized cleanspecs.mk in build/core.
This commit is contained in:
parent
b7aa96bf8e
commit
fa9ae7bbbe
|
@ -16,28 +16,40 @@
|
||||||
INTERNAL_CLEAN_STEPS :=
|
INTERNAL_CLEAN_STEPS :=
|
||||||
|
|
||||||
# Builds up a list of clean steps. Creates a unique
|
# Builds up a list of clean steps. Creates a unique
|
||||||
# id for each step by taking INTERNAL_CLEAN_BUILD_VERSION
|
# id for each step by taking makefile path, INTERNAL_CLEAN_BUILD_VERSION
|
||||||
# and appending an increasing number of '@' characters.
|
# and appending an increasing number of '@' characters.
|
||||||
#
|
#
|
||||||
# $(1): shell command to run
|
# $(1): shell command to run
|
||||||
|
# $(2): indicate to not use makefile path as part of step id if not empty.
|
||||||
|
# $(2) should only be used in build/core/cleanspec.mk: just for compatibility.
|
||||||
define _add-clean-step
|
define _add-clean-step
|
||||||
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
|
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
|
||||||
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
|
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
|
||||||
$(eval _acs_id := $(strip $(lastword $(INTERNAL_CLEAN_STEPS))))
|
$(eval _acs_makefile_prefix := $(lastword $(MAKEFILE_LIST)))
|
||||||
$(if $(_acs_id),,$(eval _acs_id := $(INTERNAL_CLEAN_BUILD_VERSION)))
|
$(eval _acs_makefile_prefix := $(subst /,_,$(_acs_makefile_prefix)))
|
||||||
$(eval _acs_id := $(_acs_id)@)
|
$(eval _acs_makefile_prefix := $(subst .,-,$(_acs_makefile_prefix)))
|
||||||
|
$(eval _acs_makefile_prefix := $(_acs_makefile_prefix)_acs)
|
||||||
|
$(if $($(_acs_makefile_prefix)),,\
|
||||||
|
$(eval $(_acs_makefile_prefix) := $(INTERNAL_CLEAN_BUILD_VERSION)))
|
||||||
|
$(eval $(_acs_makefile_prefix) := $($(_acs_makefile_prefix))@)
|
||||||
|
$(if $(strip $(2)),$(eval _acs_id := $($(_acs_makefile_prefix))),\
|
||||||
|
$(eval _acs_id := $(_acs_makefile_prefix)$($(_acs_makefile_prefix))))
|
||||||
$(eval INTERNAL_CLEAN_STEPS += $(_acs_id))
|
$(eval INTERNAL_CLEAN_STEPS += $(_acs_id))
|
||||||
$(eval INTERNAL_CLEAN_STEP.$(_acs_id) := $(1))
|
$(eval INTERNAL_CLEAN_STEP.$(_acs_id) := $(1))
|
||||||
$(eval _acs_id :=)
|
$(eval _acs_id :=)
|
||||||
|
$(eval _acs_makefile_prefix :=)
|
||||||
endef
|
endef
|
||||||
define add-clean-step
|
define add-clean-step
|
||||||
$(if $(call _add-clean-step,$(1)),)
|
$(eval # for build/core/cleanspec.mk, dont use makefile path as part of step id) \
|
||||||
|
$(if $(filter %/cleanspec.mk,$(lastword $(MAKEFILE_LIST))),\
|
||||||
|
$(eval $(call _add-clean-step,$(1),true)),\
|
||||||
|
$(eval $(call _add-clean-step,$(1))))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Defines INTERNAL_CLEAN_BUILD_VERSION and the individual clean steps.
|
# Defines INTERNAL_CLEAN_BUILD_VERSION and the individual clean steps.
|
||||||
# cleanspec.mk is outside of the core directory so that more people
|
# cleanspec.mk is outside of the core directory so that more people
|
||||||
# can have permission to touch it.
|
# can have permission to touch it.
|
||||||
include build/cleanspec.mk
|
include $(BUILD_SYSTEM)/cleanspec.mk
|
||||||
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
|
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
|
||||||
|
|
||||||
# If the clean_steps.mk file is missing (usually after a clean build)
|
# If the clean_steps.mk file is missing (usually after a clean build)
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
|
|
||||||
# Just bump this if you want to force a clean build.
|
# Just bump this if you want to force a clean build.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
# WHEN DOING SO, DELETE ANY "add-clean-step" ENTRIES THAT HAVE PILED UP.
|
# WHEN DOING SO
|
||||||
|
# 1. DELETE ANY "add-clean-step" ENTRIES THAT HAVE PILED UP IN THIS FILE.
|
||||||
|
# 2. REMOVE ALL FILES NAMED CleanSpec.mk.
|
||||||
|
# 3. BUMP THE VERSION.
|
||||||
|
# IDEALLY, THOSE STEPS SHOULD BE DONE ATOMICALLY.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
#
|
#
|
||||||
INTERNAL_CLEAN_BUILD_VERSION := 3
|
INTERNAL_CLEAN_BUILD_VERSION := 3
|
||||||
|
@ -160,3 +164,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Launcher.apk)
|
||||||
# ************************************************
|
# ************************************************
|
||||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
||||||
# ************************************************
|
# ************************************************
|
||||||
|
|
||||||
|
subdir_cleanspecs := \
|
||||||
|
$(shell build/tools/findleaves.py --prune=out --prune=.repo --prune=.git . CleanSpec.mk)
|
||||||
|
include $(subdir_cleanspecs)
|
||||||
|
subdir_cleanspecs :=
|
Loading…
Reference in New Issue