-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,864 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,73 @@ | ||
#!/bin/bash | ||
|
||
|
||
LIB_ROOT="/lib/" | ||
USER_ROOT="./int/hwsc-user-svc/proto/" | ||
DOCUMENT_ROOT="./int/hwsc-document-svc/proto/" | ||
FILE_ROOT="./int/hwsc-file-transaction-svc/proto" | ||
APP_ROOT="./int/hwsc-app-gateway-svc/proto/" | ||
|
||
# generate protoc for our service | ||
echo "Generating internal proto..." | ||
|
||
|
||
|
||
# SAMPLE SERVICE | ||
echo "Generating hwsc-grpc-sample-svc.pb.go..." | ||
protoc int/hwsc-grpc-sample-svc/proto/hwsc-grpc-sample-svc.proto \ | ||
--go_out=plugins=grpc:. | ||
|
||
|
||
echo "------------------------------------------------------------" | ||
|
||
# USER SERVICE | ||
echo "Generating hwsc-user-svc.pb.go, user.pb.go..." | ||
OUTPUT_ROOT="./int/hwsc-user-svc/proto/" | ||
protoc \ | ||
-I ./lib/ \ | ||
-I ${OUTPUT_ROOT} \ | ||
--go_out=plugins=grpc:${OUTPUT_ROOT} \ | ||
-I ${USER_ROOT} \ | ||
--go_out=plugins=grpc:${USER_ROOT} \ | ||
user.proto hwsc-user-svc.proto | ||
|
||
protoc-go-inject-tag -input=${OUTPUT_ROOT}hwsc-user-svc.pb.go | ||
protoc-go-inject-tag -input=${OUTPUT_ROOT}user.pb.go | ||
sed -i'.orig' -e 's/`json:"-"`/`json:"-" bson:"-"`/g' ${OUTPUT_ROOT}*.pb.go | ||
|
||
protoc-go-inject-tag -input=${USER_ROOT}hwsc-user-svc.pb.go | ||
protoc-go-inject-tag -input=${USER_ROOT}user.pb.go | ||
sed -i'.orig' -e 's/`json:"-"`/`json:"-" bson:"-"`/g' ${USER_ROOT}*.pb.go | ||
|
||
echo "------------------------------------------------------------" | ||
|
||
# DOCUMENT SERVICE | ||
echo "Generating hwsc-document-svc.pb.go, document.pb.go..." | ||
OUTPUT_ROOT="./int/hwsc-document-svc/proto/" | ||
protoc \ | ||
-I ./lib/ \ | ||
-I ${OUTPUT_ROOT} \ | ||
--go_out=plugins=grpc:${OUTPUT_ROOT} \ | ||
-I ${DOCUMENT_ROOT} \ | ||
--go_out=plugins=grpc:${DOCUMENT_ROOT} \ | ||
document.proto hwsc-document-svc.proto | ||
|
||
protoc-go-inject-tag -input=./int/hwsc-document-svc/proto/hwsc-document-svc.pb.go | ||
protoc-go-inject-tag -input=./int/hwsc-document-svc/proto/document.pb.go | ||
protoc-go-inject-tag -input=${DOCUMENT_ROOT}hwsc-document-svc.pb.go | ||
protoc-go-inject-tag -input=${DOCUMENT_ROOT}document.pb.go | ||
sed -i'.orig' -e 's/`json:"-"`/`json:"-" bson:"-"`/g' int/hwsc-document-svc/proto/*.pb.go | ||
sed -i'.orig' -e 's/json:"is_public,omitempty" bson:"isPublic"/json:"is_public" bson:"isPublic"/g' int/hwsc-document-svc/proto/*.pb.go | ||
|
||
|
||
# | ||
echo "------------------------------------------------------------" | ||
|
||
# FILE TRANSACTION SERVICE | ||
echo "Generating hwsc-file-transaction-svc.pb2.py, hwsc-file-transaction-svc.pb2_grpc.py..." | ||
python3 -m grpc_tools.protoc \ | ||
-I./int/hwsc-file-transaction-svc/proto \ | ||
-I ${FILE_ROOT} \ | ||
--python_out=./int/hwsc-file-transaction-svc/proto/ \ | ||
--grpc_python_out=./int/hwsc-file-transaction-svc/proto/ \ | ||
./int/hwsc-file-transaction-svc/proto/hwsc-file-transaction-svc.proto | ||
|
||
|
||
echo "------------------------------------------------------------" | ||
|
||
# APP GATEWAY SERVICE | ||
echo "Generating hwsc-app-gateway .ts, .js, .pb" | ||
OUTPUT_ROOT="./int/hwsc-app-gateway-svc/proto/" | ||
protoc \ | ||
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ | ||
--plugin=protoc-gen-go=${GOPATH}/bin/protoc-gen-go \ | ||
-I ${OUTPUT_ROOT} \ | ||
--js_out=import_style=commonjs,binary:${OUTPUT_ROOT} \ | ||
--go_out=plugins=grpc:${OUTPUT_ROOT} \ | ||
--ts_out=service=true:${OUTPUT_ROOT} \ | ||
${OUTPUT_ROOT}hwsc-app-gateway-svc.proto | ||
-I ./lib/ \ | ||
-I ${USER_ROOT} \ | ||
-I ${DOCUMENT_ROOT} \ | ||
-I ${FILE_ROOT} \ | ||
-I ${APP_ROOT} \ | ||
--js_out=import_style=commonjs,binary:${APP_ROOT} \ | ||
--go_out=plugins=grpc:${APP_ROOT} \ | ||
--ts_out=service=true:${APP_ROOT} \ | ||
${APP_ROOT}hwsc-app-gateway-svc.proto |
Oops, something went wrong.