v2ray-core/tools/release/proto-gen.sh

30 lines
699 B
Bash
Raw Normal View History

2016-08-28 21:41:51 +00:00
#!/bin/bash
2016-12-23 10:21:34 +00:00
function detect_protoc() {
SYS_LOC=$(which protoc)
if [ -n "${SYS_LOC}" ]; then
echo ${SYS_LOC}
return
fi
if [[ "$OSTYPE" == "linux"* ]]; then
echo $GOPATH/src/v2ray.com/core/.dev/protoc/linux/protoc
elif [[ "$OSTYPE" == "darwin"* ]]; then
2016-12-26 00:00:57 +00:00
echo $GOPATH/src/v2ray.com/core/.dev/protoc/macos/protoc
2016-12-23 10:21:34 +00:00
fi
}
PROTOC=$(detect_protoc)
# Update Golang proto compiler
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
2016-08-28 21:41:51 +00:00
pushd $GOPATH/src
for DIR in $(find ./v2ray.com/core -type d -not -path "*.git*"); do
TEST_FILES=($DIR/*.proto)
#echo ${TEST_FILES}
if [ -f ${TEST_FILES[0]} ]; then
2016-12-23 10:21:34 +00:00
${PROTOC} --proto_path=. --go_out=. $DIR/*.proto
2016-08-28 21:41:51 +00:00
fi
done
popd