forked from trpc-group/trpc-cmdline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (35 loc) · 1.53 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
VERSION := $(shell cat install/VERSION)
DOCKER_IMAGE := trpc-group/trpc-cmdline
GOPROXY := https://goproxy.cn
GOSUMDB := sum.golang.org
PHONY: fmt bindata_release release submodules image
fmt:
@gofmt -s -w .
@goimports -w -local trpc.group .
# If you want to construct bindata and then restore to the initial
# status of submodules, use `make release`
#
# If you only want to construct bindata, use `make bindata_release`,
# but be cautious that the files of submodules has been modified, if
# you want to create a merge request, you need to run `make submodules`
# to restore the status.
release: bindata_release submodules
bindata_release:
# -git submodule update --init --recursive
# -rm -rf install/submodules/* && git submodule update --remote
# -cd install/submodules/trpc-protocol && (ls | grep -v "trpc" | xargs rm -rf) && find . -type f ! -name "*.proto" -exec rm -rf '{}' \; && cd -
@cat config/version.go | grep -oE "(v[0-9]+.[0-9]+.[0-9]+)" | tr -d '\n' > install/VERSION
@go get -u trpc.group/trpc-go/trpc-cmdline/bindata
@# in case "go get -u" doesn't work in higher version of Go.
@go install trpc.group/trpc-go/trpc-cmdline/bindata
@bindata -input=install -output=gobin/assets.go -gopkg=gobin
# The dependency on strcase should be forced to v0.2.0 for compatibility.
@go get -u github.com/iancoleman/strcase@v0.2.0
@go mod tidy
submodules:
# -rm -rf install/submodules/* && git submodule update --remote
image:
@docker build \
--build-arg GOPROXY=${GOPROXY} \
--build-arg GOSUMDB=${GOSUMDB} \
-t ${DOCKER_IMAGE}:${VERSION} .