Skip to content

Commit

Permalink
feat: update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
keivanipchihagh committed Mar 18, 2024
1 parent 9575a23 commit 3cacecd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ cython_debug/
#.idea/

# other
rpc/
protos/**/*.py
2 changes: 1 addition & 1 deletion protobufs/athena.proto → protos/athena/athena.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package athena.v1;

import "athena_struct.proto";
import "athena/athena_struct.proto";
import "candlestick_struct.proto";

// [Request] RequestBacktest
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 6 additions & 17 deletions scripts/build.sh
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

0 comments on commit 3cacecd

Please sign in to comment.