forked from rvolosatovs/docker-protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotoc-wrapper
More file actions
executable file
·43 lines (39 loc) · 846 Bytes
/
protoc-wrapper
File metadata and controls
executable file
·43 lines (39 loc) · 846 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
40
41
42
43
#!/usr/bin/env bash
c_out=""
includes=()
outs=()
args=()
for arg in $@; do
case $arg in
--c_out=*)
c_out=${arg}
shift
;;
--*_out=*)
outs+=(${arg})
shift
;;
-I*|--proto_path=*)
includes+=(${arg})
shift
;;
*)
args+=(${arg})
;;
esac
done
if [ ${#includes[@]} -eq 0 ]; then
# replicate protoc behavior
includes+=("-I.")
fi
protoc_cmd="protoc ${includes[@]} ${outs[@]} ${args[@]}"
protoc_c_cmd="protoc-c ${includes[@]} ${c_out} ${args[@]}"
if [ ${c_out} ]; then
if [ ${#outs[@]} -eq 0 ]; then
# only --c_out specified, no need to call `protoc`
exec ${protoc_c_cmd}
fi
${protoc_c_cmd} || exit 1
exec ${protoc_cmd}
fi
exec ${protoc_cmd}