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

build proto docs from single protoc command #699

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ BENCH_DATASET_HDF5_DIR = $(BENCH_DATASET_BASE_DIR)/$(BENCH_DATASET_HDF5_DIR_NAME
PROTOS := $(eval PROTOS := $(shell find apis/proto -type f -regex ".*\.proto"))$(PROTOS)
PBGOS = $(PROTOS:apis/proto/%.proto=apis/grpc/%.pb.go)
SWAGGERS = $(PROTOS:apis/proto/%.proto=apis/swagger/%.swagger.json)
GRAPHQLS = $(PROTOS:apis/proto/%.proto=apis/graphql/%.pb.graphqls)
GQLCODES = $(GRAPHQLS:apis/graphql/%.pb.graphqls=apis/graphql/%.generated.go)
PBDOCS = $(PROTOS:apis/proto/%.proto=apis/docs/%.md)
PBDOCS = apis/docs/docs.md

CFLAGS ?= -mno-avx512f -mno-avx512dq -mno-avx512cd -mno-avx512bw -mno-avx512vl
CXXFLAGS ?= $(CFLAGS)
Expand Down Expand Up @@ -201,7 +199,6 @@ clean:
./*.log \
./*.svg \
./apis/docs \
./apis/graphql \
./apis/swagger \
./bench \
./pprof \
Expand Down
90 changes: 2 additions & 88 deletions Makefile.d/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,20 @@ proto/all: \
pbgo \
pbdoc \
swagger
# mv apis/docs/payload/docs.md ./docs.md
# sed -i -E "s%#payload%apis/docs/payload/docs.md#payload%g" apis/docs
# mv ./docs.md apis/docs/payload/docs.md
# swagger \
# graphql

.PHONY: pbgo
pbgo: $(PBGOS)

.PHONY: swagger
swagger: $(SWAGGERS)

.PHONY: graphql
graphql: $(GRAPHQLS) $(GQLCODES)

.PHONY: pbdoc
pbdoc: $(PBDOCS)

.PHONY: proto/clean
## clean proto artifacts
proto/clean:
rm -rf apis/grpc apis/swagger apis/graphql apis/docs
rm -rf apis/grpc apis/swagger apis/docs

.PHONY: proto/paths/print
## print proto paths
Expand All @@ -50,17 +42,13 @@ proto/paths/print:
.PHONY: proto/deps
## install protobuf dependencies
proto/deps: \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
Expand Down Expand Up @@ -116,15 +104,6 @@ $(GOPATH)/bin/protoc-gen-grpc-gateway:
$(GOPATH)/bin/protoc-gen-swagger:
$(call go-get, github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger)

$(GOPATH)/bin/protoc-gen-gql:
$(call go-get-no-mod, github.com/danielvladco/go-proto-gql/protoc-gen-gql)

$(GOPATH)/bin/protoc-gen-gogqlgen:
$(call go-get-no-mod, github.com/danielvladco/go-proto-gql/protoc-gen-gogqlgen)

$(GOPATH)/bin/protoc-gen-gqlgencfg:
$(call go-get-no-mod, github.com/danielvladco/go-proto-gql/protoc-gen-gqlgencfg)

$(GOPATH)/bin/protoc-gen-validate:
$(call go-get, github.com/envoyproxy/protoc-gen-validate)

Expand All @@ -137,22 +116,15 @@ $(GOPATH)/bin/protoc-gen-doc:
$(GOPATH)/bin/swagger:
$(call go-get, github.com/go-swagger/go-swagger/cmd/swagger)

$(GOPATH)/bin/gqlgen:
$(call go-get, github.com/99designs/gqlgen)

$(PBGOS): \
$(PROTOS) \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
Expand All @@ -169,17 +141,13 @@ $(PBGOS): \

$(SWAGGERS): \
$(PROTOS) \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
Expand All @@ -192,69 +160,15 @@ $(SWAGGERS): \
$(call mkdir, $(dir $@))
$(call protoc-gen, $(patsubst apis/swagger/%.swagger.json,apis/proto/%.proto,$@), --swagger_out=json_names_for_fields=true:$(dir $@))

$(GRAPHQLS): \
$(PROTOS) \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
$(GOPATH)/bin/swagger \
$(GOPATH)/src/google.golang.org/genproto \
$(GOPATH)/src/github.com/protocolbuffers/protobuf \
$(GOPATH)/src/github.com/googleapis/googleapis \
$(GOPATH)/src/github.com/envoyproxy/protoc-gen-validate
@$(call green, "generating pb.graphqls files...")
$(call mkdir, $(dir $@))
$(call protoc-gen, $(patsubst apis/graphql/%.pb.graphqls,apis/proto/%.proto,$@), --gql_out=paths=source_relative:$(dir $@))

$(GQLCODES): \
$(PROTOS) \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
$(GOPATH)/bin/swagger \
$(GOPATH)/src/google.golang.org/genproto \
$(GOPATH)/src/github.com/protocolbuffers/protobuf \
$(GOPATH)/src/github.com/googleapis/googleapis \
$(GOPATH)/src/github.com/envoyproxy/protoc-gen-validate
@$(call green, "generating graphql generated.go files...")
$(call mkdir, $(dir $@))
sh hack/graphql/gqlgen.sh $(dir $@) $(patsubst apis/graphql/%.generated.go,apis/graphql/%.pb.graphqls,$@) $@

$(PBDOCS): \
$(PROTOS) \
$(GOPATH)/bin/gqlgen \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-gogo \
$(GOPATH)/bin/protoc-gen-gofast \
$(GOPATH)/bin/protoc-gen-gogofast \
$(GOPATH)/bin/protoc-gen-gogofaster \
$(GOPATH)/bin/protoc-gen-gogoslick \
$(GOPATH)/bin/protoc-gen-gogqlgen \
$(GOPATH)/bin/protoc-gen-gql \
$(GOPATH)/bin/protoc-gen-gqlgencfg \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
Expand All @@ -265,4 +179,4 @@ $(PBDOCS): \
$(GOPATH)/src/github.com/envoyproxy/protoc-gen-validate
@$(call green, "generating documents...")
$(call mkdir, $(dir $@))
$(call protoc-gen, $(patsubst apis/docs/%.md,apis/proto/%.proto,$@), --plugin=protoc-gen-doc=$(GOPATH)/bin/protoc-gen-doc --doc_opt=markdown$(COMMA)docs.md --doc_out=$(dir $@))
$(call protoc-gen, $(PROTOS), --plugin=protoc-gen-doc=$(GOPATH)/bin/protoc-gen-doc --doc_opt=markdown$(COMMA)docs.md --doc_out=$(dir $@))
77 changes: 0 additions & 77 deletions apis/docs/agent/core/docs.md

This file was deleted.

57 changes: 0 additions & 57 deletions apis/docs/agent/sidecar/docs.md

This file was deleted.

59 changes: 0 additions & 59 deletions apis/docs/discoverer/docs.md

This file was deleted.

Loading