From 3e51a7a6fe390621c455339aeb0f6b77623fb258 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Wed, 11 May 2022 13:18:17 -0400 Subject: [PATCH 1/4] Makefile: Mobile builds: expose main sub-servers + set SUBSERVER_PREFIX flag by default --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index dc7395e92..4fcb6ae4b 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ COMMIT_HASH := $(shell git rev-parse HEAD) GOBUILD := go build -v GOINSTALL := go install -v -GOTEST := go test +GOTEST := go test GOVERSION := $(shell go version | awk '{print $$3}') GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go") @@ -291,8 +291,8 @@ sample-conf-check: for flag in $$(GO_FLAGS_COMPLETION=1 go run -tags="$(RELEASE_TAGS)" $(PKG)/cmd/lnd -- | grep -v help | cut -c3-); do if ! grep -q $$flag sample-lnd.conf; then echo "Command line flag --$$flag not added to sample-lnd.conf"; exit 1; fi; done mobile-rpc: - @$(call print, "Creating mobile RPC from protos (prefix=$(prefix)).") - cd ./lnrpc; COMPILE_MOBILE=1 SUBSERVER_PREFIX=$(prefix) ./gen_protos_docker.sh + @$(call print, "Creating mobile RPC from protos.") + cd ./lnrpc; COMPILE_MOBILE=1 SUBSERVER_PREFIX=1 ./gen_protos_docker.sh vendor: @$(call print, "Re-creating vendor directory.") @@ -301,22 +301,22 @@ 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 $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=ios,iossimulator,macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(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 $(DEV_TAGS) autopilotrpc neutrinorpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(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 $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(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 $(DEV_TAGS) autopilotrpc neutrinorpc" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) mobile: ios android From e9feefaba6f51bb8d6dadfe159b48552ae1c1b33 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Wed, 11 May 2022 13:18:33 -0400 Subject: [PATCH 2/4] gen_bindings.sh: Mobile builds: expose main sub-servers by default --- mobile/gen_bindings.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/gen_bindings.sh b/mobile/gen_bindings.sh index 36b478b2b..035cf79bd 100755 --- a/mobile/gen_bindings.sh +++ b/mobile/gen_bindings.sh @@ -33,13 +33,13 @@ target_pkg="github.com/lightningnetwork/lnd/lnrpc" # A mapping from grpc service to name of the custom listeners. The grpc server # must be configured to listen on these. -listeners="lightning=lightningLis walletunlocker=lightningLis state=lightningLis" +listeners="lightning=lightningLis walletunlocker=lightningLis state=lightningLis autopilot=lightningLis chainnotifier=lightningLis invoices=lightningLis neutrinokit=lightningLis peers=lightningLis router=lightningLis signer=lightningLis versioner=lightningLis walletkit=lightningLis watchtower=lightningLis watchtowerclient=lightningLis" # Set to 1 to create boiler plate grpc client code and listeners. If more than # one proto file is being parsed, it should only be done once. mem_rpc=1 -PROTOS="lightning.proto walletunlocker.proto stateservice.proto" +PROTOS="lightning.proto walletunlocker.proto stateservice.proto autopilotrpc/autopilot.proto chainrpc/chainnotifier.proto invoicesrpc/invoices.proto neutrinorpc/neutrino.proto peersrpc/peers.proto routerrpc/router.proto signrpc/signer.proto verrpc/verrpc.proto walletrpc/walletkit.proto watchtowerrpc/watchtower.proto wtclientrpc/wtclient.proto" opts="package_name=$pkg,target_package=$target_pkg,listeners=$listeners,mem_rpc=$mem_rpc" From dea15d51f9aa50174c4d3af83d6f95544978cb11 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Wed, 11 May 2022 13:18:50 -0400 Subject: [PATCH 3/4] mobile/README: explain new API objects for sub-servers in LND v0.15+ --- mobile/README.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mobile/README.md b/mobile/README.md index dd378f032..538cf2fbc 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -227,19 +227,11 @@ implementation project(":lndmobile", { "default" }) ``` --- -## Options +## Calling the API -Similar to lnd, subservers can be conditionally compiled with the build by setting the tags argument: +In LND v0.15+ all API methods have prefixed the generated methods with the subserver name. This is required to support subservers with name conflicts. -```shell -⛰ make ios -``` - -To support subservers that have APIs with name conflicts, pass the "prefix" flag. This will add the subserver name as a prefix to each method name: - -```shell -⛰ make ios prefix=1 -``` +eg. `QueryScores` is now `AutopilotQueryScores`. `GetBlockHeader` is now `NeutrinoKitGetBlockHeader`. ## API docs From e0d6b2d92450904b4d16237736084010a455c263 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Wed, 11 May 2022 13:21:27 -0400 Subject: [PATCH 4/4] docs: update release notes 0.15.0 - PR #6464 --- docs/release-notes/release-notes-0.15.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/release-notes-0.15.0.md b/docs/release-notes/release-notes-0.15.0.md index aff99c967..1d0aad6b3 100644 --- a/docs/release-notes/release-notes-0.15.0.md +++ b/docs/release-notes/release-notes-0.15.0.md @@ -288,6 +288,10 @@ to the htlc interceptor API. grow very large on disk given a busy operating channel, [which is now changed with a space deduction over (at least) 96 percents.](https://github.com/lightningnetwork/lnd/pull/6347) +* [Mobile builds now expose main sub-servers by default](https://github.com/lightningnetwork/lnd/pull/6464). + All API methods have prefixed the generated methods with the subserver name. + This is required to support subservers with name conflicts. + ## Documentation * Improved instructions on [how to build lnd for mobile](https://github.com/lightningnetwork/lnd/pull/6085). @@ -355,6 +359,7 @@ gRPC performance metrics (latency to process `GetInfo`, etc)](https://github.com * Elle Mouton * ErikEk * Eugene Siegel +* Evan Kaloudis * Hampus Sjöberg * henta * hieblmi