Skip to content

Commit 0c0b378

Browse files
tmcachew22
authored andcommitted
Update upstream proto files and add google.golang.org/genproto support. (#325)
* revendor proto files, point to genproto for go files * test 1.8 first
1 parent fdcb7ea commit 0c0b378

File tree

19 files changed

+222
-503
lines changed

19 files changed

+222
-503
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: go
22
sudo: false
33
go:
4-
- 1.7.3
4+
- 1.8.x
5+
- 1.7.x
56
- tip
67
go_import_path: github.com/grpc-ecosystem/grpc-gateway
78
cache:
@@ -23,7 +24,7 @@ before_script:
2324
- sh -c 'cd examples/browser && npm install'
2425
script:
2526
- make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar"
26-
- if (go version | grep -qv devel) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi
27+
- if (go version | grep -q 1.8) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi
2728
- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/...
2829
- make lint
2930
- sh -c 'cd examples/browser && gulp'

Makefile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \
3838
GATEWAY_PLUGIN_FLAGS?=
3939

4040
GOOGLEAPIS_DIR=third_party/googleapis
41-
OPTIONS_PROTO=$(GOOGLEAPIS_DIR)/google/api/annotations.proto $(GOOGLEAPIS_DIR)/google/api/http.proto
42-
OPTIONS_GO=$(OPTIONS_PROTO:.proto=.pb.go)
4341
OUTPUT_DIR=_output
4442

4543
RUNTIME_PROTO=runtime/internal/stream_chunk.proto
4644
RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go)
4745

48-
PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mgoogle/api/annotations.proto=$(PKG)/$(GOOGLEAPIS_DIR)/google/api,Mexamples/sub/message.proto=$(PKG)/examples/sub
46+
PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/sub/message.proto=$(PKG)/examples/sub
4947
ADDITIONAL_FLAGS=
5048
ifneq "$(GATEWAY_PLUGIN_FLAGS)" ""
5149
ADDITIONAL_FLAGS=,$(GATEWAY_PLUGIN_FLAGS)
@@ -81,23 +79,21 @@ SWAGGER_CODEGEN=swagger-codegen
8179

8280
PROTOC_INC_PATH=$(dir $(shell which protoc))/../include
8381

84-
generate: $(OPTIONS_GO) $(RUNTIME_GO)
82+
generate: $(RUNTIME_GO)
8583

8684
.SUFFIXES: .go .proto
8785

8886
$(GO_PLUGIN):
8987
go get $(GO_PLUGIN_PKG)
9088
go build -o $@ $(GO_PLUGIN_PKG)
9189

92-
$(OPTIONS_GO): $(OPTIONS_PROTO) $(GO_PLUGIN)
93-
protoc -I $(PROTOC_INC_PATH) -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):$(GOOGLEAPIS_DIR) $(OPTIONS_PROTO)
9490
$(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN)
9591
protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO)
9692

97-
$(GATEWAY_PLUGIN): $(OPTIONS_GO) $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC)
93+
$(GATEWAY_PLUGIN): $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC)
9894
go build -o $@ $(GATEWAY_PLUGIN_PKG)
9995

100-
$(SWAGGER_PLUGIN): $(OPTIONS_GO) $(SWAGGER_PLUGIN_SRC)
96+
$(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC)
10197
go build -o $@ $(SWAGGER_PLUGIN_PKG)
10298

10399
$(EXAMPLE_SVCSRCS): $(GO_PLUGIN) $(EXAMPLES)
@@ -137,7 +133,6 @@ lint:
137133
clean distclean:
138134
rm -f $(GATEWAY_PLUGIN)
139135
realclean: distclean
140-
rm -f $(OPTIONS_GO)
141136
rm -f $(EXAMPLE_SVCSRCS) $(EXAMPLE_DEPSRCS)
142137
rm -f $(EXAMPLE_GWSRCS)
143138
rm -f $(EXAMPLE_SWAGGERSRCS)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`.
8989
```sh
9090
protoc -I/usr/local/include -I. \
9191
-I$GOPATH/src \
92-
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
93-
--go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
92+
-I$GOPATH/src/github.com/googleapis/googleapis/ \
93+
--go_out=,plugins=grpc:. \
9494
path/to/your_service.proto
9595
```
9696

examples/examplepb/a_bit_of_everything.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/examplepb/echo_service.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/examplepb/flow_combination.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/examplepb/stream.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/sub/message.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/sub2/message.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protoc-gen-grpc-gateway/descriptor/services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/golang/protobuf/proto"
99
descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
1010
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule"
11-
options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"
11+
options "google.golang.org/genproto/googleapis/api/annotations"
1212
)
1313

1414
// loadServices registers services and their methods from "targetFile" to "r".

0 commit comments

Comments
 (0)