Lann Martin | d8f0c0c | 2019-03-08 11:00:32 -0700 | [diff] [blame^] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | # Version of Protobuf compiler to get from CIPD. |
| 4 | CIPD_PROTOC_VERSION='v3.6.1' |
| 5 | |
| 6 | # Move to this script's directory. |
| 7 | cd "$(dirname "$0")" |
| 8 | |
| 9 | # Get protobuf compiler from CIPD. |
| 10 | cipd_root=.cipd_bin |
| 11 | cipd ensure \ |
| 12 | -log-level warning \ |
| 13 | -root "${cipd_root}" \ |
| 14 | -ensure-file - \ |
| 15 | <<< "infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}" |
| 16 | |
| 17 | protoc="${cipd_root}/protoc" |
| 18 | |
| 19 | # Clean up existing generated files. |
| 20 | find 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 |
| 24 | find src -name '*.proto' -exec \ |
| 25 | "${protoc}" -Isrc --go_out=paths=source_relative:go '{}' \; |