-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (106 loc) · 4.38 KB
/
Makefile
File metadata and controls
129 lines (106 loc) · 4.38 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
VERSION=`git describe --tags --dirty`
DATE=`date +%FT%T%z`
outdir=out
moduleWallet=github.com/coming-chat/wallet-SDK
pkgWalletCore = ${moduleWallet}/core
pkgBase = ${pkgWalletCore}/base
pkgWallet = ${pkgWalletCore}/wallet
pkgPolka = ${pkgWalletCore}/polka
pkgBtc = ${pkgWalletCore}/btc
pkgEth = $(pkgWalletCore)/eth
pkgCosmos = $(pkgWalletCore)/cosmos
pkgDoge = $(pkgWalletCore)/doge
pkgSolana = ${pkgWalletCore}/solana
pkgAptos = ${pkgWalletCore}/aptos
pkgSui = ${pkgWalletCore}/sui
pkgStarcoin = ${pkgWalletCore}/starcoin
pkgStarknet = ${pkgWalletCore}/starknet
pkgMSCheck = ${pkgWalletCore}/multi-signature-check
pkgWalletSDK = ${pkgBase} ${pkgWallet} ${pkgPolka} ${pkgBtc} ${pkgEth} ${pkgCosmos} ${pkgDoge} ${pkgSolana} ${pkgAptos} ${pkgSui} ${pkgStarcoin} ${pkgStarknet} ${pkgMSCheck}
moduleDefi=github.com/coming-chat/go-defi-sdk
moduleCrossswap = ${moduleDefi}/core/crossswap
pkgExecution = ${moduleCrossswap}/execution
pkgService = ${moduleCrossswap}/service
pkgTypes = ${moduleCrossswap}/types
pkgUtil = ${moduleDefi}/util
pkgDefi = ${pkgUtil} ${pkgExecution} ${pkgService} ${pkgTypes}
aptosModule=github.com/coming-chat/go-aptos
pkgAptosClient=${aptosModule}/aptosclient
moduleRedpacket=github.com/coming-chat/go-red-packet
pkgRedpacket=${moduleRedpacket}/redpacket
moduleDmens=github.com/coming-chat/go-dmens-sdk
pkgDmens=${moduleDmens}/dmens
moduleRune=github.com/coming-chat/go-runes-api
pkgRune=${moduleRune}/rune
# Lnd mobile
moduleLnd=github.com/lightningnetwork/lnd
pkgLndmobile=${moduleLnd}/mobile
lndDevTag=dev
lndRpcTags=autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc
pkgAll = ${pkgWalletSDK} ${pkgDefi} ${pkgAptosClient} ${pkgRedpacket} ${pkgDmens} ${pkgRune} ${pkgLndmobile}
iosSdkName=Wallet
andSdkName=wallet
iosZipName=wallet-SDK-ios
andZipName=wallet-SDK-android
BuilderHash=$(shell git rev-parse HEAD)
BuilderRefer=https://github.com/coming-chat/app-sdk-build/commit/$(BuilderHash)
#### android build
buildAllSDKAndroid:
ifndef t
gomobile bind -tags="mobile ${lndDevTag} ${lndRpcTags}" -ldflags "-s -w" -v -target=android/arm,android/arm64,android/amd64 -o=${outdir}/${andSdkName}.aar ${pkgAll}
else
docker run --net=host ${PWD}:/module -v ${HOME}/.gitconfig:/root/.gitconfig -v ${HOME}/.ssh:/root/.ssh --entrypoint /bin/sh makeworld/gomobile-android -c 'export GOPRIVATE=github.com/coming-chat/go-defi-sdk && export GOPROXY=https://goproxy.cn && go mod download && gomobile bind -tags="mobile ${lndDevTag} ${lndRpcTags}" -ldflags "-s -w" -target=android/arm,android/arm64 -o=${outdir}/${andSdkName}.aar ${pkgAll}'
endif
androidReposity=${outdir}/wallet-sdk-android
androidPublicVersion:
ifndef v
@echo 发布 android 包需要指定一个版本,例如 make androidPublishVersion v=0.1.3
@exit 1
endif
@cd ${androidReposity} \
&& rm -rf library/libs/* \
&& cp ../${andSdkName}.aar library/libs \
&& cp ../${andSdkName}-sources.jar library/libs \
&& git add --all \
&& git commit -m 'Auto Publish ${v}' -m "refer to ${BuilderRefer}" \
&& git tag -f ${v} \
&& git push origin main tag ${v} --force
androidBuildAndPublish:
ifndef v
@echo 发布 android 包需要指定一个版本,例如 make androidPublishVersion v=0.1.3
@exit 1
endif
@make buildAllSDKAndroid
@make androidPublicVersion
#### android build
#### IOS build
buildAllSDKIOS:
GOOS=ios gomobile bind -tags="mobile ${lndDevTag} ${lndRpcTags}" -ldflags "-s -w" -v -target=ios/arm64 -o=${outdir}/${iosSdkName}.xcframework ${pkgAll}
iosPackageName=${iosSdkName}.xcframework
iosReposity=${outdir}/Wallet-iOS
iosCopySdk:
@cd ${iosReposity} \
&& rm -rf Sources/* \
&& cp -Rf ../${iosPackageName} Sources \
&& cp -Rf ../${iosPackageName}/ios-arm64/Wallet.framework/Headers Sources \
&& rm -rf Sources/Wallet.xcframework/ios-arm64_x86_64-simulator
# 移除 x86_64 的文件,因为超过 100M 了,影响了代码上传和 swift 包的文件下载
iosPublishVersion:
ifndef v
@echo 发布 iOS 包需要指定一个版本,例如 make publishIOSVersion v=1.0.1
@exit 1
endif
@make iosCopySdk
@cd ${iosReposity} \
&& git add --all \
&& git commit -m 'Auto Publish ${v}' -m "refer to ${BuilderRefer}" \
&& git tag -f ${v} \
&& git push origin main tag ${v} --force
iosBuildAndPublish:
ifndef v
@echo 发布 iOS 包需要指定一个版本,例如 make iosBuildAndPublish v=1.0.1
@exit 1
endif
@make buildAllSDKIOS
@make iosPublishVersion
#### IOS build