summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--envsetup.sh10
-rw-r--r--rbesetup.sh7
2 files changed, 15 insertions, 2 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 4f9440e9fb..77b22477a6 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1871,6 +1871,16 @@ function showcommands() {
fi
}
+# Source necessary setup scripts needed to run the build with Remote Execution.
+function source_rbe() {
+ local T=$(gettop)
+
+ if [[ "x$USE_RBE" != "x" && "$USE_RBE" != "false" ]]; then
+ . $T/build/make/rbesetup.sh --skip-envsetup
+ fi
+}
+
validate_current_shell
source_vendorsetup
+source_rbe
addcompletions
diff --git a/rbesetup.sh b/rbesetup.sh
index ec39e6ef17..3b0e7cf7dc 100644
--- a/rbesetup.sh
+++ b/rbesetup.sh
@@ -24,8 +24,11 @@ function _source_env_setup_script() {
}
# This function needs to run first as the remaining defining functions may be
-# using the envsetup.sh defined functions.
-_source_env_setup_script || return
+# using the envsetup.sh defined functions. Skip this part if this script is already
+# being invoked from envsetup.sh.
+if [[ "$1" != "--skip-envsetup" ]]; then
+ _source_env_setup_script || return
+fi
# This function prefixes the given command with appropriate variables needed
# for the build to be executed with RBE.