forked from planetscale/vtprotobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (44 loc) · 2.12 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export GOBIN=$(PWD)/bin
export PROTOBUF_ROOT=$(PWD)/_vendor/protobuf-3.20.0
.PHONY: install test gen-conformance gen-include genall
install:
go install -tags protolegacy google.golang.org/protobuf/cmd/protoc-gen-go
go install -tags protolegacy ./cmd/protoc-gen-go-vtproto
# go install -tags protolegacy github.com/gogo/protobuf/protoc-gen-gofast
gen-conformance:
$(PROTOBUF_ROOT)/src/protoc \
--proto_path=$(PROTOBUF_ROOT) \
--go_out=conformance --plugin protoc-gen-go="${GOBIN}/protoc-gen-go" \
--go-vtproto_out=conformance --plugin protoc-gen-go-vtproto="${GOBIN}/protoc-gen-go-vtproto" \
-I$(PROTOBUF_ROOT)/src \
--go_opt=Msrc/google/protobuf/test_messages_proto2.proto=internal/conformance \
--go_opt=Msrc/google/protobuf/test_messages_proto3.proto=internal/conformance \
--go_opt=Mconformance/conformance.proto=internal/conformance \
--go-vtproto_opt=Msrc/google/protobuf/test_messages_proto2.proto=internal/conformance \
--go-vtproto_opt=Msrc/google/protobuf/test_messages_proto3.proto=internal/conformance \
--go-vtproto_opt=Mconformance/conformance.proto=internal/conformance \
src/google/protobuf/test_messages_proto2.proto \
src/google/protobuf/test_messages_proto3.proto \
conformance/conformance.proto
gen-include:
$(PROTOBUF_ROOT)/src/protoc \
--proto_path=include \
--go_out=include --plugin protoc-gen-go="${GOBIN}/protoc-gen-go" \
-I$(PROTOBUF_ROOT)/src \
github.com/davidflanagan/vtprotobuf/vtproto/ext.proto
mv include/github.com/davidflanagan/vtprotobuf/vtproto/*.go ./vtproto
gen-testproto:
for name in "pool/pool.proto pool/pool_with_slice_reuse.proto proto3opt/opt.proto proto2/scalars.proto"; do \
$(PROTOBUF_ROOT)/src/protoc \
--proto_path=testproto \
--proto_path=include \
--go_out=. --plugin protoc-gen-go="${GOBIN}/protoc-gen-go" \
--go-vtproto_out=. --plugin protoc-gen-go-vtproto="${GOBIN}/protoc-gen-go-vtproto" \
-I$(PROTOBUF_ROOT)/src \
testproto/$${name} || exit 1; \
done
genall: install gen-include gen-conformance gen-testproto
test: install gen-conformance
go test -short ./...
go test -count=1 ./conformance/...
GOGC="off" go test -count=1 ./testproto/pool/...