Install protoc and gencodec

mockgen is installed as part of go get -t ./... (which pulls in gomock).
pull/457/head
Eugene Kim 6 years ago
parent 7d19151be7
commit 3034d8c217
  1. 3
      .travis.yml
  2. 45
      scripts/install_protoc.sh

@ -23,6 +23,9 @@ install:
- go get -u golang.org/x/lint/golint
- go get -u golang.org/x/tools/cmd/goimports
- go get gopkg.in/check.v1
- go get github.com/harmony-ek/gencodec
- go get github.com/golang/protobuf/protoc-gen-go
- ./scripts/install_protoc.sh -V 3.6.1
- ./scripts/travis_checker.sh
- go build -v ./...
script:

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -eu
unset -v opt OPTIND OPTARG version platform destdir
version=
platform=
destdir=/usr/local
while getopts :V:P:d: opt
do
case "${opt}" in
V) version="${OPTARG}";;
P) platform="${OPTARG}";;
d) destdir="${OPTARG}";;
"?") echo "unrecognized option -${OPTARG}" >&2; exit 64;;
":") echo "missing argument for -${OPTARG}" >&2; exit 64;;
*) echo "unhandled option -${OPTARG}" >&2; exit 70;;
esac
done
shift $((${OPTIND} - 1))
case "${version}" in
"") echo "protobuf version (-V) not specified" >&2; exit 64;;
esac
case "${platform}" in
"")
platform=$(uname -s)
case "${platform}" in
Darwin) platform=osx;;
Linux) platform=linux;;
*) echo "unsupported OS name (${platform})" >&2; exit 69;;
esac
platform="${platform}-$(uname -m)"
;;
esac
unset -v tmpdir
trap 'case "${tmpdir-}" in ?*) rm -rf "${tmpdir}";; esac' EXIT
tmpdir=$(mktemp -d)
cd "${tmpdir}"
unset -v filename url
filename="protoc-${version}-${platform}.zip"
url="https://github.com/protocolbuffers/protobuf/releases/download/v${version}/${filename}"
echo "Downloading protoc v${version} for ${platform}..."
curl -s -S -L -o "${filename}" "${url}"
echo "Downloaded as ${filename}; unzipping into ${destdir}..."
sudo unzip -o -d "${destdir}" "${filename}"
echo "protoc v${version} has been installed in ${destdir}."
exit 0
Loading…
Cancel
Save