diff --git a/.dev/protoc/linux/protoc b/.dev/protoc/linux/protoc new file mode 100755 index 000000000..8c6324432 Binary files /dev/null and b/.dev/protoc/linux/protoc differ diff --git a/.dev/protoc/macos/protoc b/.dev/protoc/macos/protoc new file mode 100755 index 000000000..b6841ccd6 Binary files /dev/null and b/.dev/protoc/macos/protoc differ diff --git a/.dev/protoc/windows/protoc.exe b/.dev/protoc/windows/protoc.exe new file mode 100755 index 000000000..b11665ac3 Binary files /dev/null and b/.dev/protoc/windows/protoc.exe differ diff --git a/tools/release/proto-gen.sh b/tools/release/proto-gen.sh index 5a6d10291..4349d24dd 100755 --- a/tools/release/proto-gen.sh +++ b/tools/release/proto-gen.sh @@ -1,11 +1,30 @@ #!/bin/bash +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 + echo $GOPATH/src/v2ray.com/core/.dev/protoc/linux/protoc + fi +} + +PROTOC=$(detect_protoc) + +# Update Golang proto compiler +go get -u github.com/golang/protobuf/{proto,protoc-gen-go} + 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 - protoc --proto_path=. --go_out=. $DIR/*.proto + ${PROTOC} --proto_path=. --go_out=. $DIR/*.proto fi done popd \ No newline at end of file