Skip to content

Commit

Permalink
Add the ability to source RBE related scripts from envsetup.sh
Browse files Browse the repository at this point in the history
This is so that developers don't have to remember to source a separate
script to source RBE related variables.
I'll modify the docs once this change is submitted.

Test:
USE_RBE=true source build/envsetup.sh sources RBE variables.
USE_RBE=false source build/envsetup.sh does NOT source RBE variables.
source build/envsetup.sh does NOT source RBE variables.

Bug: b/193407413
Change-Id: Ib8abf4c307b02fbb0c63b8a62d7aeda8be42d0fb
  • Loading branch information
gkousik committed Jul 12, 2021
1 parent 3755778 commit 9aa9e47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/make/rbesetup.sh --skip-envsetup
fi
}

validate_current_shell
source_vendorsetup
source_rbe
addcompletions
7 changes: 5 additions & 2 deletions rbesetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9aa9e47

Please sign in to comment.