-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
67 lines (57 loc) · 2.31 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
67
.PHONY: build dev-requirements devshell
BUILD_VERSION := $(shell git describe --always |sed -e "s/^v//")
GW_GEN := protoc -I=/googleapis -I=chirpstack/api/proto --grpc-gateway_out=paths=source_relative,logtostderr=true:.
API_GEN := protoc -I=/googleapis -I=chirpstack/api/proto --openapiv2_out ./openapiv2 --openapiv2_opt logtostderr=true
GRPC_GEN := protoc -I=/googleapis -I=chirpstack/api/proto --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative
build:
mkdir -p build
go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(BUILD_VERSION)" -o build/chirpstack-rest-api main.go
dist:
goreleaser
mkdir -p dist/upload/tar
mkdir -p dist/upload/deb
mkdir -p dist/upload/rpm
mv dist/*.tar.gz dist/upload/tar
mv dist/*.deb dist/upload/deb
mv dist/*.rpm dist/upload/rpm
snapshot:
goreleaser --snapshot
dev-requirements:
git submodule update --init
go mod download
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
go install github.com/goreleaser/goreleaser@latest
go install github.com/goreleaser/nfpm/v2/cmd/nfpm
devshell:
docker compose run --rm chirpstack-rest-api bash
generate:
go get -u github.com/chirpstack/chirpstack/api/go/v4@${VERSION}
cd chirpstack && git fetch && git checkout ${VERSION}
${GW_GEN} api/application.proto
${GW_GEN} api/device.proto
${GW_GEN} api/device_profile.proto
${GW_GEN} api/device_profile_template.proto
${GW_GEN} api/gateway.proto
${GW_GEN} api/multicast_group.proto
${GW_GEN} api/tenant.proto
${GW_GEN} api/user.proto
${GRPC_GEN} api/application.proto
${GRPC_GEN} api/device.proto
${GRPC_GEN} api/device_profile.proto
${GRPC_GEN} api/device_profile_template.proto
${GRPC_GEN} api/gateway.proto
${GRPC_GEN} api/multicast_group.proto
${GRPC_GEN} api/tenant.proto
${GRPC_GEN} api/user.proto
${API_GEN} api/application.proto
${API_GEN} api/device.proto
${API_GEN} api/device_profile.proto
${API_GEN} api/device_profile_template.proto
${API_GEN} api/gateway.proto
${API_GEN} api/multicast_group.proto
${API_GEN} api/tenant.proto
${API_GEN} api/user.proto
cd ui && go run merge.go ${VERSION} ../openapiv2/api > api.json