Skip to content

Commit

Permalink
Add code generation of React Native bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Apr 19, 2024
1 parent 73999ea commit 8438648
Show file tree
Hide file tree
Showing 51 changed files with 2,833 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rpath = true
[workspace]
members = [
"ls-sdk-bindings",
"ls-sdk-bindings/bindings-react-native",
"ls-sdk-core",
]
resolver = "2"
Expand Down
15 changes: 15 additions & 0 deletions lib/ls-sdk-bindings/bindings-react-native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Generated files
android/
ios/
ts/
28 changes: 28 additions & 0 deletions lib/ls-sdk-bindings/bindings-react-native/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "bindings-react-native"
version = "0.0.1"
edition = "2021"

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

[dependencies]
anyhow = { version = "1.0.57", features = ["backtrace"] }
thiserror = "1.0"
tokio = { version = "1", features = ["full"] }
uniffi = { version = "0.23.0", features = ["bindgen-tests", "cli"] }
uniffi_bindgen = "0.23.0"
uniffi_macros = "0.23.0"
camino = "1.1.1"
log = "*"
serde = "*"
askama = { version = "0.11.1", default-features = false, features = ["config"] }
toml = "0.5"
clap = { version = "3.2.22", features = ["derive"] }
heck = "0.4"
paste = "1.0"
once_cell = "1.12"

[build-dependencies]
uniffi_build = { version = "0.23.0" }
uniffi_bindgen = "0.23.0"
anyhow = { version = "1.0.57", features = ["backtrace"] }
19 changes: 19 additions & 0 deletions lib/ls-sdk-bindings/bindings-react-native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# breez-sdk-rn-generator

This utility generates the liquid-swap-sdk React Native package code.

## Prerequisites

```bash
brew install ktlint kotlin swiftformat
```

```bash
yarn global add tslint typescript
```

## Run

```
cargo run
```
6 changes: 6 additions & 0 deletions lib/ls-sdk-bindings/bindings-react-native/askama.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[general]
# Directories to search for templates, relative to the crate root.
dirs = [ "src/gen_kotlin/templates", "src/gen_swift/templates", "src/gen_typescript/templates" ]

[[syntax]]
name = "rn"
5 changes: 5 additions & 0 deletions lib/ls-sdk-bindings/bindings-react-native/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SOURCES=$(sort $(wildcard ./src/*.rs ./src/**/*.rs))

codegen: $(SOURCES)
cargo run

Loading

0 comments on commit 8438648

Please sign in to comment.