Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ jobs:
- name: go compile
run: make build

- name: gomobile install
run: go install golang.org/x/mobile/cmd/[email protected]

- name: gomobile init
run: gomobile init

- name: android compile
run: make android

- name: wasm compile
run: make wasm

Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
# vendor/

wasm-client.wasm

# Mobile build output
build/

# Misc
*.DS_Store
11 changes: 10 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
run:
# timeout for analysis
deadline: 4m
build-tags:
- autopilotrpc
- chainrpc
- invoicesrpc
- neutrinorpc
- peersrpc
- signrpc
- walletrpc
- watchtowerrpc

linters-settings:
govet:
Expand Down Expand Up @@ -31,4 +40,4 @@ linters:
- funlen

# Gosec is outdated and reports false positives.
- gosec
- gosec
43 changes: 39 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GOLIST := go list $(PKG)/... | grep -v '/vendor/'
XARGS := xargs -L 1

LDFLAGS := -s -w -buildid=
LDFLAGS_MOBILE := -ldflags "$(call make_ldflags, ${tags}, -s -w)"

RM := rm -f
CP := cp
Expand All @@ -28,6 +29,18 @@ XARGS := xargs -L 1

LINT = $(LINT_BIN) run -v --build-tags itest

PKG := github.com/lightninglabs/lightning-node-connect
MOBILE_PKG := $(PKG)/mobile
MOBILE_BUILD_DIR :=${GOPATH}/src/$(PKG)/build
IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios
IOS_BUILD := $(IOS_BUILD_DIR)/Lndmobile.xcframework
ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android
ANDROID_BUILD := $(ANDROID_BUILD_DIR)/lnc-mobile.aar

GOMOBILE_BIN := $(GO_BIN)/gomobile

RPC_TAGS := appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc

include make/testing_flags.mk

default: build
Expand All @@ -48,14 +61,36 @@ $(LINT_BIN):

build:
@$(call print, "Building lightning-node-connect.")
$(GOBUILD) $(PKG)/...
$(GOBUILD) -tags="$(RPC_TAGS)" $(PKG)/...

wasm:
# The appengine build tag is needed because of the jessevdk/go-flags library
# that has some OS specific terminal code that doesn't compile to WASM.
cd cmd/wasm-client; GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc" -v -o wasm-client.wasm .
cd cmd/wasm-client; GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="$(RPC_TAGS)" -v -o wasm-client.wasm .
$(CP) cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm

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

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

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

android:
@$(call print, "Building Android library ($(ANDROID_BUILD)).")
mkdir -p $(ANDROID_BUILD_DIR)
GOOS=js $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" -androidapi 21 $(LDFLAGS_MOBILE) -v -o $(ANDROID_BUILD) $(MOBILE_PKG)

mobile: ios android

# =======
# TESTING
# =======
Expand All @@ -64,11 +99,11 @@ check: unit

unit:
@$(call print, "Running unit tests.")
$(UNIT)
$(UNIT) -tags="$(RPC_TAGS)"

unit-race:
@$(call print, "Running unit race tests.")
env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(UNIT_RACE)
env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(UNIT_RACE) -tags="$(RPC_TAGS)"

itest: itest-run

Expand Down
10 changes: 5 additions & 5 deletions cmd/wasm-client/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/lightninglabs/lightning-node-connect/cmd/wasm-client

require (
github.com/btcsuite/btcd/btcec/v2 v2.2.0
github.com/btcsuite/btcd/btcec/v2 v2.2.1
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/golang/protobuf v1.5.2
github.com/jessevdk/go-flags v1.4.0
github.com/lightninglabs/faraday v0.2.7-alpha.0.20220614135954-0f761430806c
github.com/lightninglabs/faraday v0.2.8-alpha.0.20220909105059-fea194ffb084
github.com/lightninglabs/lightning-node-connect v0.1.9-alpha.0.20220602120524-e9964c685b18
github.com/lightninglabs/loop v0.19.1-beta.0.20220614171321-490fb352ffe9
github.com/lightninglabs/pool v0.5.6-alpha.0.20220615075127-160ae4594f4a
github.com/lightningnetwork/lnd v0.15.0-beta.rc4
github.com/lightninglabs/loop v0.20.1-beta.0.20220916122221-9c3010150016
github.com/lightninglabs/pool v0.5.8-alpha
github.com/lightningnetwork/lnd v0.15.0-beta.rc6.0.20221005111311-2efc70a5c492
google.golang.org/grpc v1.39.0
gopkg.in/macaroon-bakery.v2 v2.0.1
gopkg.in/macaroon.v2 v2.1.0
Expand Down
Loading