Set pools manually for rules that can run in RBE or goma
Use .KATI_NINJA_POOL := none to mark rules that can run in RBE or
goma when they are enabled, which along with passing
--default_pool=local_pool will allow moving remoteable jobs into
the remote pool without relying on hacks in kati.
Fixes: 143938974
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_RBE=true
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_GOMA=true
Change-Id: I08615ae1f2eaef9ff0ba253b8aa3d83ab57ebb27
diff --git a/core/definitions.mk b/core/definitions.mk
index 8eb1142..b419aae 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1363,8 +1363,10 @@
# $(1): the C++ source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-cpp-file
o := $(intermediates)/$(patsubst %$(LOCAL_CPP_EXTENSION),%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG_CXX)
$$(transform-$$(PRIVATE_HOST)cpp-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1376,8 +1378,10 @@
# $(1): the C source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-c-file
o := $(intermediates)/$(patsubst %.c,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)c-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1389,8 +1393,10 @@
# $(1): the .S source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-s-file
o := $(intermediates)/$(patsubst %.S,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1402,8 +1408,10 @@
# $(1): the .s source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-s-file-no-deps
o := $(intermediates)/$(patsubst %.s,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$(3) += $$(o)