forked from zgsm-sangfor/codebase-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (40 loc) · 1.65 KB
/
Makefile
File metadata and controls
48 lines (40 loc) · 1.65 KB
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
TAG ?= latest
.PHONY: init
init:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/golang/mock/mockgen@latest
.PHONY:mock
mock:
mockgen -source=./pkg/codegraph/store/storage.go -destination=./test/mocks/mock_graph_store.go -package=mocks
mockgen -source=./internal/repository/workspace.go -destination=./test/mocks/mock_workspace_repository.go -package=mocks
mockgen -source=./internal/repository/event.go -destination=test/mocks/mock_event_repository.go -package=mocks
mockgen -source=./internal/service/indexer.go -destination=test/mocks/mock_indexer.go -package=mocks
mockgen -source=./pkg/codegraph/workspace/workspace.go -destination=test/mocks/mock_workspace.go -package=mocks
.PHONY:proto
proto:
protoc --go_out=. pkg/codegraph/proto/file_element.proto
protoc --go_out=. pkg/codegraph/proto/symbol_definition.proto
protoc --go_out=. pkg/codegraph/proto/types.proto
protoc --go_out=. pkg/codegraph/proto/test_message.proto
.PHONY:test
test:
go test ./internal/... -count=1
go test ./test/codegraph/... -count=1
api-test:
@echo "Running API tests, make sure the server is started on port 11380"
go test ./test/api/... -count=1
.PHONY:build
build:
go mod tidy
go build -ldflags="-s -w" -o ./bin/main ./cmd/main.go
.PHONY: swag
swag:
swag init -g cmd/main.go -o docs/swagger
.PHONY: swag-ui
swag-ui:
mkdir -p docs/swagger-ui
cp -r $$(go list -f '{{.Dir}}' -m github.com/swaggo/swag)/example/docs/swagger-ui/* docs/swagger-ui/
.PHONY: docs
docs: swag swag-ui
@echo "Swagger documentation generated successfully"
@echo "Access the documentation at: http://localhost:8080/docs"