David Burger | c33d1eb | 2020-01-21 14:24:50 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | # |
| 3 | # Copyright 2020 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 configuration protos to produce generated proto code. |
| 8 | |
David Burger | 1b84536 | 2020-02-13 14:43:37 -0700 | [diff] [blame^] | 9 | # Allows the recursive glob for proto files below to work. |
| 10 | shopt -s globstar |
| 11 | |
David Burger | c33d1eb | 2020-01-21 14:24:50 -0700 | [diff] [blame] | 12 | # Versions of packages to get from CIPD. |
| 13 | CIPD_PROTOC_VERSION='v3.6.1' |
| 14 | |
| 15 | # Move to this script's directory. |
| 16 | cd "$(dirname "$0")" |
| 17 | |
| 18 | # Get protobuf compiler from CIPD. |
| 19 | cipd_root=.cipd_bin |
| 20 | cipd ensure \ |
| 21 | -log-level warning \ |
| 22 | -root "${cipd_root}" \ |
| 23 | -ensure-file - \ |
| 24 | <<ENSURE_FILE |
| 25 | infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION} |
| 26 | ENSURE_FILE |
| 27 | |
| 28 | PATH="${cipd_root}:${PATH}" |
| 29 | |
David Burger | 1b84536 | 2020-02-13 14:43:37 -0700 | [diff] [blame^] | 30 | # Collect all the protos and add a src/config prefix. |
| 31 | protos=(proto/**/*.proto) |
| 32 | protos=( ${protos[@]/#/src/config/} ) |
| 33 | |
| 34 | protoc -I../../ --descriptor_set_out=starlark/bindings/descpb.bin \ |
Andrew Lamb | eceaec0 | 2020-02-11 14:16:41 -0700 | [diff] [blame] | 35 | --python_out=payload_utils/bindings \ |
David Burger | 1b84536 | 2020-02-13 14:43:37 -0700 | [diff] [blame^] | 36 | "${protos[@]}" |