Skip to content

Commit a175cd3

Browse files
ShafSpecsjulianoes
authored andcommitted
Cleaned up run_protoc bash script
1 parent 934ada3 commit a175cd3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

other/tools/run_protoc.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
set -e
44

55
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6-
WORK_DIR="${SCRIPT_DIR}/../../"
6+
WORK_DIR="${SCRIPT_DIR%/*/*}"
77
PROTO_DIR="${WORK_DIR}/proto"
88
GENERATED_DIR="${WORK_DIR}/mavsdk"
99
TEMPLATE_PATH="${WORK_DIR}/other/templates/py"
1010

1111
TEMPLATE_PATH_RST="${WORK_DIR}/other/templates/rst"
1212
GENERATED_DIR_RST="${WORK_DIR}/mavsdk/source/plugins"
1313

14-
PLUGIN_LIST=$(cd ${WORK_DIR}/proto/protos && ls -d */ | sed 's:/*$::')
14+
PLUGIN_LIST=$(cd "${WORK_DIR}/proto/protos" && ls -d */ | sed 's:/*$::')
1515

1616
command -v protoc-gen-mavsdk > /dev/null || {
1717
echo "-------------------------------"
@@ -54,7 +54,6 @@ function generate {
5454
mv "${GENERATED_DIR}/${plugin}/${plugin}_pb2.py" "${GENERATED_DIR}/${plugin}_pb2.py"
5555
mv "${GENERATED_DIR}/${plugin}/${plugin}_pb2_grpc.py" "${GENERATED_DIR}/${plugin}_pb2_grpc.py"
5656

57-
5857
echo " -> [+] Generated protobuf and gRPC bindings for ${plugin}"
5958

6059
# Generate plugin
@@ -67,6 +66,8 @@ function generate {
6766
# protoc-gen-mavsdk capitalizes filenames, and we don't want that with python
6867
mv ${GENERATED_DIR}/${plugin}/$(snake_case_to_camel_case ${plugin}).py ${GENERATED_DIR}/${plugin}.py
6968

69+
echo " -> [+] Generated plugin for ${plugin}"
70+
7071
# Generate plugin doc entry
7172
python3 -m grpc_tools.protoc -I${PROTO_DIR}/protos \
7273
--proto_path=${PROTO_DIR}/protos/${plugin} \

0 commit comments

Comments
 (0)