forked from hashicorp/nomad-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (53 loc) · 1.58 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
VERSION=v5.2.0
DOCKER_IMAGE="openapitools/openapi-generator-cli:$(VERSION)"
THIS_OS := $(shell go env GOOS)
CGO_ENABLED = 1
CGO_CFLAGS ?=
SDKROOT ?=
ifeq (darwin,$(THIS_OS))
spec: CGO_ENABLED = 0
CGO_CFLAGS=-Wno-undef-prefix
endif
.PHONY: spec
spec: CC ?= $(shell go env CC)
spec: GOOS=$(shell go env GOOS)
spec:
(cd generator && CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) CC=$(CC) CGO_CFLAGS=$(CGO_CFLAGS) go build -o bin/generator && ./bin/generator ../v1/openapi.yaml)
.PHONY: test
test:
(cd ./v1 && go test ./... -v -count=1)
.PHONY: openapi
v1: spec
@echo "==> Building v1 OpenAPI Specification and clients..."
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/go/v1/config.yaml
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/java/v1/config.yaml
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/javascript/v1/config.yaml
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/python/v1/config.yaml
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/rust/reqwest/v1/config.yaml
@docker run \
--rm \
--volume "$(PWD):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/rust/hyper/v1/config.yaml
@docker run \
--rm \
--volume "$(shell pwd):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/ruby/v1/config.yaml
@docker run \
--rm \
--volume "$(shell pwd):/local" \
$(DOCKER_IMAGE) batch --clean /local/clients/typescript/v1/config.yaml