style: gen.sh
This commit is contained in:
parent
a0aa79ba13
commit
6b2c291f27
@ -1,7 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# check pb dir
|
# check pb dir
|
||||||
pb_dir="$(cd "$(dirname $0)";pwd)/../pb"
|
pb_dir="$(
|
||||||
|
cd "$(dirname $0)"
|
||||||
|
pwd
|
||||||
|
)/../pb"
|
||||||
if [ ! -d $pb_dir ]; then
|
if [ ! -d $pb_dir ]; then
|
||||||
echo "pb dir $pb_dir does not exist in grpc folder"
|
echo "pb dir $pb_dir does not exist in grpc folder"
|
||||||
exit
|
exit
|
||||||
@ -9,8 +12,8 @@ fi
|
|||||||
cd $pb_dir
|
cd $pb_dir
|
||||||
|
|
||||||
# check protoc
|
# check protoc
|
||||||
which protoc > /dev/null
|
which protoc >/dev/null
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ]; then
|
||||||
echo "missing protoc" && exit
|
echo "missing protoc" && exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -22,8 +25,7 @@ cmd=protoc
|
|||||||
async_tag=""
|
async_tag=""
|
||||||
|
|
||||||
# check all arguments
|
# check all arguments
|
||||||
for aug in $@
|
for aug in $@; do
|
||||||
do
|
|
||||||
if [ $aug == "-a" ]; then
|
if [ $aug == "-a" ]; then
|
||||||
async_tag="&"
|
async_tag="&"
|
||||||
fi
|
fi
|
||||||
@ -32,13 +34,13 @@ do
|
|||||||
fi
|
fi
|
||||||
if [ $aug == "go" ]; then
|
if [ $aug == "go" ]; then
|
||||||
plugin=protoc-gen-go
|
plugin=protoc-gen-go
|
||||||
which $plugin > /dev/null
|
which $plugin >/dev/null
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ]; then
|
||||||
echo "missing plugin: $plugin" && exit
|
echo "missing plugin: $plugin" && exit
|
||||||
fi
|
fi
|
||||||
vplugin=protoc-gen-govalidators
|
vplugin=protoc-gen-govalidators
|
||||||
which $vplugin > /dev/null
|
which $vplugin >/dev/null
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ]; then
|
||||||
echo "missing plugin: $vplugin" && exit
|
echo "missing plugin: $vplugin" && exit
|
||||||
fi
|
fi
|
||||||
out="$gen_dir/go"
|
out="$gen_dir/go"
|
||||||
@ -54,8 +56,8 @@ do
|
|||||||
fi
|
fi
|
||||||
if [ $aug == "gohttp" ]; then
|
if [ $aug == "gohttp" ]; then
|
||||||
plugin=protoc-gen-grpc-gateway
|
plugin=protoc-gen-grpc-gateway
|
||||||
which $plugin > /dev/null
|
which $plugin >/dev/null
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ]; then
|
||||||
echo "missing plugin: $plugin" && exit
|
echo "missing plugin: $plugin" && exit
|
||||||
fi
|
fi
|
||||||
out="$gen_dir/go"
|
out="$gen_dir/go"
|
||||||
@ -93,7 +95,7 @@ do
|
|||||||
if [ $aug == "docs" ]; then
|
if [ $aug == "docs" ]; then
|
||||||
plugin=protoc-gen-ts
|
plugin=protoc-gen-ts
|
||||||
plugin_path=$(which $plugin)
|
plugin_path=$(which $plugin)
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ]; then
|
||||||
echo "missing plugin: $plugin" && exit
|
echo "missing plugin: $plugin" && exit
|
||||||
fi
|
fi
|
||||||
out="$pb_dir/../../docs"
|
out="$pb_dir/../../docs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user