@@ -7,7 +7,7 @@ Automatic Swift bindings generation for [`rust-lightning`](https://github.com/li
7
7
### Swift Package Manager
8
8
To install using Swift Package Manager, add the following line to the depedencies array of your ` Package.swift ` :
9
9
```
10
- .package(url: "https://github.com/lightningdevkit/ldk-swift/", exact: "0.0.110 ")
10
+ .package(url: "https://github.com/lightningdevkit/ldk-swift/", exact: "0.0.113 ")
11
11
```
12
12
Be sure to also include "LightningDevKit" into your packages target like so:
13
13
@@ -36,9 +36,10 @@ from scratch.
36
36
### Prerequisites
37
37
38
38
- A machine running macOS
39
- - [ Xcode 13.2.1 ] ( https://xcodereleases.com/ ) or lower (this is because there is a bug with ` cc ` that prevents it from compiling for Mac Catalyst targets with clang 13 )
39
+ - [ Xcode] ( https://xcodereleases.com/ )
40
40
- [ Python3] ( https://programwithus.com/learn/python/install-python3-mac )
41
41
- [ Rust] ( https://www.rust-lang.org/tools/install )
42
+ - [ NPM] ( https://docs.npmjs.com/downloading-and-installing-node-js-and-npm )
42
43
- [ GNU sed] ( https://formulae.brew.sh/formula/gnu-sed ) (optional, but will cut your compile times significantly!)
43
44
44
45
For Rust specifically, there are a couple additional requirements that can be installed once the Rust toolchain
@@ -57,13 +58,13 @@ In order to generate these bindings from scratch, you will need to clone two dep
57
58
** [ rust-lightning] ( https://github.com/lightningdevkit/rust-lightning ) ** , (a specific branch built for bindings compatibility):
58
59
59
60
``` shell
60
- git clone --branch 2022-10-112 -java-bindings https://github.com/TheBlueMatt/rust-lightning /path/to/rust-lightning
61
+ git clone --branch 2022-12-0.0.113 -java-bindings https://github.com/TheBlueMatt/rust-lightning /path/to/rust-lightning
61
62
```
62
63
63
64
** [ ldk-c-bindings] ( https://github.com/lightningdevkit/ldk-c-bindings ) ** :
64
65
65
66
``` shell
66
- git clone --branch v0.0.112.0 https://github.com/lightningdevkit/ldk-c-bindings /path/to/ldk-c-bindings
67
+ git clone --branch v0.0.113.1 https://github.com/lightningdevkit/ldk-c-bindings /path/to/ldk-c-bindings
67
68
```
68
69
69
70
Take note of where you clone these directories, it's best you save the absolute path somewhere handy for the rest of the remaining steps.
@@ -94,11 +95,11 @@ folder due to the previous `genbindings.sh` step. As Docker won't have access to
94
95
replace those lines with the following:
95
96
96
97
``` yaml
97
- lightning = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-07-109 -java-bindings", default-features = false }
98
- lightning-persister = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-07-109 -java-bindings", default-features = false }
99
- lightning-invoice = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-07-109 -java-bindings", default-features = false }
100
- lightning-background-processor = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-07-109 -java-bindings", default-features = false }
101
- lightning-rapid-gossip-sync = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-07-109 -java-bindings", default-features = false }
98
+ lightning = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-12-0.0.113 -java-bindings", default-features = false }
99
+ lightning-persister = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-12-0.0.113 -java-bindings", default-features = false }
100
+ lightning-invoice = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-12-0.0.113 -java-bindings", default-features = false }
101
+ lightning-background-processor = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-12-0.0.113 -java-bindings", default-features = false }
102
+ lightning-rapid-gossip-sync = { git = "https://github.com/thebluematt/rust-lightning", branch = "2022-12-0.0.113 -java-bindings", default-features = false }
102
103
```
103
104
104
105
You will note that the revision is unspecified and is currently just placeholder ` xxx ` s. To obtain the revision,
@@ -119,29 +120,11 @@ To generate the Swift files, navigate to the `ldk-swift` repository and run the
119
120
120
121
``` shell
121
122
export LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH=" /path/to/ldk-c-bindings/lightning-c-bindings/include/lightning.h"
122
- python3 ./
123
+ npm i && npm run tsc && node ./src/index.mjs
123
124
```
124
125
125
126
Now, the contents of ` ./ci/LDKSwift/Sources/LDKSwift/bindings ` will have been completely regenerated.
126
127
127
- ### Preparing the correct Xcode version
128
-
129
- To make sure the next two steps work correctly, you need to verify that you're using Xcode 13.2.1.
130
- If you have a later version, you can download the correct version from here: https://xcodereleases.com/
131
-
132
- The direct download link is
133
-
134
- https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_13.2.1/Xcode_13.2.1.xip
135
-
136
- You may be asked to log in to your Apple developer account.
137
-
138
- After downloading the correct Xcode version and copying it to Applications, you might also need to run
139
- the following command with root privileges:
140
-
141
- ``` shell
142
- sudo xcode-select -s /Applications/Xcode\ 13.2.1.app/Contents/Developer/
143
- ```
144
-
145
128
#### Updating Swift files in Xcode project
146
129
147
130
To make sure the correct bindings files are referenced in the project, open ` ./xcode/LDKFramework/LDK.xcodeproj ` .
@@ -162,7 +145,7 @@ Finally, make sure you leave the "Copy items if needed" box unchecked, and pick
162
145
163
146
### Building requisite binaries
164
147
165
- Navigate (` cd ` ) to the ` ./src/ scripts ` folder, and run the following Python script:
148
+ Navigate (` cd ` ) to the ` ./scripts ` folder, and run the following Python script:
166
149
167
150
``` shell
168
151
python3 ./build_bulk_libldks.py /path/to/ldk-c-bindings
0 commit comments