-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathMakefile
50 lines (36 loc) · 1.5 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
BASE_DIR := $(shell pwd)
BUILD_DIR := $(BASE_DIR)/build
all: build
build: prebuild mockbroker
prebuild:
mkdir -p $(BUILD_DIR)
mockbroker:
go build -ldflags '-w -s' -o $(BUILD_DIR)/bin/osbchecker.mockbroker \
github.com/openservicebrokerapi/osb-checker/mockbroker
autogenerated: precheck validate generate
precheck:
wget https://raw.githubusercontent.com/openservicebrokerapi/servicebroker/master/swagger.yaml \
-O $(BASE_DIR)/autogenerated/swagger.yaml
validate:
docker run --rm -v $(BASE_DIR)/autogenerated:/local openapitools/openapi-generator-cli validate \
-i /local/swagger.yaml
generate:
cp $(BASE_DIR)/autogenerated/go-server/go/api_*.go $(BASE_DIR)/autogenerated/go-server
docker run --rm -v $(BASE_DIR)/autogenerated:/local openapitools/openapi-generator-cli generate \
-i /local/swagger.yaml \
-g go \
-o /local/go-client
docker run --rm -v $(BASE_DIR)/autogenerated:/local openapitools/openapi-generator-cli generate \
-i /local/swagger.yaml \
-g go-server \
-o /local/go-server \
--additional-properties hideGenerationTimestamp=true
mv $(BASE_DIR)/autogenerated/go-server/api_*.go $(BASE_DIR)/autogenerated/go-server/go/
rm -f $(BASE_DIR)/autogenerated/models/*.go && \
cp $(BASE_DIR)/autogenerated/go-server/go/model_*.go $(BASE_DIR)/autogenerated/models/ && \
rm -f $(BASE_DIR)/autogenerated/go-server/go/model_*.go
goimports:
goimports -w $(shell go list -f {{.Dir}} ./... |grep -v /vendor/)
clean:
rm -rf $(BUILD_DIR)
.PHONY: mockbroker autogenerated goimports clean