Skip to content

Commit

Permalink
Fix a condition for file generation and the buf build configs (#216)
Browse files Browse the repository at this point in the history
* Fix a condition for file generation and the buf build configs

* Make the types.proto file also build using buf

* Restore custom marshaling code for types.proto

* Fix gateway codegen param in buf.gen.yaml files
  • Loading branch information
Calebjh authored Sep 3, 2021
1 parent 0a8498d commit 200aa50
Show file tree
Hide file tree
Showing 21 changed files with 1,499 additions and 10,669 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ build: $(BUF)
test: lint build
go test -v ./...

clean:
@echo "WARNING: this kills test, override and custom files, fixme"
# rm -rf example/feature_demo/feature_demo example/user/user example/postgres_arrays/postgres_arrays example/**/*.go example/**/github.com example/github.com || true
regenerate: clean-gen generate

regenerate: clean generate
clean-gen:
cd example/postgres_arrays && rm -f *.pb.gorm.go && rm -f *.pb.go
cd example/user && rm -f *.pb.gorm.go && rm -f *.pb.go
cd example/feature_demo && rm -f *.pb.gorm.go && rm -f *.pb.go
cd options && rm -f *.pb.gorm.go && rm -f *.pb.go
cd types && rm -f types.pb.go

generate: options/gorm.pb.go example/user/*.pb.go example/postgres_arrays/*.pb.go example/feature_demo/*.pb.go
generate: options/gorm.pb.go types/types.pb.go example/user/*.pb.go example/postgres_arrays/*.pb.go example/feature_demo/*.pb.go

options/gorm.pb.go: proto/options/gorm.proto
buf generate --template proto/options/buf.gen.yaml --path proto/options

options/types.pb.go: proto/types/types.proto
types/types.pb.go: proto/types/types.proto
buf generate --template proto/types/buf.gen.yaml --path proto/types
# TODO: gorm files are not being built by buf generate yet, use docker for now

example/feature_demo/*.pb.go: example/feature_demo/*.proto
buf generate --template example/feature_demo/buf.gen.yaml --path example/feature_demo
Expand Down
4 changes: 1 addition & 3 deletions example/feature_demo/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ plugins:
out: example
opt:
- paths=source_relative
- Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp
- name: go-grpc
out: example
opt: paths=source_relative
- name: gorm
out: example
opt:
- engine=postgres,enums=string,gateway:./example/feature_demo
- Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp
- paths=source_relative,engine=postgres,enums=string,gateway=true:./example/feature_demo
2 changes: 1 addition & 1 deletion example/feature_demo/demo_multi_file.pb.go

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

86 changes: 1 addition & 85 deletions example/feature_demo/demo_multi_file_service.pb.go

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

101 changes: 101 additions & 0 deletions example/feature_demo/demo_multi_file_service_grpc.pb.go

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

Loading

0 comments on commit 200aa50

Please sign in to comment.