forked from pseudomuto/protoc-gen-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.85 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
52
53
54
.PHONY: bench setup test build dist docker examples
EXAMPLE_DIR=$(shell pwd)/examples
DOCS_DIR=$(EXAMPLE_DIR)/doc
PROTOS_DIR=$(EXAMPLE_DIR)/proto
EXAMPLE_CMD=protoc --plugin=protoc-gen-doc -Iexamples/proto --doc_out=examples/doc
DOCKER_CMD=docker run --rm -v $(DOCS_DIR):/out:rw -v $(PROTOS_DIR):/protos:ro -v $(EXAMPLE_DIR)/templates:/templates:ro pseudomuto/protoc-gen-doc
setup:
$(info Synching dev tools and dependencies...)
@if test -z $(which retool); then go get github.com/twitchtv/retool; fi
@retool sync
@retool do dep ensure
resources.go: resources/*.tmpl resources/*.json
$(info Generating resources...)
@go run resources/main.go -in resources -out resources.go -pkg gendoc
fixtures/fileset.pb: fixtures/*.proto fixtures/generate.go
$(info Generating fixtures...)
@cd fixtures && go generate
test: fixtures/fileset.pb resources.go
@go test -cover ./ ./cmd/...
bench:
@go test -bench=.
build: setup resources.go
@go build ./cmd/...
dist:
@script/dist.sh
docker:
@script/push_to_docker.sh
docker_test: build docker
@rm -f examples/doc/*
@$(DOCKER_CMD) --doc_opt=docbook,example.docbook:Ignore*
@$(DOCKER_CMD) --doc_opt=html,example.html:Ignore*
@$(DOCKER_CMD) --doc_opt=json,example.json:Ignore*
@$(DOCKER_CMD) --doc_opt=markdown,example.md:Ignore*
@$(DOCKER_CMD) --doc_opt=/templates/asciidoc.tmpl,example.txt:Ignore*
examples: build examples/proto/*.proto examples/templates/*.tmpl
$(info Making examples...)
@rm -f examples/doc/*
@$(EXAMPLE_CMD) --doc_opt=docbook,example.docbook:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=html,example.html:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=json,example.json:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=markdown,example.md:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=examples/templates/asciidoc.tmpl,example.txt:Ignore* examples/proto/*.proto