Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4 & #8 Generates swagger and http gateway libs #10

Merged
merged 1 commit into from
Oct 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions example/hello-world-idl/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
PROTOC_VERSION := 3.9.2
PROTOC_WEB_VERSION := 1.0.6

PROTO_SOURCES := -I /usr/local/include
PROTO_SOURCES += -I .
PROTO_SOURCES += -I ${GOPATH}/src
PROTO_SOURCES += -I ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
PROTO_SOURCES += -I ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway

deps-linux: deps-protoc-linux deps-grpc-web-linux
deps-linux: deps-protoc-linux deps-grpc-web-linux deps-go

deps-protoc-linux:
curl -OL https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-linux-x86_64.zip
Expand All @@ -19,9 +21,14 @@ deps-grpc-web-linux:
sudo mv protoc-gen-grpc-web-$(PROTOC_WEB_VERSION)-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web
chmod +x /usr/local/bin/protoc-gen-grpc-web

generate: generate-grpc generate-web
deps-go:
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go

generate: generate-grpc generate-web generate-http

generate-grpc:
generate-grpc:
mkdir -p gen/go
protoc ${PROTO_SOURCES} --go_out=plugins=grpc:./gen/go ./proto/health/*.proto
protoc ${PROTO_SOURCES} --go_out=plugins=grpc:./gen/go ./proto/helloworld/*.proto
Expand All @@ -33,4 +40,11 @@ generate-web:
protoc ${PROTO_SOURCES} --grpc-web_out=import_style=typescript,mode=grpcwebtext:gen/web ./proto/helloworld/*.proto
cp -f -rv gen/web/proto/* gen/web
rm -rf gen/web/Proto gen/web/proto
generate-http:
mkdir -p gen/http gen/swagger
protoc ${PROTO_SOURCES} --grpc-gateway_out=logtostderr=true:gen/http --swagger_out=logtostderr=true:gen/swagger ./proto/health/*.proto
protoc ${PROTO_SOURCES} --grpc-gateway_out=logtostderr=true:gen/http --swagger_out=logtostderr=true:gen/swagger ./proto/helloworld/*.proto
cp -f -rv gen/http/proto/* gen/http
cp -f -rv gen/swagger/proto/* gen/swagger
rm -rf gen/swagger/proto

40 changes: 24 additions & 16 deletions example/hello-world-idl/gen/go/health/health.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

159 changes: 159 additions & 0 deletions example/hello-world-idl/gen/http/health/health.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.