-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
42 lines (31 loc) · 1.17 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
.PHONY: generate-cmd process-files generate docker-generate-cmd docker-generate pre-generate post-generate
DOCKER ?= docker
GENERATE_ARGS = generate -t ./templates -i ./api.yaml -g go -c gen-config.json
GENERATOR_VERSION = v3.3.4
uname_m := $(shell uname -m)
ifeq ($(uname_m),arm64)
IMAGE ?= tsuru/openapi-generator-cli
else
IMAGE ?= openapitools/openapi-generator-cli
endif
generate-dev: pre-generate-dev docker-generate-cmd process-files post-generate
generate: pre-generate-prod docker-generate-cmd process-files post-generate
process-files:
find pkg/tsuru/ -name "*.go" ! -name 'custom_*' | xargs rm
mv *.go pkg/tsuru
gofmt -s -w pkg/tsuru/
git apply patchs/01.diff
git apply patchs/02.diff
goimports -w pkg/tsuru/
go mod tidy
docker-generate-cmd:
$(DOCKER) run -it --rm -u `id -u`:`id -g` -v `pwd`:/app -w /app $(IMAGE):$(GENERATOR_VERSION) $(GENERATE_ARGS)
docker-generate: pre-generate docker-generate-cmd process-files post-generate
pre-generate-dev: clean-docs
cp ../tsuru/docs/reference/api.yaml .
pre-generate-prod: clean-docs
curl -O https://raw.githubusercontent.com/tsuru/tsuru/main/docs/reference/api.yaml
post-generate:
rm api.yaml
clean-docs:
rm -f docs/*.md