Skip to content

Commit c57f1fc

Browse files
authored
devops(chromium): missing depot tools in prepare_checkout.sh script (#5525)
Make sure `prepare_checkout.sh` has depot_tools in its PATH. Drive-by: enable goma compiler proxy auto-restart.
1 parent 57c7a70 commit c57f1fc

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

browser_patches/chromium/build.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ EOF
1313
)
1414

1515
SCRIPT_PATH=$(pwd -P)
16-
CRREV=$(head -1 ./BUILD_NUMBER)
1716

1817
main() {
1918
if [[ $1 == "--help" || $1 == "-h" ]]; then
@@ -41,15 +40,7 @@ compile_chromium() {
4140
exit 1
4241
fi
4342

44-
# install depot_tools if they are not in system
45-
# NOTE: as of Feb 8, 2021, windows requires manual and separate
46-
# installation of depot_tools.
47-
if ! command -v autoninja >/dev/null; then
48-
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
49-
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
50-
fi
51-
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
52-
fi
43+
source "${SCRIPT_PATH}/ensure_depot_tools.sh"
5344

5445
if [[ $1 == "--compile-mac"* ]]; then
5546
# As of Jan, 2021 Chromium mac compilation requires Xcode12.2
@@ -135,6 +126,7 @@ mirror_chromium() {
135126
fi
136127
fi
137128
129+
CRREV=$(head -1 "${SCRIPT_PATH}/BUILD_NUMBER")
138130
if [[ "${PLATFORM}" == "--mirror-win32" ]]; then
139131
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Win/${CRREV}/chrome-win.zip"
140132
elif [[ "${PLATFORM}" == "--mirror-win64" ]]; then
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Since this script modifies PATH, it cannot be run in a subshell
2+
# and must be sourced.
3+
# Make sure it is sourced.
4+
sourced=0
5+
(return 0 2>/dev/null) && sourced=1 || sourced=0
6+
7+
if [[ $sourced == 0 ]]; then
8+
echo 'ERROR: cannot run this script in a subshell'
9+
echo 'This file modifies $PATH of the current shell, so it must be sourced instead'
10+
echo 'Use `source ensure_depot_tool.sh` instead'
11+
exit 1
12+
fi
13+
14+
# Install depot_tools if they are not in system, and modify $PATH
15+
# to include depot_tools
16+
if ! command -v autoninja >/dev/null; then
17+
if [[ $(uname) == "MINGW"* ]]; then
18+
# NOTE: as of Feb 8, 2021, windows requires manual and separate
19+
# installation of depot_tools.
20+
echo "ERROR: cannot automatically install depot_tools on windows. Please, install manually"
21+
exit 1
22+
fi
23+
SCRIPT_PATH=$(cd "$(dirname "$BASH_SOURCE")"; pwd -P)
24+
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
25+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
26+
fi
27+
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
28+
fi

browser_patches/chromium/goma.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fi
1616

1717
cd electron-build-tools/third_party/goma
1818

19+
export GOMA_START_COMPILER_PROXY=true
20+
1921
if [[ $1 == "--help" ]]; then
2022
echo "$(basename $0) [login|start|stop|--help]"
2123
exit 0

browser_patches/prepare_checkout.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ fi
2929

3030
function prepare_chromium_checkout {
3131
cd "${SCRIPT_PATH}"
32+
33+
source "${SCRIPT_PATH}/chromium/ensure_depot_tools.sh"
34+
3235
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
3336
echo "ERROR: chromium compilation requires CR_CHECKOUT_PATH to be set to reuse checkout."
3437
echo "NOTE: we expect '\$CR_CHECKOUT_PATH/src' to exist to be a valid chromium checkout."

0 commit comments

Comments
 (0)