forked from openconfig/gnsi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regenerate-files.sh
executable file
·30 lines (27 loc) · 979 Bytes
/
regenerate-files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
set -euo pipefail
BASE=$(bazel info bazel-genfiles)
GNSI_NS='github.com/openconfig/gnsi'
copy_generated() {
pkg="$1"
# Default to using package name for proto if $2 is unset
proto="$1" && [ "${2++}" ] && proto="$2"
# Bazel go_rules will create empty files containing "// +build ignore\n\npackage ignore"
# in the case where the protoc compiler doesn't generate any output. See:
# https://github.com/bazelbuild/rules_go/blob/03a8b8e90eebe699d7/go/tools/builders/protoc.go#L190
for file in "${BASE}"/"${pkg}"/"${proto}"_go_proto_/"${GNSI_NS}"/"${pkg}"/*.pb.go; do
[[ $(head -n 1 "${file}") == "// +build ignore" ]] || cp "${file}" "${pkg}"/
done
}
bazel build //acctz:all
copy_generated "acctz"
bazel build //authz:all
copy_generated "authz"
bazel build //certz:all
copy_generated "certz"
bazel build //credentialz:all
copy_generated "credentialz"
bazel build //pathz:all
copy_generated "pathz"
bazel build //version:all
copy_generated "version"