mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
universal proto-gen
This commit is contained in:
parent
7dc7937443
commit
d9196b4217
BIN
.dev/protoc/linux/protoc
Executable file
BIN
.dev/protoc/linux/protoc
Executable file
Binary file not shown.
BIN
.dev/protoc/macos/protoc
Executable file
BIN
.dev/protoc/macos/protoc
Executable file
Binary file not shown.
BIN
.dev/protoc/windows/protoc.exe
Executable file
BIN
.dev/protoc/windows/protoc.exe
Executable file
Binary file not shown.
@ -1,11 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/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
|
pushd $GOPATH/src
|
||||||
for DIR in $(find ./v2ray.com/core -type d -not -path "*.git*"); do
|
for DIR in $(find ./v2ray.com/core -type d -not -path "*.git*"); do
|
||||||
TEST_FILES=($DIR/*.proto)
|
TEST_FILES=($DIR/*.proto)
|
||||||
#echo ${TEST_FILES}
|
#echo ${TEST_FILES}
|
||||||
if [ -f ${TEST_FILES[0]} ]; then
|
if [ -f ${TEST_FILES[0]} ]; then
|
||||||
protoc --proto_path=. --go_out=. $DIR/*.proto
|
${PROTOC} --proto_path=. --go_out=. $DIR/*.proto
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
popd
|
popd
|
Loading…
Reference in New Issue
Block a user