Skip to content

Commit bc7a4ba

Browse files
authored
Merge pull request #25 from tnull/2022-09-start-uniffi
UniFFI bindings
2 parents 6e0fc7d + cf92ff1 commit bc7a4ba

File tree

48 files changed

+1927
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1927
-66
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
profile: minimal
2323
- name: Build on Rust ${{ matrix.toolchain }}
2424
run: cargo build --verbose --color always
25-
- name: Check formatting
25+
- name: Check release build on Rust ${{ matrix.toolchain }}
26+
run: cargo check --release --verbose --color always
27+
- name: Check formatting on Rust ${{ matrix.toolchain }}
2628
if: matrix.check-fmt
2729
run: rustup component add rustfmt && cargo fmt --all -- --check
2830
- name: Test on Rust ${{ matrix.toolchain }}

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,19 @@ Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11+
12+
# Ignore generated swift related files
13+
.swiftpm/
14+
ldk_nodeFFI.*
15+
ldk_node.swift
16+
libldk_node.dylib
17+
LightningDevKitNode.swift
18+
ldk_node.swiftmodule
19+
swift.swiftsourceinfo
20+
swift.abi.json
21+
swift.swiftdoc
22+
23+
# Ignore ldk_nodeFFI.xcframework files
24+
/bindings/swift/ldk_nodeFFI.xcframework
25+
/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs
26+
/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt

Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ categories = ["cryptography::cryptocurrencies"]
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515

16+
[lib]
17+
crate-type = ["staticlib", "cdylib"]
18+
name = "ldk_node"
19+
20+
[[bin]]
21+
name = "uniffi-bindgen"
22+
path = "uniffi-bindgen.rs"
23+
24+
[profile.release-smaller]
25+
inherits = "release"
26+
opt-level = 'z' # Optimize for size.
27+
lto = true # Enable Link Time Optimization
28+
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
29+
panic = 'abort' # Abort on panic
30+
strip = true # Strip symbols from binary*
31+
1632
[dependencies]
1733
lightning = { version = "0.0.115", features = ["max_level_trace", "std"] }
1834
lightning-invoice = { version = "0.23" }
@@ -51,13 +67,18 @@ serde_json = { version = "1.0" }
5167
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] }
5268
esplora-client = { version = "0.4", default-features = false }
5369
libc = "0.2"
70+
uniffi = { version = "0.23.0", features = ["build"] }
5471

5572
[dev-dependencies]
5673
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
5774
electrum-client = "0.12.0"
5875
proptest = "1.0.0"
5976
regex = "1.5.6"
6077

78+
[build-dependencies]
79+
uniffi = { version = "0.23.0", features = ["build", "cli"] }
80+
81+
6182
[profile.release]
6283
panic = "abort"
6384

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
}
5+
dependencies {
6+
classpath("com.android.tools.build:gradle:7.1.2")
7+
}
8+
}
9+
10+
plugins {
11+
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
12+
}
13+
14+
// library version is defined in gradle.properties
15+
val libraryVersion: String by project
16+
17+
version = libraryVersion
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
org.gradle.jvmargs=-Xmx1536m
2+
android.useAndroidX=true
3+
android.enableJetifier=true
4+
kotlin.code.style=official
5+
libraryVersion=0.1
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4+
networkTimeout=10000
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

bindings/kotlin/ldk-node-android/gradlew

Lines changed: 244 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)