-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate grpc protos in namely/protoc-all image (#1187)
* feat: generate manager protoc Signed-off-by: Gaius <[email protected]> * chore: makefile add protoc command Signed-off-by: Gaius <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,396 additions
and
1,276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
#!/bin/bash | ||
|
||
SRC="$(cd "$(dirname "$0")/.." && pwd)" | ||
PROTOC_ALL_IMAGE=${PROTOC_ALL_IMAGE:-"namely/protoc-all:1.42_1"} | ||
PROTO_PATH=pkg/rpc | ||
LANGUAGE=go | ||
|
||
echo "work dir:$SRC" | ||
if protoc -I="$SRC" \ | ||
-I $GOPATH/pkg/mod/github.com/envoyproxy/[email protected] \ | ||
--go_out "$SRC" --go_opt paths=source_relative \ | ||
--go-grpc_out "$SRC" --go-grpc_opt paths=source_relative \ | ||
--validate_out "lang=go,paths=source_relative:$SRC" \ | ||
"$SRC"/pkg/rpc/base/*.proto \ | ||
"$SRC"/pkg/rpc/cdnsystem/*.proto \ | ||
"$SRC"/pkg/rpc/dfdaemon/*.proto \ | ||
"$SRC"/pkg/rpc/scheduler/*.proto \ | ||
"$SRC"/pkg/rpc/manager/*.proto; then | ||
echo "generate grpc code success" | ||
# warning messages about symlinks, fix in golang 1.17 | ||
# https://github.com/golang/go/issues/35941 | ||
if cd "$SRC" && go mod tidy; then | ||
echo "go mod tidy success" | ||
proto_modules="base cdnsystem dfdaemon manager scheduler" | ||
|
||
echo "generate protos..." | ||
|
||
for module in ${proto_modules}; do | ||
if docker run -v $PWD:/defs ${PROTOC_ALL_IMAGE} \ | ||
-d ${PROTO_PATH}/$module -i . \ | ||
-l ${LANGUAGE} -o . \ | ||
--go-source-relative \ | ||
--with-validator \ | ||
--validator-source-relative; then | ||
echo "generate protos ${module} successfully" | ||
else | ||
echo "go mod tidy fail" | ||
echo "generate protos ${module} failed" | ||
fi | ||
else | ||
echo "generate grpc code fail" | ||
fi | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.