-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
57 lines (41 loc) · 1.92 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
55
56
57
BUF_VERSION=v1.26.1
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
install-buf:
go install github.com/bufbuild/buf/cmd/buf@${BUF_VERSION}
install-yq:
go install github.com/mikefarah/yq/v4@latest
lint: guard-GOPATH
cd protobuf && ${GOPATH}/bin/buf lint
gen-go: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.go.yaml
gen-go-server: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.go-server.yaml
gen-ts: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.ts.yaml
gen-java: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.java.yaml
gen-python: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.python.yaml
gen-csharp: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.csharp.yaml
gen-php: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.php.yaml
gen-ruby: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.ruby.yaml
gen-rust: install-buf guard-GOPATH
${GOPATH}/bin/buf generate buf.build/open-feature/flagd --template protobuf/buf.gen.rust.yaml
gen-schema-json: install-yq
yq eval -o=json json/flags.yaml > json/flags.json
yq eval -o=json json/targeting.yaml > json/targeting.json
.PHONY: test
test: gen-schema-json ajv-validate-flagd-schema
go test -v ./json
ajv-validate-flagd-schema:
@if ! npm ls ajv-cli; then npm ci; fi
npx ajv compile -s json/targeting.json
# load the targeting json so flag.json can reference it
npx ajv compile -r json/targeting.json -s json/flags.json