-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMakefile
66 lines (46 loc) · 2.45 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
61
62
63
64
65
66
GO ?= go
GO111MODULE = on
GOPROXY ?= https://goproxy.cn,direct
CGO_ENABLED = 0
OUTPUT_DIR ?= bin
VERSION ?= unknown
BUILDARGS ?= -ldflags '-s -w -X github.com/4paradigm/openaios-platform/src/internal/version.version=$(VERSION)'
all: pineapple billing webhook web-terminal gotty
tidy: deps
cd src && $(GO) mod tidy
oapi_codegen:
$(GO) get 'github.com/deepmap/oapi-codegen/cmd/[email protected]'
apigen: oapi_codegen
mkdir -p ./src/pineapple/apigen
oapi-codegen -include-tags finished -generate types,server -package apigen ./doc/api/main.yaml > ./src/pineapple/apigen/serverapi.gen.go
internalapigen: oapi_codegen
mkdir -p ./src/pineapple/apigen/internalapigen
oapi-codegen -include-tags finished -generate types,server -package internalapigen ./doc/api/internal-api.yaml > ./src/pineapple/apigen/internalapigen/internalapi.gen.go
pineapple: apigen internalapigen billing_client_codegen tidy
cd src && $(GO) build $(BUILDARGS) -o ../$(OUTPUT_DIR)/pineapple ./pineapple
billing_oapi_codegen: oapi_codegen
mkdir -p ./src/billing/apigen
oapi-codegen -generate types,server -package apigen ./doc/api/billing.yaml > ./src/billing/apigen/billingapi.gen.go
billing_client_codegen: oapi_codegen
mkdir -p ./src/internal/billingclient/apigen
oapi-codegen -generate types,client -package apigen ./doc/api/billing.yaml > ./src/internal/billingclient/apigen/billingclient.gen.go
billing: billing_oapi_codegen billing_client_codegen tidy
cd src && $(GO) build $(BUILDARGS) -o ../$(OUTPUT_DIR)/billing ./billing
webhook: billing_client_codegen tidy
cd src && $(GO) build $(BUILDARGS) -o ../$(OUTPUT_DIR)/webhook ./webhook
webterminal_oapi_codegen: oapi_codegen
mkdir -p ./src/webterminal/server/apigen
oapi-codegen -include-tags finished -generate types,server -package apigen ./doc/api/webterminal.yaml > ./src/webterminal/server/apigen/serverapi.gen.go
web-terminal: webterminal_oapi_codegen tidy
cd src && $(GO) build $(BUILDARGS) -o ../$(OUTPUT_DIR)/web-terminal ./webterminal/server
gotty: webterminal_oapi_codegen tidy
cd src && $(GO) build $(BUILDARGS) -o ../$(OUTPUT_DIR)/gotty ./webterminal/gotty
deps: apigen internalapigen billing_client_codegen billing_oapi_codegen webterminal_oapi_codegen
lint: deps
$(GO) install honnef.co/go/tools/cmd/staticcheck@latest
cd src && staticcheck ./...
vet: deps
cd src && go vet ./...
clean:
rm -rf $(OUTPUT_DIR) src/pineapple/apigen src/billing/apigen src/internal/billingclient/apigen src/webterminal/server/apigen
.PHONY: all clean