Fix missing required dependency caused by circular dependency
Fix a bug where if module A requires module B, and for whatever reason
module A and B have some common installed files, then all required
dependencies of the common files would be lost.
For example:
```
# A requires B
ALL_MODULES.A.INSTALLED := a
ALL_MODULES.B.INSTALLED := a b
```
Right now the build system wouldn't generate any dependency for `a`.
However the correct behavior should be: `a` has a order-only dependency
on `b`.
Bug: 157444528
Test: Check generated build-*.ninja
Change-Id: Iec60231f6597ec46077393d1defa109b9c07b208
diff --git a/core/main.mk b/core/main.mk
index 9ba43f6..7179e0b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -748,7 +748,7 @@
$(eval r := $(call module-installed-files,$(r))) \
$(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \
- $(eval h_m := $(filter-out $(h_r), $(h_m))) \
+ $(eval h_r := $(filter-out $(h_m), $(h_r))) \
$(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
) \
)
@@ -764,7 +764,7 @@
$(eval r := $(call module-installed-files,$(r))) \
$(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \
- $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
+ $(eval hc_r := $(filter-out $(hc_m), $(hc_r))) \
$(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
) \
)
@@ -780,7 +780,7 @@
$(eval r := $(call module-installed-files,$(r))) \
$(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
- $(eval t_m := $(filter-out $(t_r), $(t_m))) \
+ $(eval t_r := $(filter-out $(t_m), $(t_r))) \
$(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
) \
)
@@ -807,7 +807,6 @@
)\
$(eval req_files := $(strip $(req_files)))\
$(eval mod_files := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(m)))) \
- $(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
$(if $(mod_files),\
$(eval $(call add-required-deps, $(mod_files),$(req_files))) \
)\
@@ -836,7 +835,6 @@
)\
$(eval req_files := $(strip $(req_files)))\
$(eval mod_files := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(m))))\
- $(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
$(if $(mod_files),\
$(eval $(call add-required-deps, $(mod_files),$(req_files))) \
)\