playwright/browser_patches/chromium/goma.sh

58 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
2021-02-16 19:34:13 +03:00
set -x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
if [[ ! -d ./electron-build-tools ]]; then
git clone --single-branch --branch master https://github.com/electron/build-tools/ electron-build-tools
cd electron-build-tools
npm install
mkdir -p third_party
./src/e update-goma msftGoma
cd ..
fi
cd electron-build-tools/third_party/goma
export GOMA_START_COMPILER_PROXY=true
if [[ $1 == "--help" ]]; then
echo "$(basename "$0") [login|start|stop|--help]"
exit 0
elif [[ $1 == "login" ]]; then
2021-02-09 21:00:53 +03:00
if [[ $(uname) == "MINGW"* ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_auth.bat) login"
2021-02-09 21:00:53 +03:00
else
python ./goma_auth.py login
2021-02-09 21:00:53 +03:00
fi
elif [[ $1 == "start" ]]; then
# We have to prefix ENV with `PLAYWRIGHT` since `GOMA_` env variables
# have special treatment by goma.
if [[ ! -z "$PLAYWRIGHT_GOMA_LOGIN_COOKIE" ]]; then
echo "$PLAYWRIGHT_GOMA_LOGIN_COOKIE" > "$HOME/.goma_oauth2_config"
fi
if [[ ! -f "$HOME/.goma_oauth2_config" ]]; then
echo "ERROR: goma is not logged in!"
echo "run '$(basename "$0") login'"
exit 1
fi
2021-02-09 21:00:53 +03:00
if [[ $(uname) == "MINGW"* ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_ctl.bat) ensure_start"
2021-02-09 21:00:53 +03:00
else
python ./goma_ctl.py ensure_start
2021-02-09 21:00:53 +03:00
fi
elif [[ $1 == "stop" ]]; then
2021-02-09 21:00:53 +03:00
if [[ $(uname) == "MINGW"* ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w $(pwd)/goma_ctl.bat) stop"
2021-02-09 21:00:53 +03:00
else
python ./goma_ctl.py stop
2021-02-09 21:00:53 +03:00
fi
else
echo "ERROR: unknown command - $1"
echo "Use --help to list all available commands"
exit 1
fi