blob: c4250c7f5ff660d22347ffb06e6ebf6716ae5cec [file] [log] [blame]
Lann Martind8f0c0c2019-03-08 11:00:32 -07001#!/bin/bash -e
Sean Abrahamfdabbe72019-03-13 09:03:37 -06002#
3# Copyright 2019 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7# Runs protoc over the protos in this repo to produce generated proto code.
Lann Martind8f0c0c2019-03-08 11:00:32 -07008
9# Version of Protobuf compiler to get from CIPD.
10CIPD_PROTOC_VERSION='v3.6.1'
11
12# Move to this script's directory.
13cd "$(dirname "$0")"
14
15# Get protobuf compiler from CIPD.
16cipd_root=.cipd_bin
17cipd ensure \
18 -log-level warning \
19 -root "${cipd_root}" \
20 -ensure-file - \
21 <<< "infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}"
22
23protoc="${cipd_root}/protoc"
24
25# Clean up existing generated files.
26find go -name '*.pb.go' -exec rm '{}' \;
27
28# Go files need to be processed individually until this is fixed:
29# https://github.com/golang/protobuf/issues/39
30find src -name '*.proto' -exec \
31 "${protoc}" -Isrc --go_out=paths=source_relative:go '{}' \;