Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.2 KiB

#!/bin/bash
#
# This script sets up a Kokoro MacOS worker for running Protobuf tests
Update the brew workflow - Remove the `brew install`; the kokoro image already has it, just update/upgrade instead. - Remove `prune`, logs had: """ Error: Unknown command: prune """ - Remove `uninstall`, logs had: """ Error: Refusing to uninstall /usr/local/Cellar/cmake/3.16.4 and /usr/local/Cellar/icu4c/64.2 because they are required by ceres-solver, ffmpeg, harfbuzz, libass and opencv, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node icu4c cmake wget """ - Skip installing some things since they are already in the base image, logs had: """ Warning: gflags 2.2.2 is already installed and up-to-date To reinstall 2.2.2, run `brew reinstall gflags` Warning: openssl@1.1 1.1.1g is already installed and up-to-date To reinstall 1.1.1g, run `brew reinstall openssl@1.1` Warning: pcre 8.44 is already installed and up-to-date To reinstall 8.44, run `brew reinstall pcre` """ - Don't install gpg gpg2 as gnupg is already installed, also use gpg instead of gpg2 for commands (and update the commands), logs had: """ kokoro/macos/prepare_build_macos_rc: line 44: gpg2: command not found kokoro/macos/prepare_build_macos_rc: line 45: gpg2: command not found """ - Add env guards to control all the option installs and only request them be installed in the cases that need it. This avoids having to install/update the things like ruby when some other tool only needed in some configs is install differently and could have conflicts. - Switch to brew for cocoapods to avoid compat issues on the supporting libraries.
5 years ago
set -eux
##
# Select Xcode version
# Remember to update the Xcode version when Xcode_11.3.app is not available.
# If xcode is not available, it will probably encounter the failure for
# "autom4te: need GNU m4 1.4 or later: /usr/bin/m4"
# go/kokoro/userdocs/macos/selecting_xcode.md for more information.
export DEVELOPER_DIR=/Applications/Xcode_11.3.app/Contents/Developer
##
# Select C/C++ compilers
export CC=gcc
export CXX=g++
##
Update the brew workflow - Remove the `brew install`; the kokoro image already has it, just update/upgrade instead. - Remove `prune`, logs had: """ Error: Unknown command: prune """ - Remove `uninstall`, logs had: """ Error: Refusing to uninstall /usr/local/Cellar/cmake/3.16.4 and /usr/local/Cellar/icu4c/64.2 because they are required by ceres-solver, ffmpeg, harfbuzz, libass and opencv, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node icu4c cmake wget """ - Skip installing some things since they are already in the base image, logs had: """ Warning: gflags 2.2.2 is already installed and up-to-date To reinstall 2.2.2, run `brew reinstall gflags` Warning: openssl@1.1 1.1.1g is already installed and up-to-date To reinstall 1.1.1g, run `brew reinstall openssl@1.1` Warning: pcre 8.44 is already installed and up-to-date To reinstall 8.44, run `brew reinstall pcre` """ - Don't install gpg gpg2 as gnupg is already installed, also use gpg instead of gpg2 for commands (and update the commands), logs had: """ kokoro/macos/prepare_build_macos_rc: line 44: gpg2: command not found kokoro/macos/prepare_build_macos_rc: line 45: gpg2: command not found """ - Add env guards to control all the option installs and only request them be installed in the cases that need it. This avoids having to install/update the things like ruby when some other tool only needed in some configs is install differently and could have conflicts. - Switch to brew for cocoapods to avoid compat issues on the supporting libraries.
5 years ago
# Brew: update, then upgrade the installed tools to current version and install
# some needed ones not in the Kokoro base image. This ensure current versions
# of CMake, autotools, etc.
# But first...
#
# The transitive deps of the installed tools need protobuf, but Kokoro manually
# installed it outside of brew so it needs to be removed so brew can install the
# tools (and a newer version of protobuf). g/kokoro-users/7FRvQMUdN40 about why
# it is a manual install vs. a brew install in the first place.
sudo rm -rf \
/usr/local/include/google/protobuf \
/usr/local/bin/protoc
# Likewise, updating python can have issues because of some existing binaries.
sudo rm -rf \
/usr/local/bin/2to3* \
/usr/local/bin/idle3* \
/usr/local/bin/pydoc3* \
/usr/local/bin/python3* \
/usr/local/bin/pyvenv*
brew update
brew upgrade
##
# Install Ruby
Update the brew workflow - Remove the `brew install`; the kokoro image already has it, just update/upgrade instead. - Remove `prune`, logs had: """ Error: Unknown command: prune """ - Remove `uninstall`, logs had: """ Error: Refusing to uninstall /usr/local/Cellar/cmake/3.16.4 and /usr/local/Cellar/icu4c/64.2 because they are required by ceres-solver, ffmpeg, harfbuzz, libass and opencv, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node icu4c cmake wget """ - Skip installing some things since they are already in the base image, logs had: """ Warning: gflags 2.2.2 is already installed and up-to-date To reinstall 2.2.2, run `brew reinstall gflags` Warning: openssl@1.1 1.1.1g is already installed and up-to-date To reinstall 1.1.1g, run `brew reinstall openssl@1.1` Warning: pcre 8.44 is already installed and up-to-date To reinstall 8.44, run `brew reinstall pcre` """ - Don't install gpg gpg2 as gnupg is already installed, also use gpg instead of gpg2 for commands (and update the commands), logs had: """ kokoro/macos/prepare_build_macos_rc: line 44: gpg2: command not found kokoro/macos/prepare_build_macos_rc: line 45: gpg2: command not found """ - Add env guards to control all the option installs and only request them be installed in the cases that need it. This avoids having to install/update the things like ruby when some other tool only needed in some configs is install differently and could have conflicts. - Switch to brew for cocoapods to avoid compat issues on the supporting libraries.
5 years ago
if [[ "${KOKORO_INSTALL_RUBY:-}" == "yes" ]] ; then
brew install ruby
fi
##
# Install Cocoapods
if [[ "${KOKORO_INSTALL_COCOAPODS:-}" == "yes" ]] ; then
# The existing cocoapods was installed via gem, but that doesn't work well
# with the overlap in deps with things managed by brew (errors around ruby
# versions, etc.); so remove it and install in via brew instead.
gem uninstall -a "$(gem list | grep cocoapods | cut -d ' ' -f 1)"
brew install cocoapods
fi
##
# Install Tox
Update the brew workflow - Remove the `brew install`; the kokoro image already has it, just update/upgrade instead. - Remove `prune`, logs had: """ Error: Unknown command: prune """ - Remove `uninstall`, logs had: """ Error: Refusing to uninstall /usr/local/Cellar/cmake/3.16.4 and /usr/local/Cellar/icu4c/64.2 because they are required by ceres-solver, ffmpeg, harfbuzz, libass and opencv, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node icu4c cmake wget """ - Skip installing some things since they are already in the base image, logs had: """ Warning: gflags 2.2.2 is already installed and up-to-date To reinstall 2.2.2, run `brew reinstall gflags` Warning: openssl@1.1 1.1.1g is already installed and up-to-date To reinstall 1.1.1g, run `brew reinstall openssl@1.1` Warning: pcre 8.44 is already installed and up-to-date To reinstall 8.44, run `brew reinstall pcre` """ - Don't install gpg gpg2 as gnupg is already installed, also use gpg instead of gpg2 for commands (and update the commands), logs had: """ kokoro/macos/prepare_build_macos_rc: line 44: gpg2: command not found kokoro/macos/prepare_build_macos_rc: line 45: gpg2: command not found """ - Add env guards to control all the option installs and only request them be installed in the cases that need it. This avoids having to install/update the things like ruby when some other tool only needed in some configs is install differently and could have conflicts. - Switch to brew for cocoapods to avoid compat issues on the supporting libraries.
5 years ago
if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then
sudo pip install tox==2.4.1
fi
##
# Install RVM
Update the brew workflow - Remove the `brew install`; the kokoro image already has it, just update/upgrade instead. - Remove `prune`, logs had: """ Error: Unknown command: prune """ - Remove `uninstall`, logs had: """ Error: Refusing to uninstall /usr/local/Cellar/cmake/3.16.4 and /usr/local/Cellar/icu4c/64.2 because they are required by ceres-solver, ffmpeg, harfbuzz, libass and opencv, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node icu4c cmake wget """ - Skip installing some things since they are already in the base image, logs had: """ Warning: gflags 2.2.2 is already installed and up-to-date To reinstall 2.2.2, run `brew reinstall gflags` Warning: openssl@1.1 1.1.1g is already installed and up-to-date To reinstall 1.1.1g, run `brew reinstall openssl@1.1` Warning: pcre 8.44 is already installed and up-to-date To reinstall 8.44, run `brew reinstall pcre` """ - Don't install gpg gpg2 as gnupg is already installed, also use gpg instead of gpg2 for commands (and update the commands), logs had: """ kokoro/macos/prepare_build_macos_rc: line 44: gpg2: command not found kokoro/macos/prepare_build_macos_rc: line 45: gpg2: command not found """ - Add env guards to control all the option installs and only request them be installed in the cases that need it. This avoids having to install/update the things like ruby when some other tool only needed in some configs is install differently and could have conflicts. - Switch to brew for cocoapods to avoid compat issues on the supporting libraries.
5 years ago
if [[ "${KOKORO_INSTALL_RVM:-}" == "yes" ]] ; then
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby
fi