Skip to content

Commit 750524f

Browse files
authored
grpc-gen: use self-contained consistent protoc and go-gen tools (textileio#416)
* add build tools Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * use buildtools in makefile Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * add ignoring folder in proto gen Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * autoinstall buildtools script Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * regen protos Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * fix build script Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * cleaning Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * download plataform specific Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com> * delete binary Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
1 parent 4e24718 commit 750524f

15 files changed

Lines changed: 7446 additions & 4045 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ pow
2121
powd
2222
powbench
2323

24+
buildtools/protoc
25+
buildtools/protoc-gen-go
26+
2427
myfile
2528
tags

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ clean-protos:
2727
find . -type f -name '*pb_test.go' -delete
2828
.PHONY: clean-protos
2929

30-
protos: clean-protos
31-
./scripts/protoc_gen_plugin.bash --proto_path=. --plugin_name=go --plugin_out=. --plugin_opt=plugins=grpc
30+
install-protoc:
31+
cd buildtools && ./protocInstall.sh
32+
33+
PROTOCGENGO=$(shell pwd)/buildtools/protoc-gen-go
34+
protos: install-protoc clean-protos
35+
PATH=$(PROTOCGENGO):$(PATH) ./scripts/protoc_gen_plugin.bash --proto_path=. --plugin_name=go --plugin_out=. --plugin_opt=plugins=grpc
3236
.PHONY: protos

buildtools/protocInstall.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ ! -d ./protoc ]; then
5+
OS=$(uname)
6+
if [ $OS = "Darwin" ]; then
7+
OS="osx"
8+
fi
9+
VERSION=3.12.1
10+
ZIPNAME=protoc-$VERSION-$OS-x86_64
11+
DOWNLOADLINK=https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/$ZIPNAME.zip
12+
curl -LO $DOWNLOADLINK
13+
unzip $ZIPNAME.zip -d protoc
14+
rm $ZIPNAME.zip
15+
fi
16+
17+
if [ ! -d ./protoc-gen-go ]; then
18+
git clone --single-branch --depth 1 --branch "v1.4.2" https://github.com/golang/protobuf.git
19+
cd protobuf
20+
go build -o ../protoc-gen-go/protoc-gen-go ./protoc-gen-go
21+
cd ..
22+
rm -rf protobuf
23+
fi

0 commit comments

Comments
 (0)