Skip to content

Commit

Permalink
Merge pull request #41 from weaveworks/35_grpcdef
Browse files Browse the repository at this point in the history
feat: added grpc service definition and unimplemented server
  • Loading branch information
richardcase authored Aug 9, 2021
2 parents 638965e + d67e60e commit a5f6420
Show file tree
Hide file tree
Showing 33 changed files with 3,931 additions and 10 deletions.
31 changes: 27 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ MOCKGEN:= $(TOOLS_BIN_DIR)/mockgen
CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen
DEFAULTER_GEN := $(TOOLS_BIN_DIR)/defaulter-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
PROTOC_GEN_GO := $(TOOLS_BIN_DIR)/protoc-gen-go
PROTOC_GEN_GO_GRPC := $(TOOLS_BIN_DIR)/protoc-gen-go-grpc
PROTO_GEN_GRPC_GW := $(TOOLS_BIN_DIR)/protoc-gen-grpc-gateway
PROTO_GEN_GRPC_OAPI := $(TOOLS_BIN_DIR)/protoc-gen-openapiv2

# Set --output-base for conversion-gen if we are not within GOPATH
ifneq ($(abspath $(REPO_ROOT)),$(shell go env GOPATH)/src/github/weaveworks/reignited)
Expand All @@ -47,30 +51,37 @@ endif

.DEFAULT_GOAL := help

##@ Build

.PHONY: build
build: $(BIN_DIR) ## Build the binaries
go build -o $(BIN_DIR)/reignited ./cmd/reignited

##@ Generate

.PHONY: generate
generate: $(BUF) $(MOCKGEN) ## Generate code
generate: ## Generate code
$(MAKE) generate-go
## $(MAKE) generate-proto
$(MAKE) generate-proto

.PHONY: generate-go
generate-go: $(MOCKGEN) $(CONVERSION_GEN) $(DEFAULTER_GEN) $(CONTROLLER_GEN) ## Generate Go Code
go generate ./...
$(CONTROLLER_GEN) \
paths=./api/reignite/... \
paths=./api/kinds/... \
object:headerFile=./hack/boilerplate.generatego.txt

.PHONY: generate-proto ## Generate protobuf/grpc code
generate-proto: $(BUF)
generate-proto: $(BUF) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTO_GEN_GRPC_GW) $(PROTO_GEN_GRPC_OAPI)
$(BUF) generate

##@ Linting

.PHONY: lint
lint: $(GOLANGCI_LINT) ## Lint
lint: $(GOLANGCI_LINT) $(BUF) ## Lint
$(GOLANGCI_LINT) run -v --fast=false
$(BUF) lint

##@ Testing

Expand Down Expand Up @@ -106,6 +117,18 @@ $(DEFAULTER_GEN): $(TOOLS_DIR)/go.mod
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(subst hack/tools/,,$@) sigs.k8s.io/controller-tools/cmd/controller-gen

$(PROTOC_GEN_GO): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $(subst hack/tools/,,$@) google.golang.org/protobuf/cmd/protoc-gen-go

$(PROTOC_GEN_GO_GRPC): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $(subst hack/tools/,,$@) google.golang.org/grpc/cmd/protoc-gen-go-grpc

$(PROTO_GEN_GRPC_GW): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $(subst hack/tools/,,$@) github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway

$(PROTO_GEN_GRPC_OAPI): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $(subst hack/tools/,,$@) github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2

BUF_TARGET := buf-Linux-x86_64.tar.gz

ifeq ($(OS), darwin)
Expand Down
Empty file removed api/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a5f6420

Please sign in to comment.