blob: 2fb814c0d40bf8d748dc1d50520ed22393063374 [file] [log] [blame]
Lann Martind8f0c0c2019-03-08 11:00:32 -07001#!/bin/bash -e
2
3# Version of Protobuf compiler to get from CIPD.
4CIPD_PROTOC_VERSION='v3.6.1'
5
6# Move to this script's directory.
7cd "$(dirname "$0")"
8
9# Get protobuf compiler from CIPD.
10cipd_root=.cipd_bin
11cipd ensure \
12 -log-level warning \
13 -root "${cipd_root}" \
14 -ensure-file - \
15 <<< "infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}"
16
17protoc="${cipd_root}/protoc"
18
19# Clean up existing generated files.
20find go -name '*.pb.go' -exec rm '{}' \;
21
22# Go files need to be processed individually until this is fixed:
23# https://github.com/golang/protobuf/issues/39
24find src -name '*.proto' -exec \
25 "${protoc}" -Isrc --go_out=paths=source_relative:go '{}' \;