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