-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
9575a23
commit 3cacecd
Showing
5 changed files
with
8 additions
and
19 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 |
---|---|---|
|
@@ -160,4 +160,4 @@ cython_debug/ | |
#.idea/ | ||
|
||
# other | ||
rpc/ | ||
protos/**/*.py |
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
File renamed without changes.
File renamed without changes.
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,34 +1,23 @@ | ||
#!/bin/bash | ||
|
||
working_dir=$(pwd) | ||
proto_dirs=($(pwd)/protobufs) # ./protobufs/ | ||
python_dir=($(pwd)/rpc) # ./rpc/ | ||
|
||
# Create ./rpc/ dirctory | ||
directory="rpc" | ||
if [ ! -d "$directory" ]; then | ||
# Create the directory | ||
mkdir -p "$directory" | ||
echo "Directory '$directory' created successfully." | ||
else | ||
echo "Directory '$directory' already exists." | ||
fi | ||
proto_dirs=($(pwd)/protos) # ./protos/ | ||
|
||
# Build *.proto files within the ./protobufs/ directory | ||
for file in $proto_dirs/*.proto; do | ||
for file in $(find "$proto_dirs" -type f); 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\ | ||
--python_out=$proto_dirs\ | ||
$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\ | ||
--python_out=$proto_dirs\ | ||
--grpc_python_out=$proto_dirs\ | ||
$file | ||
fi | ||
done | ||
done |