blob: cb32d161ef1af50c6f384edc455b48ab24931046 [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Sets up cipd packages for presubmit scripts.
# Scripts should set the script_dir variable and source this file:
# readonly script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")"
# source "${script_dir}/"
# Upon completion of this script the $PATH has been adjusted and other
# environment variables, such as $CIPD_ROOT, also exist for finer grained
# control.
if [[ -z "${script_dir}" ]]; then
echo "The script_dir variable must be set when is called."
exit 1
# Versions of packages to get from CIPD.
readonly CIPD_PROTOC_VERSION='v3.6.1'
readonly CIPD_PROTOC_GEN_GO_VERSION='v1.3.2'
readonly CIPD_ROOT="${script_dir}/.cipd_bin"
cipd ensure \
-log-level warning \
-root "${CIPD_ROOT}" \
-ensure-file - \
infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}
chromiumos/infra/tools/protoc-gen-go version:${CIPD_PROTOC_GEN_GO_VERSION}
infra/3pp/tools/go/\${platform} latest
# Install buildifier (Starlark formatter) and add to PATH.
go get
PATH="$(go env GOPATH)/bin:${PATH}"