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

Fix make #261

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ trigger-travis.sh
.idea

/protoc-gen-gorm
/.gentool
39 changes: 28 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ test: build

regenerate: clean-gen generate

clean:
rm -rf .gentool

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
Expand Down Expand Up @@ -45,9 +48,12 @@ example/postgres_arrays/*.pb.go: example/postgres_arrays/*.proto
install:
go install -v .

gentool:
gentool: .gentool

.gentool:
docker build -f docker/Dockerfile -t $(GENTOOL_IMAGE) .
docker image prune -f --filter label=stage=server-intermediate
touch $@

generate-gentool: SRCROOT_ON_HOST := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
generate-gentool: SRCROOT_IN_CONTAINER := /go/src/$(PROJECT_ROOT)
Expand All @@ -56,23 +62,31 @@ generate-gentool: DOCKER_RUNNER := docker run --rm
generate-gentool: DOCKER_RUNNER += -v $(SRCROOT_ON_HOST):$(SRCROOT_IN_CONTAINER)
generate-gentool: DOCKER_GENERATOR := infoblox/atlas-gentool:dev-gengorm
generate-gentool: GENERATOR := $(DOCKER_RUNNER) $(DOCKER_GENERATOR)
generate-gentool: #gentool
generate-gentool: gentool
$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
feature_demo/demo_multi_file.proto \
feature_demo/demo_multi_file_service.proto \
feature_demo/demo_service.proto \
feature_demo/demo_types.proto
feature_demo/demo_multi_file.proto \
feature_demo/demo_multi_file_service.proto \
feature_demo/demo_service.proto \
feature_demo/demo_types.proto

$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
user/user.proto

$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
postgres_arrays/postgres_arrays.proto

Expand All @@ -83,8 +97,11 @@ build-local:
protoc --proto_path . \
-I./proto/ \
-I./third_party/proto/ \
-I=. example/feature_demo/demo_multi_file.proto \
example/feature_demo/demo_service.proto --gorm_out="engine=postgres,enums=string,gateway:./example/feature_demo" --go_out=./example/feature_demo
-I=. \
example/feature_demo/demo_multi_file.proto \
example/feature_demo/demo_service.proto \
--gorm_out="engine=postgres,enums=string,gateway:./example/feature_demo" \
--go_out=./example/feature_demo

build-user-local:
rm -rf example/user/github.com/
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ ENTRYPOINT ["protoc", "-I.", \
"-Igithub.com/mwitkow/go-proto-validators", \
# required import paths for protoc-gen-gorm plugin, Should add /proto path once updated
"-Igithub.com/infobloxopen/protoc-gen-gorm", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/proto", \
# required import paths for protoc-gen-atlas-query-validate plugin
"-Igithub.com/infobloxopen/protoc-gen-atlas-query-validate", \
# required import paths for protoc-gen-preprocess plugin
"-Igithub.com/infobloxopen/protoc-gen-preprocess", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/example", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/third_party/proto", \
# required import paths for protoc-gen-atlas-validate plugin
"-Igithub.com/infobloxopen/protoc-gen-atlas-validate" \
]
4 changes: 2 additions & 2 deletions 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.

4 changes: 2 additions & 2 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.

12 changes: 4 additions & 8 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.

4 changes: 2 additions & 2 deletions example/feature_demo/demo_service.pb.go

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

Loading
Loading