From a9cc25d7852bed719e9e0ec021b9e796d4d0aec6 Mon Sep 17 00:00:00 2001 From: Ramy Medhat Date: Mon, 27 Jan 2020 14:21:24 -0500 Subject: [PATCH] Add RBE support for Javac, R8, and D8 if respective env vars are set. Test: aosp_crosshatch build with and without the new variables. Change-Id: I252ff5dd8e372edf8c86e25348c8a2bfab41d70d --- core/definitions.mk | 4 ++-- core/rbe.mk | 19 ++++++++++++++++--- core/soong_config.mk | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index 3a2328942..fd785b8e3 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2200,7 +2200,7 @@ define transform-classes.jar-to-dex @mkdir -p $(dir $@) $(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar $(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class" -$(hide) $(DX_COMMAND) $(DEX_FLAGS) \ +$(hide) $(D8_WRAPPER) $(DX_COMMAND) $(DEX_FLAGS) \ --output $(dir $@) \ $(addprefix --lib ,$(PRIVATE_D8_LIBS)) \ --min-api $(PRIVATE_MIN_SDK_VERSION) \ @@ -2679,7 +2679,7 @@ endif define transform-jar-to-dex-r8 @echo R8: $@ $(hide) rm -f $(PRIVATE_PROGUARD_DICTIONARY) -$(hide) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \ +$(hide) $(R8_WRAPPER) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \ -injars '$<' \ --min-api $(PRIVATE_MIN_SDK_VERSION) \ --no-data-resources \ diff --git a/core/rbe.mk b/core/rbe.mk index 231859bd9..6a923664b 100644 --- a/core/rbe.mk +++ b/core/rbe.mk @@ -21,12 +21,25 @@ ifneq ($(filter-out false,$(USE_RBE)),) else rbe_dir := $(HOME)/rbe endif - RBE_WRAPPER := $(rbe_dir)/rewrapper --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD + RBE_WRAPPER := $(rbe_dir)/rewrapper + RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD # Append rewrapper to existing *_WRAPPER variables so it's possible to # use both ccache and rewrapper. - CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER)) - CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER)) + CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX)) + CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX)) + + ifdef RBE_JAVAC + JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac,shallow=true) + endif + + ifdef RBE_R8 + R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8,shallow=true) + endif + + ifdef RBE_D8 + D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8,shallow=true) + endif rbe_dir := endif diff --git a/core/soong_config.mk b/core/soong_config.mk index d223792f8..95ff5efb9 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -156,6 +156,9 @@ $(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT $(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA))) $(call add_json_bool, UseRBE, $(filter-out false,$(USE_RBE))) +$(call add_json_bool, UseRBEJAVAC, $(filter-out false,$(RBE_JAVAC))) +$(call add_json_bool, UseRBER8, $(filter-out false,$(RBE_R8))) +$(call add_json_bool, UseRBED8, $(filter-out false,$(RBE_D8))) $(call add_json_bool, Arc, $(filter true,$(TARGET_ARC))) $(call add_json_list, NamespacesToExport, $(PRODUCT_SOONG_NAMESPACES))