summaryrefslogtreecommitdiff
path: root/Makefile
blob: 2bfbfeb70341159ed2dd2e46bcaeb38b8127c391 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# You must use the current protoc-gen-go
#
# go-clone --go-src google.golang.org/protobuf
# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
# go install


all: gitTag.pb.go goDep.pb.go repo.pb.go goimports vet

generate: clean
	go mod init
	go mod tidy
	go generate

go-generate:
	rm -f *.pb.go *.patch

vet:
	@GO111MODULE=off go vet
	@echo this go library package builds okay

# autofixes your import headers in your golang files
goimports:
	goimports -w *.go

# dump autogenerated files and potential patches
clean:
	rm -f *.pb.go go.* *.patch
	go-mod-clean purge

#refs.pb.go: refs.proto
#	cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/gitpb \
#		--go_opt=Mrefs.proto=go.wit.com/lib/protobuf/gitpb \
#		refs.proto

gitTag.pb.go: gitTag.proto
	autogenpb --proto gitTag.proto --mutex-name "john"

goDep.pb.go: goDep.proto
	autogenpb --proto goDep.proto

repo.pb.go: repo.proto
	autogenpb --proto repo.proto

protoc-bad:
	cd ~/go/src && protoc \
		--proto_path=. \
		--proto_path=go.wit.com/lib/protobuf/gitpb \
		--go_out=. \
		--go_opt=Mgo.wit.com/lib/protobuf/gitpb/repo.proto=go.wit.com/lib/protobuf/gitpb \
		--go_opt=MgitTag.proto=go.wit.com/lib/protobuf/gitpb \
		--go_opt=MgoDep.proto=go.wit.com/lib/protobuf/gitpb \
		go.wit.com/lib/protobuf/gitpb/repo.proto

protoc-good:
	cd ~/go/src && protoc \
		--proto_path=. \
		--go_out=go.wit.com/lib/protobuf/gitpb \
		--go_opt=Mrepo.proto=go.wit.com/lib/protobuf/gitpb \
		--go_opt=MgitTag.proto=go.wit.com/lib/protobuf/gitpb \
		--go_opt=MgoDep.proto=go.wit.com/lib/protobuf/gitpb \
		go.wit.com/lib/protobuf/gitpb/repo.proto

protoc-todo-move-to-this:
	# I think I should seperate these dirs. ONLY ONE .proto FILE PER DIRECTORY
	# - httppb.HttpRequest     httpRequest     = 4;  // correct syntax
	protoc \
	    --proto_path=. \
	    --go_out=. \
	    --go_opt=Mgo.wit.com/lib/protobuf/forgepb/patchset.proto=go.wit.com/lib/protobuf/forgepb \
	    --go_opt=Mgo.wit.com/lib/protobuf/httppb/httpRequest.proto=go.wit.com/lib/protobuf/httppb \
	    go.wit.com/lib/protobuf/forgepb/patchset.proto