Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement base app-gateway contract for frontend #96

Merged
merged 5 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 31 additions & 24 deletions generate_int_proto.sh
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
Loading