From 4d8e4febc407344d6b9474c64c27b139538e72c3 Mon Sep 17 00:00:00 2001 From: Keivan Ipchi Hagh Date: Tue, 19 Mar 2024 00:34:29 +0330 Subject: [PATCH] feat: update script to handle rpc and grpc seperatly --- scripts/build.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 87745ad..f28e325 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -15,8 +15,20 @@ else fi # Build *.proto files within the ./protos/ directory -python3 -m grpc_tools.protoc\ - --proto_path=$proto_dirs\ - --python_out=$python_dir\ - --grpc_python_out=$python_dir\ - $proto_dirs/*.proto # ./protos/*.proto +for file in $proto_dirs/*.proto; do + filename=$(basename "$file") + if echo "$filename" | grep -q "struct"; then + # Only RPC for structs + python3 -m grpc_tools.protoc\ + --proto_path=$proto_dirs\ + --python_out=$python_dir\ + $file + else + # RPC and gRPC for non structs + python3 -m grpc_tools.protoc\ + --proto_path=$proto_dirs\ + --python_out=$python_dir\ + --grpc_python_out=$python_dir\ + $file + fi +done \ No newline at end of file