mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Make protobindings gen a bit safer
This commit is contained in:
parent
afae402865
commit
ac2890df45
@ -64,7 +64,7 @@ function kube::protoc::protoc() {
|
||||
# isn't). The inputs to this function do not all have a common root, so
|
||||
# this works best for all inputs.
|
||||
PATH="${gogopath}:${PATH}" protoc \
|
||||
--proto_path="${package}" \
|
||||
--proto_path="$(pwd -P)" \
|
||||
--proto_path="${KUBE_ROOT}/vendor" \
|
||||
--gogo_out=paths=source_relative,plugins=grpc:. \
|
||||
api.proto
|
||||
|
@ -23,8 +23,9 @@ set -o pipefail
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
||||
if [ "$#" = 0 ]; then
|
||||
if [ "$#" == 0 ]; then
|
||||
echo "usage: $0 <api_dir>..."
|
||||
exit 1
|
||||
fi
|
||||
@ -32,9 +33,17 @@ fi
|
||||
for api; do
|
||||
# This can't use `git ls-files` because it runs in a container without the
|
||||
# .git dir synced.
|
||||
find "${api}" -type f -name "api.proto" \
|
||||
| while read -r F; do
|
||||
D="$(dirname "${F}")"
|
||||
kube::protoc::generate_proto "${KUBE_ROOT}/${D}"
|
||||
done
|
||||
protos=()
|
||||
kube::util::read-array protos < <( \
|
||||
find "${api}" -type f -name "api.proto")
|
||||
|
||||
if [ "${#protos[@]}" == 0 ]; then
|
||||
echo "ERROR: no 'api.proto' files under '${api}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in "${protos[@]}"; do
|
||||
dir="$(dirname "${file}")"
|
||||
kube::protoc::generate_proto "${dir}"
|
||||
done
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user