Merge pull request #3748 from halseth/falafel-updates
[mobile] Update readme and comments
This commit is contained in:
commit
ff268ac39d
@ -2,20 +2,22 @@
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
#### protoc
|
#### protoc
|
||||||
Install the dependencies for generating protobuf definitions as stated in [lnrpc docs](
|
Install the dependencies for generating protobuf definitions as stated in
|
||||||
../lnrpc/README.md#generate-protobuf-definitions)
|
[lnrpc docs]( ../lnrpc/README.md#generate-protobuf-definitions)
|
||||||
|
|
||||||
#### gomobile
|
#### gomobile
|
||||||
Follow [gomobile](https://github.com/golang/go/wiki/Mobile) in order to install `gomobile` and dependencies.
|
Follow [gomobile](https://github.com/golang/go/wiki/Mobile) in order to install
|
||||||
|
`gomobile` and dependencies.
|
||||||
|
|
||||||
Remember to run `gomobile init` (otherwise the `lnd` build might just hang).
|
Remember to run `gomobile init` (otherwise the `lnd` build might just hang).
|
||||||
|
|
||||||
Note that `gomobile` only supports building projects from `GOPATH` at this point.
|
Note that `gomobile` only supports building projects from `GOPATH` at this
|
||||||
|
point.
|
||||||
|
|
||||||
#### falafel
|
#### falafel
|
||||||
Install [`falafel`](https://github.com/halseth/falafel):
|
Install [`falafel`](https://github.com/lightninglabs/falafel):
|
||||||
```
|
```
|
||||||
go get -u -v github.com/halseth/falafel
|
go get -u -v github.com/lightninglabs/falafel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building `lnd` for iOS
|
### Building `lnd` for iOS
|
||||||
@ -31,21 +33,31 @@ make android
|
|||||||
`make mobile` will build both iOS and Android libs.
|
`make mobile` will build both iOS and Android libs.
|
||||||
|
|
||||||
### Libraries
|
### Libraries
|
||||||
After the build has succeeded, the libraries will be found in `mobile/build/ios/Lndmobile.framework` and `mobile/build/android/Lndmobile.aar`. Reference your platforms' SDK documentation for how to add the library to your project.
|
After the build has succeeded, the libraries will be found in
|
||||||
|
`mobile/build/ios/Lndmobile.framework` and
|
||||||
|
`mobile/build/android/Lndmobile.aar`. Reference your platforms' SDK
|
||||||
|
documentation for how to add the library to your project.
|
||||||
|
|
||||||
#### Generating proto definitions for your language.
|
#### Generating proto definitions for your language.
|
||||||
In order to call the methods in the generated library, the serialized proto for the given RPC call must be provided. Similarly, the response will be a serialized proto.
|
In order to call the methods in the generated library, the serialized proto for
|
||||||
|
the given RPC call must be provided. Similarly, the response will be a
|
||||||
|
serialized proto.
|
||||||
|
|
||||||
In order to generate protobuf definitions for your language of choice, add the proto plugin to the `protoc` invocations found in [`gen_protos.sh`](../lnrpc/gen_protos.sh). For instance to generate protos for Swift, add `--swift_out=.` and run `make rpc`.
|
In order to generate protobuf definitions for your language of choice, add the
|
||||||
|
proto plugin to the `protoc` invocations found in
|
||||||
|
[`gen_protos.sh`](../lnrpc/gen_protos.sh). For instance to generate protos for
|
||||||
|
Swift, add `--swift_out=.` and run `make rpc`.
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
Similar to lnd, subservers can be conditionally compiled with the build by setting the tags argument:
|
Similar to lnd, subservers can be conditionally compiled with the build by
|
||||||
|
setting the tags argument:
|
||||||
|
|
||||||
```
|
```
|
||||||
make ios tags="routerrpc"
|
make ios tags="routerrpc"
|
||||||
```
|
```
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
```
|
```
|
||||||
make ios tags="routerrpc" prefix=1
|
make ios tags="routerrpc" prefix=1
|
||||||
|
@ -19,11 +19,21 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Name of the package for the generated APIs.
|
||||||
pkg="lndmobile"
|
pkg="lndmobile"
|
||||||
|
|
||||||
|
# The package where the protobuf definitions originally are found.
|
||||||
target_pkg="github.com/lightningnetwork/lnd/lnrpc"
|
target_pkg="github.com/lightningnetwork/lnd/lnrpc"
|
||||||
|
|
||||||
# Generate APIs by passing the parsed protos to the falafel plugin.
|
# A mapping from grpc service to name of the custom listeners. The grpc server
|
||||||
opts="package_name=$pkg,target_package=$target_pkg,listeners=lightning=lightningLis walletunlocker=walletUnlockerLis,mem_rpc=1"
|
# must be configured to listen on these.
|
||||||
|
listeners="lightning=lightningLis walletunlocker=walletUnlockerLis"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
opts="package_name=$pkg,target_package=$target_pkg,listeners=$listeners,mem_rpc=$mem_rpc"
|
||||||
protoc -I/usr/local/include -I. \
|
protoc -I/usr/local/include -I. \
|
||||||
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
||||||
--plugin=protoc-gen-custom=$falafel\
|
--plugin=protoc-gen-custom=$falafel\
|
||||||
|
Loading…
Reference in New Issue
Block a user