Skip to content

Commit

Permalink
Fix generating helloworld.proto
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Apr 22, 2020
1 parent a56280a commit 9f37173
Show file tree
Hide file tree
Showing 4 changed files with 672 additions and 63 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ EXAMPLES=examples/internal/proto/examplepb/echo_service.proto \
examples/internal/proto/examplepb/use_go_template.proto \
examples/internal/proto/examplepb/response_body_service.proto

HELLOWORLD=examples/internal/helloworld/helloworld.proto

EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go)
EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go)
EXAMPLE_SWAGGERSRCS=$(SWAGGER_EXAMPLES:.proto=.swagger.json)
EXAMPLE_DEPS=examples/internal/proto/pathenum/path_enum.proto examples/internal/proto/sub/message.proto examples/internal/proto/sub2/message.proto
EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go)

HELLOWORLD_SVCSRCS=$(HELLOWORLD:.proto=.pb.go)
HELLOWORLD_GWSRCS=$(HELLOWORLD:.proto=.pb.gw.go)

RUNTIME_TEST_PROTO=runtime/internal/examplepb/example.proto
RUNTIME_TEST_SRCS=$(RUNTIME_TEST_PROTO:.proto=.pb.go)

Expand Down Expand Up @@ -171,6 +176,14 @@ $(EXAMPLE_SWAGGERSRCS): ADDITIONAL_SWG_FLAGS:=$(ADDITIONAL_SWG_FLAGS),grpc_api_c
$(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES)
protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,allow_repeated_fields_in_body=true,use_go_templates=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES)

$(HELLOWORLD_SVCSRCS): $(GO_PLUGIN) $(HELLOWORLD)
protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc,paths=source_relative:. $(HELLOWORLD)

$(HELLOWORLD_GWSRCS):
$(HELLOWORLD_GWSRCS): $(GATEWAY_PLUGIN) $(HELLOWORLD)
protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,allow_repeated_fields_in_body=true,$(PKGMAP)$(ADDITIONAL_GW_FLAGS):. $(HELLOWORLD)


$(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC)
$(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \
-l go -o examples/internal/clients/echo --additional-properties packageName=echo
Expand All @@ -192,7 +205,7 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC)
@rm -f $(EXAMPLE_CLIENT_DIR)/responsebody/README.md \
$(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh

examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS)
examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) $(HELLOWORLD_SVCSRCS) $(HELLOWORLD_GWSRCS)
testproto: $(RUNTIME_TEST_SRCS)
test: examples testproto
go test -short -race ./...
Expand Down Expand Up @@ -230,6 +243,8 @@ realclean: distclean
rm -f $(EXAMPLE_GWSRCS)
rm -f $(EXAMPLE_SWAGGERSRCS)
rm -f $(EXAMPLE_CLIENT_SRCS)
rm -f $(HELLOWORLD_SVCSRCS)
rm -f $(HELLOWORLD_GWSRCS)
rm -f $(OPENAPIV2_GO)
rm -f $(RUNTIME_TEST_SRCS)

Expand Down
2 changes: 1 addition & 1 deletion examples/internal/helloworld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ go_library(
deps = [
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)
91 changes: 52 additions & 39 deletions examples/internal/helloworld/helloworld.pb.go

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

Loading

0 comments on commit 9f37173

Please sign in to comment.