switched to Twirp for RPC, server skaffold

This commit is contained in:
David Zhao
2020-10-06 23:20:44 -07:00
parent 5117b8bf80
commit 0d6c0adbdd
20 changed files with 2875 additions and 706 deletions
+26 -7
View File
@@ -6,15 +6,18 @@ else
GOBIN=$(shell go env GOBIN)
endif
server:
server: generate
go build -i -o livekit-server
generate: wire
go generate
GO_TARGET=proto
proto: protoc goproto
proto: protoc protoc-gen-go twirp-gen
@{ \
protoc --go_out=$(GO_TARGET) --go-grpc_out=$(GO_TARGET) \
protoc --go_out=$(GO_TARGET) --twirp_out=$(GO_TARGET) \
--go_opt=paths=source_relative \
--go-grpc_opt=paths=source_relative \
--twirp_opt=paths=source_relative \
--plugin=$(PROTOC_GEN_GO) \
-I=proto \
proto/*.proto ;\
@@ -25,13 +28,29 @@ ifeq (, $(shell which protoc))
echo "protoc is required, and is not installed"
endif
goproto:
protoc-gen-go:
ifeq (, $(shell which protoc-gen-go-grpc))
@{ \
echo "installing go protobuf plugin" ;\
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc ;\
}
PROTOC_GEN_GO=$(GOBIN)/protoc-gen-go-grpc
endif
twirp-gen:
ifeq (, $(shell which protoc-gen-twirp))
@{ \
echo "installing twirp protobuf plugin" ;\
go install github.com/twitchtv/twirp/protoc-gen-twirp ;\
}
endif
wire:
ifeq (, $(shell which wire))
@{ \
echo "installing wire" ;\
go install github.com/google/wire/cmd/wire ;\
}
WIRE=$(GOBIN)/wire
else
PROTOC_GEN_GO=$(shell which protoc-gen-go-grpc)
WIRE=$(shell which wire)
endif