| #!/bin/bash -e |
| # |
| # 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. |
| # |
| # Runs protoc over the configuration protos to produce generated proto code. |
| |
| # Allows the recursive glob for proto files below to work. |
| shopt -s globstar |
| |
| # Versions of packages to get from CIPD. |
| CIPD_PROTOC_VERSION='v3.6.1' |
| |
| # Move to this script's directory. |
| cd "$(dirname "$0")" |
| |
| # Get protobuf compiler from CIPD. |
| cipd_root=.cipd_bin |
| cipd ensure \ |
| -log-level warning \ |
| -root "${cipd_root}" \ |
| -ensure-file - \ |
| <<ENSURE_FILE |
| infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION} |
| ENSURE_FILE |
| |
| PATH="${cipd_root}:${PATH}" |
| |
| # Collect all the protos and add a src/config prefix. |
| protos=(proto/**/*.proto) |
| protos=( ${protos[@]/#/src/config/} ) |
| |
| protoc -I../../ --descriptor_set_out=starlark/bindings/descpb.bin \ |
| --python_out=payload_utils/bindings \ |
| "${protos[@]}" |