-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
60 lines (43 loc) · 1.39 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
58
59
60
SHELL = /bin/sh
TOOLS_BIN = tools/bin
NPM_BIN = node_modules/.bin
OAPI_CODEGEN = $(TOOLS_BIN)/oapi-codegen
SWAGGER_CLI = $(NPM_BIN)/swagger-cli
NPM_PKG_SPECS = \
@apidevtools/swagger-cli@^4.0.4
.PHONY: all
all: dist/hydrophone
GENERATED_SRCS = client/types.go client/client.go spec/confirm.v1.yaml
dist/hydrophone: $(GENERATED_SRCS)
GOWORK=off ./build.sh
.PHONY: build
build:
$(MAKE) dist/hydrophone
.PHONY: test
test:
GOWORK=off ./test.sh
.PHONY: generate
# Generates client api
generate: $(SWAGGER_CLI) $(OAPI_CODEGEN)
$(SWAGGER_CLI) bundle ../TidepoolApi/reference/confirm.v1.yaml -o ./spec/confirm.v1.yaml -t yaml
$(OAPI_CODEGEN) -package=api -generate=types spec/confirm.v1.yaml > client/types.go
$(OAPI_CODEGEN) -package=api -generate=client spec/confirm.v1.yaml > client/client.go
cd client && go generate ./...
$(OAPI_CODEGEN):
GOBIN=$(shell pwd)/$(TOOLS_BIN) go install github.com/oapi-codegen/oapi-codegen/v2/cmd/[email protected]
$(SWAGGER_CLI): npm-tools
.PHONY: npm-tools
npm-tools:
# When using --no-save, any dependencies not included will be deleted, so one
# has to install all the packages all at the same time. But it saves us from
# having to muck with packages.json.
npm install --no-save --local $(NPM_PKG_SPECS)
.PHONY: clean
clean:
rm -rf dist node_modules tools
.PHONY: ci-generate
ci-generate: generate
.PHONY: ci-build
ci-build: build
.PHONY: ci-test
ci-test: test