-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
42 lines (32 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
all: generate fmt checks test build
fmt:
go fmt ./...
checks:
golangci-lint run
test:
ginkgo run ./...
build:
go build
docker_build:
docker build -t mimuret/dtapv2:latest .
cover:
go mod tidy
go test -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.html
go fmt
schemas = schemas/input_plugins.json schemas/output_plugins.json schemas/filter_plugins.json
plugin_schemas = $(shell find . -name config-schema.json)
input_plugin_schemas = $(shell find ./pkg/plugin/input -name config-schema.json)
output_plugin_schemas = $(shell find ./pkg/plugin/output -name config-schema.json)
filter_plugin_schemas = $(shell find ./pkg/plugin/filter -name config-schema.json)
generate: pkg/types/dtap_frame.go
pkg/types/dtap_frame.go: proto/dtap_frame.proto
protoc --proto_path=./proto --go_opt=Mdnstap.proto=github.com/dnstap/golang-dnstap --go_opt=paths=source_relative --go_out=./pkg/types proto/dtap_frame.proto
schema/input_plugins.json: $(input_plugin_schemas)
go run misc/merge-schema/main.go pkg/plugin/input /schemas/input_plugins.json > schemas/input_plugins.json.tmp && mv schemas/input_plugins.json.tmp schemas/input_plugins.json
schema/output_plugins.json: $(output_plugin_schemas)
go run misc/merge-schema/main.go pkg/plugin/output /schemas/output_plugins.json > schemas/output_plugins.json.tmp && mv schemas/output_plugins.json.tmp schemas/output_plugins.json
schema/filter_plugins.json: $(filter_plugin_schemas)
go run misc/merge-schema/main.go pkg/plugin/filter /schemas/filter_plugins.json > schemas/filter_plugins.json.tmp && mv schemas/filter_plugins.json.tmp schemas/filter_plugins.json
schema: $(schemas) schema/input_plugins.json schema/output_plugins.json schema/filter_plugins.json
ajv compile -s schemas/schema.json --allow-union-types --inline-refs=true --spec=draft2019 $(addprefix -r ,$(plugin_schemas)) $(addprefix -r ,$(schemas))