forked from fregie/pho
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (34 loc) · 1.3 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
BUILD_VERSION := $(shell git describe --tags)
GIT_COMMIT_SHA1 := $(shell git rev-parse HEAD)
BUILD_TIME := $(shell date "+%F %T")
BUILD_NAME := img_syncer_server
VERSION_PACKAGE_NAME := github.com/fregie/PrintVersion
DESCRIBE := img_syncer grpc server
prebuild:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
protobuf:
protoc -I. --go_out . --go_opt paths=source_relative \
--go-grpc_out . --go-grpc_opt paths=source_relative \
--dart_out=grpc:lib \
proto/*.proto
.PHONY: server
server:
CGO_ENABLED=0 go build -ldflags "\
-X '${VERSION_PACKAGE_NAME}.Version=${BUILD_VERSION}' \
-X '${VERSION_PACKAGE_NAME}.BuildTime=${BUILD_TIME}' \
-X '${VERSION_PACKAGE_NAME}.GitCommitSHA1=${GIT_COMMIT_SHA1}' \
-X '${VERSION_PACKAGE_NAME}.Describe=${DESCRIBE}' \
-X '${VERSION_PACKAGE_NAME}.Name=${BUILD_NAME}'" \
-o server/output/${BUILD_NAME} ./server
server-aar: protobuf
CGO_ENABLED=0 gomobile bind -target=android -androidapi 19 -o android/app/libs/server.aar ./server/run
apk:
flutter build apk
.PHONY: test
test:
docker-compose -f test/docker-compose.yml up -d --build
sleep 3
go test -v ./server/api -p 1 -failfast
go test -v ./server/drive -p 1 -failfast
docker-compose -f test/docker-compose.yml down