Move update-generated-runtime into common script

Now update-generated-proto-bindings rules all the api.pb.go generation.

Running this shows no delta on the runtime.pb.go

This exposes an issue in how protoc is called for protos that specify
`go_package` which is fixed here.

Not all of our protos specify that option (even though it is
recommended), which will be fixed subsequently.
This commit is contained in:
Tim Hockin
2023-01-14 10:09:22 -08:00
parent e0ecccff3f
commit a057f35c90
7 changed files with 16 additions and 177 deletions

View File

@@ -56,10 +56,19 @@ function kube::protoc::protoc() {
local package=${1}
gogopath=$(dirname "$(kube::util::find-binary "protoc-gen-gogo")")
PATH="${gogopath}:${PATH}" protoc \
--proto_path="${package}" \
--proto_path="${KUBE_ROOT}/vendor" \
--gogo_out=plugins=grpc:"${package}" "${package}/api.proto"
(
cd "${package}"
# This invocation of --gogo_out produces its output in the current
# directory (despite gogo docs saying it would be source-relative, it
# 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="${KUBE_ROOT}/vendor" \
--gogo_out=paths=source_relative,plugins=grpc:. \
api.proto
)
}
# Formats $1/api.pb.go, adds the boilerplate comments and run gofmt on it