-
Notifications
You must be signed in to change notification settings - Fork 48
/
Makefile
104 lines (83 loc) · 3.67 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
VERSION=`git describe --tags --dirty`
DATE=`date +%FT%T%z`
outdir=out
module=github.com/dabankio/wallet-core
pkgBip39 = ${module}/bip39
pkgBip44 = ${module}/bip44
pkgCrypto = ${module}/crypto
pkgBtc = ${module}/core/btc
pkgBBC = ${module}/core/bbc
pkgOmni = ${module}/core/omni
pkgEth = ${module}/core/eth
pkgWallet = ${module}/wallet
pkgCore = ${module}/core
pkgAll = ${pkgCrypto} $(pkgBip39) $(pkgBip44) $(pkgBtc) $(pkgEth) $(pkgOmni) $(pkgWallet) $(pkgBBC)
fmt: # 格式化go代码
@go fmt ./...
test: # go单元测试
@bash script/ci-test.sh
modTidy:
@go mod tidy
#---------------------集成测试 start -----------------
integrationTest:
make integrationTestBtc
make integrationTestEth
make integrationTestOmni
integrationTestBtc:
#BTC 集成测试需要配置环境变量 BITCOIN_BIN_DIR 指向bitcoin-core目录
@go test -v -tags=integration github.com/dabankio/wallet-core/qa/btc
integrationTestOmni:
#Omni 集成测试需要配置环境变量 OMNI_BIN_PATH 指向omni-core目录
@go test -v -tags=integration github.com/dabankio/wallet-core/qa/omni
integrationTestEth:
#ETH 集成测试需要安装 npm i -g ganache-cli
@go test -v -tags=integration github.com/dabankio/wallet-core/qa/eth
#---------------------集成测试 end -----------------
#---------------------构建 start -----------------
#bip39
buildBip39Android:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/bip39.aar ${pkgBip39}
buildBip39IOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/bip39.framework ${pkgBip39}
#bbc
buildBBCAndroid:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/bbc.aar ${pkgBBC} ${pkgBip44} ${pkgBip39}
buildBBCIOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/bbc.framework ${pkgBBC} ${pkgBip44} ${pkgBip39}
packageBBCAll:
rm -rf ${outdir}/*
@make buildBBCAndroid && cd ${outdir} && mkdir android-bbc && mv bbc* android-bbc && tar czvf bbc-android.tar.gz android-bbc/*
@make buildBBCIOS && cd ${outdir} && tar czvf bbc.framework.tar.gz bbc.framework/*
#btc
buildBtcAndroid:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/btc.aar ${pkgBtc} ${pkgBip44} ${pkgBip39}
buildBtcIOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/btc.framework ${pkgBtc} ${pkgBip44} ${pkgBip39}
#TODO btc+omni
buildOmniBtcAndroid:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/btcOmni.aar ${pkgBtc} ${pkgOmni} ${pkgBip44} ${pkgBip39}
buildOmniBtcIOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/btcOmni.framework ${pkgBtc} ${pkgOmni} ${pkgBip44} ${pkgBip39}
#eth
buildEthAndroid:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/eth.aar ${pkgEth} ${pkgBip44} ${pkgBip39}
buildEthIOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/eth.framework ${pkgEth} ${pkgBip44} ${pkgBip39}
#all: bip39,bip44,btc,eth,omni
buildAllAndroid:
gomobile bind -ldflags "-s -w" -target=android -o=${outdir}/wallet.aar ${pkgAll}
buildAllIOS:
gomobile bind -ldflags "-s -w" -target=ios -o=${outdir}/Bip39.framework ${pkgAll}
packageAll:
rm -rf ${outdir}/*
@make buildAllAndroid && make buildAllIOS
@cd ${outdir} && mkdir android && mv wallet* android
@cd ${outdir} && tar czvf android.tar.gz android/*
@cd ${outdir} && tar czvf Bip39.framework.tar.gz Bip39.framework/*
#---------------------构建 end -----------------
#---------------------依赖图 start -----------------
depGraph: #生成工程依赖图,需要安装graphviz 和 https://github.com/loov/goda (go get github.com/loov/goda)
@goda graph github.com/dabankio/wallet-core/...:root | dot -Tsvg -o local_graph.svg
#---------------------依赖图 end -----------------
docServer:
godoc -templates=$GOPATH/src/golang.org/x/tools/godoc/static -http=:6060