/
prepare_build_macos_rc
executable file
·49 lines (37 loc) · 1.1 KB
/
prepare_build_macos_rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# This script sets up a Kokoro MacOS worker for running Protobuf tests
set -eux
export HOMEBREW_PREFIX=$(brew --prefix)
##
# Remove any pre-existing protobuf installation.
brew uninstall protobuf
##
# Select Xcode version
##
# Select Xcode version
export DEVELOPER_DIR=/Applications/Xcode_14.app/Contents/Developer
sudo xcode-select -s "${DEVELOPER_DIR}"
##
# Select C/C++ compilers
export CC=gcc
export CXX=g++
##
# Install Python 2 by default
eval "$(pyenv init -)"
pyenv install -v -s 2.7.18 && pyenv global 2.7.18
##
# Install Tox
if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then
pyenv install -v -s 3.7.13
pyenv global 3.7.13
sudo python -m pip install --upgrade pip tox tox-pyenv
fi
##
# Setup RVM
if [[ "${KOKORO_INSTALL_RVM:-}" == "yes" ]] ; then
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-cask
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-services
sudo chown -R $(whoami) $HOME/.rvm/
fi