-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·39 lines (35 loc) · 898 Bytes
/
build.sh
File metadata and controls
executable file
·39 lines (35 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/bash
function golang_build(){
echo "Building go lang"
if [ -e proto ]; then
rm -r proto
fi
mkdir proto
protoc --proto_path=./ \
--go_out=plugins=grpc:proto/ \
--go_opt=paths=source_relative definitions.proto
echo "Done."
}
function python_build(){
OUTPUT_DIR="$1"
echo "Building python to $OUTPUT_DIR"
if [ -e $OUTPUT_DIR ]; then
echo "Overwriting $OUTPUT_DIR"
rm -r $OUTPUT_DIR
fi
mkdir $OUTPUT_DIR
protoc --proto_path=./ --python_out=$OUTPUT_DIR definitions.proto
echo "Done."
}
function build_help(){
echo "Invalid language provided. Below are the supported commands"
echo " ./build.sh go"
echo " ./build.sh python [OUTPUT_DIR]"
}
LANGUAGE="$1"
OUTPUT_DIR="$2"
case $LANGUAGE in
"go") golang_build;;
"python") python_build $OUTPUT_DIR;;
*) build_help;;
esac