Use order-only dependencies for symbols files
Use an order-only dependency from $(LOCAL_BUILT_MODULE) to the symbols
file so that wiping the symbols directory during installclean doesn't
force anything to rebuild.
Bug: 186507256
Test: m && rm -rf $OUT/symbols && m
Change-Id: Ic164819c71f9db6126ff91c58752c8727cde0d5e
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 8f0702b..393053d 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -68,7 +68,7 @@
endif
LOCAL_MODULE_CLASS := ETC
include $(BUILD_PREBUILT)
- $(LOCAL_BUILT_MODULE): $(my_unstripped_installed)
+ $(LOCAL_BUILT_MODULE): | $(my_unstripped_installed)
# Installing boot.art causes all boot image bits to be installed.
# Keep this old behavior in case anyone still needs it.
$(LOCAL_INSTALLED_MODULE): $(my_installed)
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 48072b3..5120e7e 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -87,9 +87,14 @@
###########################################################
## Strip
###########################################################
-strip_input := $(symbolic_output)
+strip_input := $(inject_module)
strip_output := $(LOCAL_BUILT_MODULE)
+# Use an order-only dependency to ensure the unstripped file in the symbols
+# directory is copied when the module is built, but does not force the
+# module to be rebuilt when the symbols directory is cleaned by installclean.
+$(strip_output): | $(symbolic_output)
+
my_strip_module := $(firstword \
$(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
$(LOCAL_STRIP_MODULE))
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index b7c21b8..82fb413 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -147,7 +147,7 @@
# install symbol files of JNI libraries
my_jni_lib_symbols_copy_files := $(foreach f,$(LOCAL_SOONG_JNI_LIBS_SYMBOLS),\
$(call word-colon,1,$(f)):$(patsubst $(PRODUCT_OUT)/%,$(TARGET_OUT_UNSTRIPPED)/%,$(call word-colon,2,$(f))))
-$(LOCAL_BUILT_MODULE): $(call copy-many-files, $(my_jni_lib_symbols_copy_files))
+$(LOCAL_BUILT_MODULE): | $(call copy-many-files, $(my_jni_lib_symbols_copy_files))
# embedded JNI will already have been handled by soong
my_embed_jni :=
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index a12ef66..4d7b614 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -170,7 +170,7 @@
my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path))
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
$(eval $(call copy-one-file,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output)))
- $(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output))
+ $(LOCAL_BUILT_MODULE): | $(symbolic_output)
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
diff --git a/core/soong_rust_prebuilt.mk b/core/soong_rust_prebuilt.mk
index c382f6a..26c099b 100644
--- a/core/soong_rust_prebuilt.mk
+++ b/core/soong_rust_prebuilt.mk
@@ -119,7 +119,7 @@
my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path))
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
$(eval $(call copy-one-file,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output)))
- $(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output))
+ $(LOCAL_BUILT_MODULE): | $(symbolic_output)
endif
endif