Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile #526

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ itest/litd-itest
itest/lnd-itest
itest/itest.test
itest/.logs
itest/*.log
itest/*.log

# Files from mobile build.
mobile/build
mobile/*_generated.go

vendor
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PKG := github.com/lightninglabs/lightning-terminal
MOBILE_PKG := $(PKG)/mobile
ESCPKG := github.com\/lightninglabs\/lightning-terminal
LND_PKG := github.com/lightningnetwork/lnd
LOOP_PKG := github.com/lightninglabs/loop
Expand All @@ -12,6 +13,13 @@ TOOLS_DIR := tools
GO_BIN := ${GOPATH}/bin
GOACC_BIN := $(GO_BIN)/go-acc
GOIMPORTS_BIN := $(GO_BIN)/gosimports
GOMOBILE_BIN := GO111MODULE=off $(GO_BIN)/gomobile

MOBILE_BUILD_DIR :=${GOPATH}/src/$(MOBILE_PKG)/build
IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios
IOS_BUILD := $(IOS_BUILD_DIR)/Litdmobile.xcframework
ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android
ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Litdmobile.aar

COMMIT := $(shell git describe --abbrev=40 --dirty --tags)
COMMIT_HASH := $(shell git rev-parse HEAD)
Expand Down Expand Up @@ -237,3 +245,37 @@ clean:
$(RM) ./litcli-debug
$(RM) ./litd-debug
$(RM) coverage.txt

# =============
# MOBILE
# =============
mobile-rpc:
@$(call print, "Creating mobile RPC from protos.")
cd ./litrpc; COMPILE_MOBILE=1 SUBSERVER_PREFIX=1 ./gen_protos_docker.sh

vendor:
@$(call print, "Re-creating vendor directory.")
rm -r vendor/; go mod vendor


apple: vendor mobile-rpc
@$(call print, "Building iOS and macOS cxframework ($(IOS_BUILD)).")
mkdir -p $(IOS_BUILD_DIR)
$(GOMOBILE_BIN) bind -target=ios,iossimulator,macos -tags="mobile $(RELEASE_LDFLAGS)" -v -o $(IOS_BUILD) $(MOBILE_PKG)

ios: vendor mobile-rpc
@$(call print, "Building iOS cxframework ($(IOS_BUILD)).")
mkdir -p $(IOS_BUILD_DIR)
$(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(RELEASE_LDFLAGS)" -v -o $(IOS_BUILD) $(MOBILE_PKG)

macos: vendor mobile-rpc
@$(call print, "Building macOS cxframework ($(IOS_BUILD)).")
mkdir -p $(IOS_BUILD_DIR)
$(GOMOBILE_BIN) bind -target=macos -tags="mobile $(RELEASE_LDFLAGS)" -v -o $(IOS_BUILD) $(MOBILE_PKG)

android: vendor mobile-rpc
@$(call print, "Building Android library ($(ANDROID_BUILD)).")
mkdir -p $(ANDROID_BUILD_DIR)
$(GOMOBILE_BIN) bind -target=android -tags="mobile $(RELEASE_LDFLAGS)" -v -o $(ANDROID_BUILD) $(MOBILE_PKG)

mobile: ios android
12 changes: 12 additions & 0 deletions app/scripts/build-protos.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ const protoSources = async () => {
);
return {
lnd: `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/lightning.proto`,
lightning: `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/lightning.proto`,
'autopilotrpc/autopilot': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/autopilotrpc/autopilot.proto`,
'chainrpc/chainnotifier': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/chainrpc/chainnotifier.proto`,
'invoicesrpc/invoices': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/invoicesrpc/invoices.proto`,
'neutrinorpc/neutrino': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/neutrinorpc/neutrino.proto`,
'routerrpc/router': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/routerrpc/router.proto`,
'signrpc/signer': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/signrpc/signer.proto`,
'state': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/stateservice.proto`,
'walletrpc/walletkit': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/walletrpc/walletkit.proto`,
'walletunlocker': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/walletunlocker.proto`,
'watchtowerrpc/watchtower': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/watchtowerrpc/watchtower.proto`,
'wtclientrpc/wtclient': `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/wtclientrpc/wtclient.proto`,
loop: `lightninglabs/loop/${loopVersion[1]}/looprpc/client.proto`,
'swapserverrpc/server': `lightninglabs/loop/${loopVersion[1]}/swapserverrpc/server.proto`,
'swapserverrpc/common': `lightninglabs/loop/${loopVersion[1]}/swapserverrpc/common.proto`,
Expand Down
Loading