forked from opendoor-labs/protoc-gen-graphql
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
34 lines (25 loc) · 798 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BINARY := bin/protoc-gen-graphql
GRAPHQL_PROTOS := $(wildcard protobuf/graphql/*.proto)
GRAPHQL_PROTOS_GO_SRC := $(patsubst %.proto,%.pb.go,$(GRAPHQL_PROTOS))
GO_SRC := $(wildcard */*.go) $(wildcard *.go)
.PHONY: build
build: $(BINARY)
$(BINARY): protoc $(GO_SRC)
GO111MODULE=on go build -o $@ *.go
.PHONY: install
install: protoc $(GO_SRC)
GO111MODULE=on go install .
.PHONY: test
test: build
find testdata -name "*.graphql" -type f -delete
GO111MODULE=on go test ./...
.PHONY: protoc
protoc: $(GRAPHQL_PROTOS_GO_SRC)
$(GRAPHQL_PROTOS_GO_SRC): $(GRAPHQL_PROTOS)
protoc -I protobuf --go_out=paths=source_relative:protobuf $^
.PHONY: protoc-wkt
protoc-wkt: build
protoc -I protobuf \
--plugin=$(BINARY) \
--graphql_out=input_mode=all:protobuf \
protobuf/google/protobuf/*.proto