Skip to content

Commit

Permalink
Merge pull request #82 from erizocosmico/fix/multiple-packages
Browse files Browse the repository at this point in the history
add proto folder path to proto_path
  • Loading branch information
Serabe authored May 18, 2017
2 parents a6654aa + c08558e commit bd16827
Show file tree
Hide file tree
Showing 10 changed files with 474 additions and 257 deletions.
7 changes: 4 additions & 3 deletions cli/proteus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ func genAll(c *cli.Context) error {
return genRPCServer(c)
}

func protocExec(protocPath, pck, outPath, protoFile string) error {
func protocExec(protocPath, pkg, outPath, protoFile string) error {
protocArgs := fmt.Sprintf(
"--proto_path=%s:%s:%s:.",
"--proto_path=%s:%s:%s:%s:.",
goSrc,
path,
filepath.Join(protobufSrc, "protobuf"),
filepath.Join(path, pck),
filepath.Join(path, pkg),
)

report.Info("executing protoc: %s %s", protocPath, protocArgs)
Expand Down
4 changes: 2 additions & 2 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
regenerate:
- make -C $(GOPATH)/src/gopkg.in/src-d/proteus.v1 reinstall
- proteus -p gopkg.in/src-d/proteus.v1/example -f $(GOPATH)/src/gopkg.in/src-d/proteus.v1/example/protos --verbose
- proteus -p gopkg.in/src-d/proteus.v1/example -p gopkg.in/src-d/proteus.v1/example/categories -f $(GOPATH)/src/gopkg.in/src-d/proteus.v1/example/protos --verbose
# Need to generate twice to avoid bug where rpc would detect the
# autogenerated methods as real ones, not generating them if proteus was
# called again.
- proteus -p gopkg.in/src-d/proteus.v1/example -f $(GOPATH)/src/gopkg.in/src-d/proteus.v1/example/protos --verbose
- proteus -p gopkg.in/src-d/proteus.v1/example -p gopkg.in/src-d/proteus.v1/example/categories -f $(GOPATH)/src/gopkg.in/src-d/proteus.v1/example/protos --verbose
8 changes: 8 additions & 0 deletions example/categories/categories.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package categories

// CategoryOptions is not marked for generations, but it is used in another
// structs, so it will be generated because of it.
type CategoryOptions struct {
ShowPrices bool
CanBuy bool
}
349 changes: 349 additions & 0 deletions example/categories/generated.pb.go

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

Loading

0 comments on commit bd16827

Please sign in to comment.