Update selected built packages to Uniffi 0.28 (#766)

This commit is contained in:
Ross Savage
2025-03-12 11:56:42 +01:00
committed by GitHub
parent b19260f604
commit 9e83e06bd5
31 changed files with 1967 additions and 525 deletions

View File

@@ -21,14 +21,35 @@ on:
required: false required: false
type: boolean type: boolean
default: false default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false
jobs: jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
build: build:
if: ${{ !inputs.use-dummy-binaries }} if: ${{ !inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build ${{ matrix.target }} name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-linux-android, aarch64-linux-android,
x86_64-linux-android, x86_64-linux-android,
@@ -55,12 +76,18 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
key: ${{ matrix.uniffi }}
workspaces: lib workspaces: lib
- name: Build bindings - name: Build bindings
if: matrix.uniffi != '-uniffi-25'
working-directory: lib/bindings working-directory: lib/bindings
run: | run: cargo ndk -t ${{ matrix.target }} build --release
cargo ndk -t ${{ matrix.target }} build --release
- name: Build bindings Uniffi 0.25
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: cargo ndk -t ${{ matrix.target }} build --no-default-features --features=uniffi-25 --release
- name: Copy build output - name: Copy build output
run: | run: |
@@ -73,36 +100,43 @@ jobs:
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: dist/* path: dist/*
jnilibs: jnilibs:
needs: build needs:
- setup
- build
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build jniLibs name: build jniLibs${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-linux-android name: bindings-aarch64-linux-android${{ matrix.uniffi }}
path: arm64-v8a path: arm64-v8a
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-linux-android name: bindings-x86_64-linux-android${{ matrix.uniffi }}
path: x86_64 path: x86_64
- name: Archive jniLibs - name: Archive jniLibs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-android-jniLibs name: bindings-android-jniLibs${{ matrix.uniffi }}
path: ./* path: ./*
build-dummies: build-dummies:
if: ${{ inputs.use-dummy-binaries }} if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build android dummies name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-linux-android, aarch64-linux-android,
x86_64-linux-android, x86_64-linux-android,
@@ -116,26 +150,31 @@ jobs:
- name: Upload dummy Android ${{ matrix.target }} artifact - name: Upload dummy Android ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./* path: ./*
jnilibs-dummy: jnilibs-dummy:
needs: build-dummies needs:
- setup
- build-dummies
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build jniLibs dummy name: build jniLibs dummy ${{ matrix.target }}${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-linux-android name: bindings-aarch64-linux-android${{ matrix.uniffi }}
path: arm64-v8a path: arm64-v8a
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-linux-android name: bindings-x86_64-linux-android${{ matrix.uniffi }}
path: x86_64 path: x86_64
- name: Archive jniLibs - name: Archive jniLibs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-android-jniLibs name: bindings-android-jniLibs${{ matrix.uniffi }}
path: ./* path: ./*

View File

@@ -21,14 +21,35 @@ on:
required: false required: false
type: boolean type: boolean
default: false default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false
jobs: jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
build: build:
if: ${{ !inputs.use-dummy-binaries }} if: ${{ !inputs.use-dummy-binaries }}
runs-on: macOS-latest runs-on: macOS-latest
name: build ${{ matrix.target }} name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-apple-darwin, aarch64-apple-darwin,
x86_64-apple-darwin, x86_64-apple-darwin,
@@ -55,33 +76,45 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
key: ${{ matrix.uniffi }}
workspaces: lib workspaces: lib
- name: Build bindings - name: Build bindings
if: matrix.uniffi != '-uniffi-25'
working-directory: lib/bindings working-directory: lib/bindings
run: cargo lipo --release --targets ${{ matrix.target }} run: cargo lipo --release --targets ${{ matrix.target }}
- name: Build bindings Uniffi 0.25
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: cargo lipo --no-default-features --features=uniffi-25 --release --targets ${{ matrix.target }}
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: | path: |
lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.dylib lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.dylib
lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.a lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.a
merge: merge:
runs-on: macOS-latest runs-on: macOS-latest
needs: build needs:
name: build darwin-universal - setup
- build
name: build darwin-universal${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-darwin name: bindings-aarch64-apple-darwin${{ matrix.uniffi }}
path: aarch64-apple-darwin path: aarch64-apple-darwin
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-apple-darwin name: bindings-x86_64-apple-darwin${{ matrix.uniffi }}
path: x86_64-apple-darwin path: x86_64-apple-darwin
- name: Build Darwin universal - name: Build Darwin universal
@@ -93,7 +126,7 @@ jobs:
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-darwin-universal name: bindings-darwin-universal${{ matrix.uniffi }}
path: | path: |
darwin-universal/libbreez_sdk_liquid_bindings.dylib darwin-universal/libbreez_sdk_liquid_bindings.dylib
darwin-universal/libbreez_sdk_liquid_bindings.a darwin-universal/libbreez_sdk_liquid_bindings.a
@@ -101,9 +134,12 @@ jobs:
build-dummies: build-dummies:
if: ${{ inputs.use-dummy-binaries }} if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build darwin dummies name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs:
- setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-apple-darwin, aarch64-apple-darwin,
x86_64-apple-darwin, x86_64-apple-darwin,
@@ -118,5 +154,5 @@ jobs:
- name: Upload dummy darwin ${{ matrix.target }} artifact - name: Upload dummy darwin ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./* path: ./*

View File

@@ -21,14 +21,35 @@ on:
required: false required: false
type: boolean type: boolean
default: false default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false
jobs: jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
build: build:
if: ${{ !inputs.use-dummy-binaries }} if: ${{ !inputs.use-dummy-binaries }}
runs-on: macOS-latest runs-on: macOS-latest
name: build ${{ matrix.target }} name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-apple-ios, aarch64-apple-ios,
x86_64-apple-ios, x86_64-apple-ios,
@@ -58,6 +79,7 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
key: ${{ matrix.uniffi }}
workspaces: lib workspaces: lib
- name: Install xcode - name: Install xcode
@@ -66,33 +88,44 @@ jobs:
xcode-version: latest-stable xcode-version: latest-stable
- name: Build bindings - name: Build bindings
if: matrix.uniffi != '-uniffi-25'
working-directory: lib/bindings working-directory: lib/bindings
run: cargo build --release --target ${{ matrix.target }} run: cargo build --release --target ${{ matrix.target }}
- name: Build bindings Uniffi 0.25
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: cargo build --no-default-features --features=uniffi-25 --release --target ${{ matrix.target }}
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.a path: lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.a
merge: merge:
runs-on: macOS-latest runs-on: macOS-latest
needs: build needs:
name: build ios-universal - setup
- build
name: build ios-universal${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-ios name: bindings-aarch64-apple-ios${{ matrix.uniffi }}
path: aarch64-apple-ios path: aarch64-apple-ios
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-apple-ios name: bindings-x86_64-apple-ios${{ matrix.uniffi }}
path: x86_64-apple-ios path: x86_64-apple-ios
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-ios-sim name: bindings-aarch64-apple-ios-sim${{ matrix.uniffi }}
path: aarch64-apple-ios-sim path: aarch64-apple-ios-sim
- name: Build ios-universal - name: Build ios-universal
@@ -108,21 +141,23 @@ jobs:
- name: Archive ios-universal - name: Archive ios-universal
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-ios-universal name: bindings-ios-universal${{ matrix.uniffi }}
path: ios-universal/libbreez_sdk_liquid_bindings.a path: ios-universal/libbreez_sdk_liquid_bindings.a
- name: Archive ios-universal-sim - name: Archive ios-universal-sim
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-ios-universal-sim name: bindings-ios-universal-sim${{ matrix.uniffi }}
path: ios-universal-sim/libbreez_sdk_liquid_bindings.a path: ios-universal-sim/libbreez_sdk_liquid_bindings.a
build-dummies: build-dummies:
if: ${{ inputs.use-dummy-binaries }} if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build ios dummies name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-apple-ios, aarch64-apple-ios,
x86_64-apple-ios, x86_64-apple-ios,
@@ -138,5 +173,5 @@ jobs:
- name: Upload dummy ios ${{ matrix.target }} artifact - name: Upload dummy ios ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}{{ matrix.uniffi }}
path: ./* path: ./*

View File

@@ -21,14 +21,35 @@ on:
required: false required: false
type: boolean type: boolean
default: false default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false
jobs: jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
build: build:
if: ${{ !inputs.use-dummy-binaries }} if: ${{ !inputs.use-dummy-binaries }}
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
name: build ${{ matrix.target }} name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu,
@@ -66,27 +87,39 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
key: ${{ matrix.uniffi }}
workspaces: lib workspaces: lib
- name: Build bindings - name: Build bindings
if: matrix.uniffi != '-uniffi-25'
working-directory: lib/bindings working-directory: lib/bindings
env: env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/x86_64-linux-gnu-gcc CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/x86_64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }} run: cargo build --release --target ${{ matrix.target }}
- name: Build bindings Uniffi 0.25
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/x86_64-linux-gnu-gcc
run: cargo build --no-default-features --features=uniffi-25 --release --target ${{ matrix.target }}
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.so path: lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.so
build-dummies: build-dummies:
if: ${{ inputs.use-dummy-binaries }} if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build linux dummies name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu,
@@ -99,5 +132,5 @@ jobs:
- name: Upload dummy linux ${{ matrix.target }} artifact - name: Upload dummy linux ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./* path: ./*

View File

@@ -21,14 +21,35 @@ on:
required: false required: false
type: boolean type: boolean
default: false default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false
jobs: jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
build: build:
if: ${{ !inputs.use-dummy-binaries }} if: ${{ !inputs.use-dummy-binaries }}
runs-on: windows-latest runs-on: windows-latest
name: build ${{ matrix.target }} name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
x86_64-pc-windows-msvc, x86_64-pc-windows-msvc,
] ]
@@ -53,24 +74,33 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
key: ${{ matrix.uniffi }}
workspaces: lib workspaces: lib
- name: Build bindings - name: Build bindings
if: matrix.uniffi != '-uniffi-25'
working-directory: lib/bindings working-directory: lib/bindings
run: cargo build --release --target ${{ matrix.target }} run: cargo build --release --target ${{ matrix.target }}
- name: Build bindings Uniffi 0.25
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: cargo build --no-default-features --features=uniffi-25 --release --target ${{ matrix.target }}
- name: Archive release - name: Archive release
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: lib/target/${{ matrix.target }}/release/breez_sdk_liquid_bindings.dll path: lib/target/${{ matrix.target }}/release/breez_sdk_liquid_bindings.dll
build-dummies: build-dummies:
if: ${{ inputs.use-dummy-binaries }} if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: build windows dummies name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy: strategy:
matrix: matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [ target: [
x86_64-pc-windows-msvc, x86_64-pc-windows-msvc,
] ]
@@ -82,5 +112,5 @@ jobs:
- name: Upload dummy windows ${{ matrix.target }} artifact - name: Upload dummy windows ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bindings-${{ matrix.target }} name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./* path: ./*

View File

@@ -60,6 +60,7 @@ on:
jobs: jobs:
build-language-bindings: build-language-bindings:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ inputs.kotlin || inputs.swift || inputs.python }}
steps: steps:
- name: Checkout breez-sdk-liquid repo - name: Checkout breez-sdk-liquid repo
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -77,12 +78,16 @@ jobs:
with: with:
version: "27.2" version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: lib
- name: Build Kotlin binding - name: Build Kotlin binding
if: ${{ inputs.kotlin }} if: ${{ inputs.kotlin }}
working-directory: lib/bindings working-directory: lib/bindings
run: | run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --language kotlin -o ffi/kotlin cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --language kotlin -o ffi/kotlin
- name: Archive Kotlin binding - name: Archive Kotlin binding
if: ${{ inputs.kotlin }} if: ${{ inputs.kotlin }}
@@ -90,19 +95,12 @@ jobs:
with: with:
name: bindings-kotlin name: bindings-kotlin
path: lib/bindings/ffi/kotlin/breez_sdk_liquid/breez_sdk_liquid.kt path: lib/bindings/ffi/kotlin/breez_sdk_liquid/breez_sdk_liquid.kt
- name: Archive Kotlin multiplatform binding
if: ${{ inputs.kotlin }}
uses: actions/upload-artifact@v4
with:
name: bindings-kotlin-multiplatform
path: lib/bindings/ffi/kmp/*
- name: Build Swift binding - name: Build Swift binding
if: ${{ inputs.swift }} if: ${{ inputs.swift }}
working-directory: lib/bindings working-directory: lib/bindings
run: | run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift --out-dir langs/swift/Sources/BreezSDKLiquid cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift --out-dir langs/swift/Sources/BreezSDKLiquid
mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift
- name: Archive Swift binding - name: Archive Swift binding
@@ -116,7 +114,7 @@ jobs:
if: ${{ inputs.python }} if: ${{ inputs.python }}
working-directory: lib/bindings working-directory: lib/bindings
run: | run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --language python -o ffi/python cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --language python -o ffi/python
- name: Archive Python binding - name: Archive Python binding
if: ${{ inputs.python }} if: ${{ inputs.python }}
@@ -125,6 +123,45 @@ jobs:
name: bindings-python name: bindings-python
path: lib/bindings/ffi/python/breez_sdk_liquid.py path: lib/bindings/ffi/python/breez_sdk_liquid.py
build-language-bindings-uniffi-25:
runs-on: ubuntu-latest
if: ${{ inputs.kotlin || inputs.csharp || inputs.golang }}
steps:
- name: Checkout breez-sdk-liquid repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
key: uniffi-25
workspaces: lib
- name: Build Kotlin binding
if: ${{ inputs.kotlin }}
working-directory: lib/bindings
run: |
cargo run --no-default-features --features=uniffi-25 --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --language kotlin -o ffi/kotlin
- name: Archive Kotlin multiplatform binding
if: ${{ inputs.kotlin }}
uses: actions/upload-artifact@v4
with:
name: bindings-kotlin-multiplatform
path: lib/bindings/ffi/kmp/*
- name: Build C# binding - name: Build C# binding
if: ${{ inputs.csharp }} if: ${{ inputs.csharp }}
working-directory: lib/bindings working-directory: lib/bindings

View File

@@ -153,15 +153,55 @@ jobs:
version: "27.2" version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build bindings
working-directory: lib/bindings
run: cargo build
- name: Run bindings tests
run: |
curl -o jna-5.12.1.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
export CLASSPATH=$(pwd)/jna-5.12.1.jar;
cd lib/bindings
cargo test
build-bindings-uniffi-25:
name: Test bindings Uniffi 0.25
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
key: -uniffi-25
workspaces: |
lib -> target
cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup dotnet - name: Setup dotnet
if: ${{ !inputs.skip-tests }}
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '7.0.x' dotnet-version: '7.0.x'
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.19.9'
- name: Build bindings - name: Build bindings
working-directory: lib/bindings working-directory: lib/bindings
run: cargo build run: cargo build --no-default-features --features uniffi-25
- name: Build C# bindings - name: Build C# bindings
working-directory: lib/bindings working-directory: lib/bindings
@@ -178,22 +218,9 @@ jobs:
cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/golang cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/golang
cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/ cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.19.9'
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Run bindings tests - name: Run bindings tests
run: | working-directory: lib/bindings
curl -o jna-5.12.1.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar run: cargo test --no-default-features --features uniffi-25
export CLASSPATH=$(pwd)/jna-5.12.1.jar;
cd lib/bindings
cargo test
build-wasm: build-wasm:
name: Test WASM name: Test WASM
@@ -255,7 +282,7 @@ jobs:
- name: Build Android bindings - name: Build Android bindings
working-directory: lib/bindings working-directory: lib/bindings
run: | run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o langs/android/lib/src/main/kotlin cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o langs/android/lib/src/main/kotlin
- name: Run Android build - name: Run Android build
working-directory: lib/bindings/langs/android working-directory: lib/bindings/langs/android
@@ -265,7 +292,7 @@ jobs:
- name: Build Swift bindings - name: Build Swift bindings
working-directory: lib/bindings working-directory: lib/bindings
run: | run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid
mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers

View File

@@ -121,6 +121,7 @@ jobs:
swift-package-version: ${{ needs.pre-setup.outputs.swift-package-version || '0.0.2' }} swift-package-version: ${{ needs.pre-setup.outputs.swift-package-version || '0.0.2' }}
publish: ${{ needs.pre-setup.outputs.publish }} publish: ${{ needs.pre-setup.outputs.publish }}
use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }} use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }}
uniffi-25: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.kotlin-multiplatform-package-version }}
steps: steps:
- run: echo "set setup output variables" - run: echo "set setup output variables"
@@ -132,6 +133,7 @@ jobs:
repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
build-bindings-darwin: build-bindings-darwin:
needs: setup needs: setup
@@ -141,6 +143,7 @@ jobs:
repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
build-bindings-linux: build-bindings-linux:
needs: setup needs: setup
@@ -150,6 +153,7 @@ jobs:
repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
build-bindings-android: build-bindings-android:
needs: setup needs: setup
@@ -159,6 +163,7 @@ jobs:
repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
build-bindings-ios: build-bindings-ios:
needs: setup needs: setup
@@ -168,6 +173,7 @@ jobs:
repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
build-language-bindings: build-language-bindings:
needs: setup needs: setup

View File

@@ -46,27 +46,27 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-darwin name: bindings-aarch64-apple-darwin-uniffi-25
path: lib/bindings/langs/csharp/src/runtimes/osx-arm64/native path: lib/bindings/langs/csharp/src/runtimes/osx-arm64/native
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-apple-darwin name: bindings-x86_64-apple-darwin-uniffi-25
path: lib/bindings/langs/csharp/src/runtimes/osx-x64/native path: lib/bindings/langs/csharp/src/runtimes/osx-x64/native
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-unknown-linux-gnu name: bindings-aarch64-unknown-linux-gnu-uniffi-25
path: lib/bindings/langs/csharp/src/runtimes/linux-arm64/native path: lib/bindings/langs/csharp/src/runtimes/linux-arm64/native
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-unknown-linux-gnu name: bindings-x86_64-unknown-linux-gnu-uniffi-25
path: lib/bindings/langs/csharp/src/runtimes/linux-x64/native path: lib/bindings/langs/csharp/src/runtimes/linux-x64/native
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-pc-windows-msvc name: bindings-x86_64-pc-windows-msvc-uniffi-25
path: lib/bindings/langs/csharp/src/runtimes/win-x64/native path: lib/bindings/langs/csharp/src/runtimes/win-x64/native
- name: Update package version - name: Update package version

View File

@@ -38,37 +38,37 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-linux-android name: bindings-aarch64-linux-android-uniffi-25
path: breez_sdk_liquid/lib/android-aarch64 path: breez_sdk_liquid/lib/android-aarch64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-linux-android name: bindings-x86_64-linux-android-uniffi-25
path: breez_sdk_liquid/lib/android-amd64 path: breez_sdk_liquid/lib/android-amd64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-darwin name: bindings-aarch64-apple-darwin-uniffi-25
path: breez_sdk_liquid/lib/darwin-aarch64 path: breez_sdk_liquid/lib/darwin-aarch64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-apple-darwin name: bindings-x86_64-apple-darwin-uniffi-25
path: breez_sdk_liquid/lib/darwin-amd64 path: breez_sdk_liquid/lib/darwin-amd64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-unknown-linux-gnu name: bindings-aarch64-unknown-linux-gnu-uniffi-25
path: breez_sdk_liquid/lib/linux-aarch64 path: breez_sdk_liquid/lib/linux-aarch64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-unknown-linux-gnu name: bindings-x86_64-unknown-linux-gnu-uniffi-25
path: breez_sdk_liquid/lib/linux-amd64 path: breez_sdk_liquid/lib/linux-amd64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-pc-windows-msvc name: bindings-x86_64-pc-windows-msvc-uniffi-25
path: breez_sdk_liquid/lib/windows-amd64 path: breez_sdk_liquid/lib/windows-amd64
- name: Archive Go release - name: Archive Go release

View File

@@ -44,7 +44,7 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-android-jniLibs name: bindings-android-jniLibs-uniffi-25
path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain/jniLibs path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain/jniLibs
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
@@ -59,17 +59,17 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-ios name: bindings-aarch64-apple-ios-uniffi-25
path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-arm64 path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-arm64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-aarch64-apple-ios-sim name: bindings-aarch64-apple-ios-sim-uniffi-25
path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-simulator-arm64 path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-simulator-arm64
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: bindings-x86_64-apple-ios name: bindings-x86_64-apple-ios-uniffi-25
path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-simulator-x64 path: lib/bindings/langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/lib/ios-simulator-x64
- name: Build Kotlin Multiplatform project - name: Build Kotlin Multiplatform project

1
lib/.gitignore vendored
View File

@@ -5,3 +5,4 @@ target
*.so *.so
*.a *.a
bindings/ffi bindings/ffi
bindings/testnet

196
lib/Cargo.lock generated
View File

@@ -856,7 +856,9 @@ dependencies = [
"thiserror 1.0.63", "thiserror 1.0.63",
"tokio", "tokio",
"uniffi 0.25.3", "uniffi 0.25.3",
"uniffi 0.28.0",
"uniffi_bindgen 0.25.3", "uniffi_bindgen 0.25.3",
"uniffi_bindgen 0.28.0",
"uniffi_bindgen_kotlin_multiplatform", "uniffi_bindgen_kotlin_multiplatform",
] ]
@@ -1869,7 +1871,18 @@ checksum = "0d6b4de4a8eb6c46a8c77e1d3be942cb9a8bf073c22374578e5ba4b08ed0ff68"
dependencies = [ dependencies = [
"log", "log",
"plain", "plain",
"scroll", "scroll 0.11.0",
]
[[package]]
name = "goblin"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47"
dependencies = [
"log",
"plain",
"scroll 0.12.0",
] ]
[[package]] [[package]]
@@ -4130,7 +4143,16 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da"
dependencies = [ dependencies = [
"scroll_derive", "scroll_derive 0.11.1",
]
[[package]]
name = "scroll"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6"
dependencies = [
"scroll_derive 0.12.0",
] ]
[[package]] [[package]]
@@ -4144,6 +4166,17 @@ dependencies = [
"syn 2.0.98", "syn 2.0.98",
] ]
[[package]]
name = "scroll_derive"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]] [[package]]
name = "scrypt" name = "scrypt"
version = "0.11.0" version = "0.11.0"
@@ -4449,6 +4482,12 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smawk"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.7" version = "0.5.7"
@@ -4644,6 +4683,9 @@ name = "textwrap"
version = "0.16.1" version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
dependencies = [
"smawk",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
@@ -5222,6 +5264,21 @@ dependencies = [
"uniffi_macros 0.25.3", "uniffi_macros 0.25.3",
] ]
[[package]]
name = "uniffi"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588"
dependencies = [
"anyhow",
"camino",
"clap 4.5.17",
"uniffi_bindgen 0.28.0",
"uniffi_build 0.28.0",
"uniffi_core 0.28.0",
"uniffi_macros 0.28.0",
]
[[package]] [[package]]
name = "uniffi_bindgen" name = "uniffi_bindgen"
version = "0.23.0" version = "0.23.0"
@@ -5234,7 +5291,7 @@ dependencies = [
"camino", "camino",
"fs-err", "fs-err",
"glob", "glob",
"goblin", "goblin 0.6.1",
"heck 0.4.1", "heck 0.4.1",
"once_cell", "once_cell",
"paste", "paste",
@@ -5243,7 +5300,7 @@ dependencies = [
"toml", "toml",
"uniffi_meta 0.23.0", "uniffi_meta 0.23.0",
"uniffi_testing 0.23.0", "uniffi_testing 0.23.0",
"weedle2", "weedle2 4.0.0",
] ]
[[package]] [[package]]
@@ -5259,7 +5316,7 @@ dependencies = [
"clap 4.5.17", "clap 4.5.17",
"fs-err", "fs-err",
"glob", "glob",
"goblin", "goblin 0.6.1",
"heck 0.4.1", "heck 0.4.1",
"once_cell", "once_cell",
"paste", "paste",
@@ -5267,7 +5324,31 @@ dependencies = [
"toml", "toml",
"uniffi_meta 0.25.3", "uniffi_meta 0.25.3",
"uniffi_testing 0.25.3", "uniffi_testing 0.25.3",
"uniffi_udl", "uniffi_udl 0.25.3",
]
[[package]]
name = "uniffi_bindgen"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96061d7e01b185aa405f7c9b134741ab3e50cc6796a47d6fd8ab9a5364b5feed"
dependencies = [
"anyhow",
"askama 0.12.1",
"camino",
"cargo_metadata",
"fs-err",
"glob",
"goblin 0.8.2",
"heck 0.5.0",
"once_cell",
"paste",
"serde",
"textwrap",
"toml",
"uniffi_meta 0.28.0",
"uniffi_testing 0.28.0",
"uniffi_udl 0.28.0",
] ]
[[package]] [[package]]
@@ -5309,6 +5390,17 @@ dependencies = [
"uniffi_bindgen 0.25.3", "uniffi_bindgen 0.25.3",
] ]
[[package]]
name = "uniffi_build"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6b86f9b221046af0c533eafe09ece04e2f1ded04ccdc9bba0ec09aec1c52bd"
dependencies = [
"anyhow",
"camino",
"uniffi_bindgen 0.28.0",
]
[[package]] [[package]]
name = "uniffi_checksum_derive" name = "uniffi_checksum_derive"
version = "0.23.0" version = "0.23.0"
@@ -5329,6 +5421,16 @@ dependencies = [
"syn 2.0.98", "syn 2.0.98",
] ]
[[package]]
name = "uniffi_checksum_derive"
version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "802d2051a700e3ec894c79f80d2705b69d85844dafbbe5d1a92776f8f48b563a"
dependencies = [
"quote",
"syn 2.0.98",
]
[[package]] [[package]]
name = "uniffi_core" name = "uniffi_core"
version = "0.23.0" version = "0.23.0"
@@ -5361,6 +5463,21 @@ dependencies = [
"static_assertions", "static_assertions",
] ]
[[package]]
name = "uniffi_core"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3210d57d6ab6065ab47a2898dacdb7c606fd6a4156196831fa3bf82e34ac58a6"
dependencies = [
"anyhow",
"bytes",
"camino",
"log",
"once_cell",
"paste",
"static_assertions",
]
[[package]] [[package]]
name = "uniffi_macros" name = "uniffi_macros"
version = "0.23.0" version = "0.23.0"
@@ -5399,6 +5516,24 @@ dependencies = [
"uniffi_meta 0.25.3", "uniffi_meta 0.25.3",
] ]
[[package]]
name = "uniffi_macros"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b58691741080935437dc862122e68d7414432a11824ac1137868de46181a0bd2"
dependencies = [
"bincode",
"camino",
"fs-err",
"once_cell",
"proc-macro2",
"quote",
"serde",
"syn 2.0.98",
"toml",
"uniffi_meta 0.28.0",
]
[[package]] [[package]]
name = "uniffi_meta" name = "uniffi_meta"
version = "0.23.0" version = "0.23.0"
@@ -5422,6 +5557,18 @@ dependencies = [
"uniffi_checksum_derive 0.25.3", "uniffi_checksum_derive 0.25.3",
] ]
[[package]]
name = "uniffi_meta"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7663eacdbd9fbf4a88907ddcfe2e6fa85838eb6dc2418a7d91eebb3786f8e20b"
dependencies = [
"anyhow",
"bytes",
"siphasher",
"uniffi_checksum_derive 0.28.3",
]
[[package]] [[package]]
name = "uniffi_testing" name = "uniffi_testing"
version = "0.23.0" version = "0.23.0"
@@ -5450,6 +5597,19 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "uniffi_testing"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f922465f7566f25f8fe766920205fdfa9a3fcdc209c6bfb7557f0b5bf45b04dd"
dependencies = [
"anyhow",
"camino",
"cargo_metadata",
"fs-err",
"once_cell",
]
[[package]] [[package]]
name = "uniffi_udl" name = "uniffi_udl"
version = "0.25.3" version = "0.25.3"
@@ -5459,7 +5619,20 @@ dependencies = [
"anyhow", "anyhow",
"uniffi_meta 0.25.3", "uniffi_meta 0.25.3",
"uniffi_testing 0.25.3", "uniffi_testing 0.25.3",
"weedle2", "weedle2 4.0.0",
]
[[package]]
name = "uniffi_udl"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cef408229a3a407fafa4c36dc4f6ece78a6fb258ab28d2b64bddd49c8cb680f6"
dependencies = [
"anyhow",
"textwrap",
"uniffi_meta 0.28.0",
"uniffi_testing 0.28.0",
"weedle2 5.0.0",
] ]
[[package]] [[package]]
@@ -5752,6 +5925,15 @@ dependencies = [
"nom", "nom",
] ]
[[package]]
name = "weedle2"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "which" name = "which"
version = "4.4.2" version = "4.4.2"

View File

@@ -40,8 +40,6 @@ serde = { version = "1.0", features = ["derive"] }
sdk-common = { git = "https://github.com/breez/breez-sdk", rev = "0017f7d3f76a1f0094ad9ff25422b72c31acc60e", features = ["liquid"] } sdk-common = { git = "https://github.com/breez/breez-sdk", rev = "0017f7d3f76a1f0094ad9ff25422b72c31acc60e", features = ["liquid"] }
sdk-macros = { git = "https://github.com/breez/breez-sdk", rev = "0017f7d3f76a1f0094ad9ff25422b72c31acc60e" } sdk-macros = { git = "https://github.com/breez/breez-sdk", rev = "0017f7d3f76a1f0094ad9ff25422b72c31acc60e" }
thiserror = "1.0" thiserror = "1.0"
# Version must match that used by uniffi-bindgen-go
uniffi = "0.25.0"
[patch.crates-io] [patch.crates-io]
# https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits and rebased on secp256k1-zkp 0.11.0 # https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits and rebased on secp256k1-zkp 0.11.0

View File

@@ -11,6 +11,11 @@ path = "uniffi-bindgen.rs"
name = "breez_sdk_liquid_bindings" name = "breez_sdk_liquid_bindings"
crate-type = ["staticlib", "cdylib", "lib"] crate-type = ["staticlib", "cdylib", "lib"]
[features]
default = ["uniffi-28"]
uniffi-25 = ["uniffi_25", "uniffi_bindgen_25", "uniffi_bindgen_kotlin_multiplatform"]
uniffi-28 = ["uniffi_28", "uniffi_bindgen_28"]
[lints] [lints]
workspace = true workspace = true
@@ -18,15 +23,17 @@ workspace = true
anyhow = { workspace = true } anyhow = { workspace = true }
breez-sdk-liquid = { path = "../core" } breez-sdk-liquid = { path = "../core" }
log = { workspace = true } log = { workspace = true }
uniffi = { workspace = true, features = [ "bindgen-tests", "cli" ] } uniffi_25 = { package = "uniffi", version = "0.25.2", features = [ "bindgen-tests", "cli" ], optional = true }
# Bindgen used by KMP, version has to match the one supported by KMP uniffi_28 = { package = "uniffi", version = "0.28.0", features = [ "bindgen-tests", "cli" ], optional = true }
uniffi_bindgen = "0.25.2" uniffi_bindgen_25 = { package = "uniffi_bindgen", version = "0.25.2", optional = true }
uniffi_bindgen_kotlin_multiplatform = { git = "https://gitlab.com/trixnity/uniffi-kotlin-multiplatform-bindings", rev = "e8e3a88df5b657787c1198425c16008232b26548" } uniffi_bindgen_28 = { package = "uniffi_bindgen", version = "0.28.0", optional = true }
uniffi_bindgen_kotlin_multiplatform = { git = "https://gitlab.com/trixnity/uniffi-kotlin-multiplatform-bindings", rev = "e8e3a88df5b657787c1198425c16008232b26548", optional = true }
camino = "1.1.1" camino = "1.1.1"
thiserror = { workspace = true } thiserror = { workspace = true }
tokio = { version = "1", features = ["rt"] } tokio = { version = "1", features = ["rt"] }
once_cell = { workspace = true } once_cell = { workspace = true }
[build-dependencies] [build-dependencies]
uniffi = { workspace = true, features = [ "build" ] } uniffi_25 = { package = "uniffi", version = "0.25.2", features = [ "build" ], optional = true }
glob = "0.3.1" uniffi_28 = { package = "uniffi", version = "0.28.0", features = [ "build" ], optional = true }
glob = "0.3.1"

View File

@@ -1,3 +1,8 @@
#[cfg(feature = "uniffi-25")]
extern crate uniffi_25 as uniffi;
#[cfg(feature = "uniffi-28")]
extern crate uniffi_28 as uniffi;
use glob::glob; use glob::glob;
use std::env; use std::env;

View File

@@ -14,7 +14,7 @@ android {
compileSdk = 34 compileSdk = 34
defaultConfig { defaultConfig {
minSdk = 24 minSdk = 33
consumerProguardFiles("consumer-rules.pro") consumerProguardFiles("consumer-rules.pro")
} }

View File

@@ -37,16 +37,27 @@ all: bindings-swift bindings-android python-darwin react-native
## Android ## Android
.PHONY: android .PHONY: android
android: aarch64-linux-android x86_64-linux-android android: aarch64-linux-android x86_64-linux-android
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o ffi/kotlin cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o ffi/kotlin
android-uniffi-25: aarch64-linux-android-uniffi-25 x86_64-linux-android-uniffi-25
cargo run --no-default-features --features=uniffi-25 --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o ffi/kotlin
aarch64-linux-android: $(SOURCES) ndk-home aarch64-linux-android: $(SOURCES) ndk-home
cargo ndk -t aarch64-linux-android -o ffi/kotlin/jniLibs build --release cargo ndk -t aarch64-linux-android -o ffi/kotlin/jniLibs build --release
cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/arm64-v8a/ cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/arm64-v8a/
aarch64-linux-android-uniffi-25: $(SOURCES) ndk-home
cargo ndk -t aarch64-linux-android -o ffi/kotlin/jniLibs build --no-default-features --features=uniffi-25 --release
cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/arm64-v8a/
x86_64-linux-android: $(SOURCES) ndk-home x86_64-linux-android: $(SOURCES) ndk-home
cargo ndk -t x86_64-linux-android -o ffi/kotlin/jniLibs build --release cargo ndk -t x86_64-linux-android -o ffi/kotlin/jniLibs build --release
cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/x86_64/ cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/x86_64/
x86_64-linux-android-uniffi-25: $(SOURCES) ndk-home
cargo ndk -t x86_64-linux-android -o ffi/kotlin/jniLibs build --no-default-features --features=uniffi-25 --release
cp -a $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ffi/kotlin/jniLibs/x86_64/
bindings-android: android bindings-android: android
cp -r ffi/kotlin/jniLibs langs/android/lib/src/main cp -r ffi/kotlin/jniLibs langs/android/lib/src/main
cp -r ffi/kotlin/breez_sdk_liquid langs/android/lib/src/main/kotlin/ cp -r ffi/kotlin/breez_sdk_liquid langs/android/lib/src/main/kotlin/
@@ -58,9 +69,9 @@ bindings-android: android
.PHONY: kotlin .PHONY: kotlin
kotlin: $(SOURCES) kotlin: $(SOURCES)
cargo build --release --target $(TARGET) cargo build --release --target $(TARGET)
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o ffi/kotlin cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o ffi/kotlin
bindings-kotlin-multiplatform: ios-universal android bindings-kotlin-multiplatform: ios-universal-uniffi-25 android-uniffi-25
mkdir -p langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain mkdir -p langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain
cp -r ffi/kotlin/jniLibs/ langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain/jniLibs/ cp -r ffi/kotlin/jniLibs/ langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/androidMain/jniLibs/
cp -r ffi/kmp/* langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/ cp -r ffi/kmp/* langs/kotlin-multiplatform/breez-sdk-liquid-kmp/src/
@@ -88,6 +99,17 @@ ios-universal: $(SOURCES)
# build universal lib for arm sim and x86 sim # build universal lib for arm sim and x86 sim
lipo -create -output ../target/ios-universal-sim/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-ios-sim/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-ios/release/libbreez_sdk_liquid_bindings.a lipo -create -output ../target/ios-universal-sim/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-ios-sim/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-ios/release/libbreez_sdk_liquid_bindings.a
ios-universal-uniffi-25: $(SOURCES)
mkdir -p ../target/ios-universal/release
mkdir -p ../target/ios-universal-sim/release
cargo build --no-default-features --features uniffi-25 --release --target aarch64-apple-ios ;\
cargo build --no-default-features --features uniffi-25 --release --target x86_64-apple-ios ;\
cargo build --no-default-features --features uniffi-25 --release --target aarch64-apple-ios-sim ;\
# build universal lib for arm device and x86 sim
lipo -create -output ../target/ios-universal/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-ios/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-ios/release/libbreez_sdk_liquid_bindings.a
# build universal lib for arm sim and x86 sim
lipo -create -output ../target/ios-universal-sim/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-ios-sim/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-ios/release/libbreez_sdk_liquid_bindings.a
darwin-universal: $(SOURCES) darwin-universal: $(SOURCES)
mkdir -p ../target/darwin-universal/release mkdir -p ../target/darwin-universal/release
cargo lipo --release --targets aarch64-apple-darwin cargo lipo --release --targets aarch64-apple-darwin
@@ -95,14 +117,21 @@ darwin-universal: $(SOURCES)
lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib
lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.a lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.a
darwin-universal-uniffi-25: $(SOURCES)
mkdir -p ../target/darwin-universal/release
cargo lipo --no-default-features --features uniffi-25 --release --targets aarch64-apple-darwin
cargo lipo --no-default-features --features uniffi-25 --release --targets x86_64-apple-darwin
lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.dylib
lipo -create -output ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.a ../target/aarch64-apple-darwin/release/libbreez_sdk_liquid_bindings.a ../target/x86_64-apple-darwin/release/libbreez_sdk_liquid_bindings.a
## Swift ## Swift
swift-ios: ios-universal swift-ios: ios-universal
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl -l swift -o ffi/swift-ios cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl -l swift -o ffi/swift-ios
cp ../target/ios-universal/release/libbreez_sdk_liquid_bindings.a ffi/swift-ios cp ../target/ios-universal/release/libbreez_sdk_liquid_bindings.a ffi/swift-ios
cd ffi/swift-ios && "swiftc" "-emit-module" "-module-name" "breez_sdk_liquid_bindings" "-Xcc" "-fmodule-map-file=$(CURRENT_DIR)/ffi/swift-ios/breez_sdk_liquidFFI.modulemap" "-I" "." "-L" "." "-lbreez_sdk_liquid_bindings" breez_sdk_liquid.swift cd ffi/swift-ios && "swiftc" "-emit-module" "-module-name" "breez_sdk_liquid_bindings" "-Xcc" "-fmodule-map-file=$(CURRENT_DIR)/ffi/swift-ios/breez_sdk_liquidFFI.modulemap" "-I" "." "-L" "." "-lbreez_sdk_liquid_bindings" breez_sdk_liquid.swift
swift-darwin: darwin-universal swift-darwin: darwin-universal
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl -l swift -o ffi/swift-darwin cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl -l swift -o ffi/swift-darwin
cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/swift-darwin cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/swift-darwin
cd ffi/swift-darwin && "swiftc" "-emit-module" "-module-name" "breez_sdk_liquid_bindings" "-Xcc" "-fmodule-map-file=$(CURRENT_DIR)/ffi/swift-darwin/breez_sdk_liquidFFI.modulemap" "-I" "." "-L" "." "-lbreez_sdk_liquid_bindings" breez_sdk_liquid.swift cd ffi/swift-darwin && "swiftc" "-emit-module" "-module-name" "breez_sdk_liquid_bindings" "-Xcc" "-fmodule-map-file=$(CURRENT_DIR)/ffi/swift-darwin/breez_sdk_liquidFFI.modulemap" "-I" "." "-L" "." "-lbreez_sdk_liquid_bindings" breez_sdk_liquid.swift
@@ -110,7 +139,7 @@ bindings-swift: ios-universal darwin-universal build-ios-framework
build-ios-framework: build-ios-framework:
mkdir -p langs/swift/Sources/BreezSDKLiquid mkdir -p langs/swift/Sources/BreezSDKLiquid
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid
mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers
@@ -122,19 +151,19 @@ build-ios-framework:
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap
csharp-darwin: darwin-universal csharp-darwin: darwin-universal-uniffi-25
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml
cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/csharp cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/csharp
csharp-linux: $(SOURCES) csharp-linux: $(SOURCES)
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
cargo build --release --target $(TARGET) cargo build --no-default-features --features uniffi-25 --release --target $(TARGET)
uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml
cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/csharp cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/csharp
## Go ## Go
golang-darwin: darwin-universal golang-darwin: darwin-universal-uniffi-25
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml
cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/golang cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/golang
@@ -142,7 +171,7 @@ golang-darwin: darwin-universal
golang-linux: $(SOURCES) golang-linux: $(SOURCES)
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
cargo build --release --target $(TARGET) cargo build --no-default-features --features uniffi-25 --release --target $(TARGET)
uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml
cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/golang cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/golang
cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/ cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/
@@ -150,11 +179,11 @@ golang-linux: $(SOURCES)
## Python ## Python
python-linux: $(SOURCES) python-linux: $(SOURCES)
cargo build --release --target $(TARGET) cargo build --release --target $(TARGET)
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language python -o ffi/python cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language python -o ffi/python
cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/python cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/python
python-darwin: darwin-universal python-darwin: darwin-universal
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language python -o ffi/python cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language python -o ffi/python
cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/python cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/python
## React Native ## React Native

View File

@@ -1,4 +1,8 @@
//! Uniffi bindings //! Uniffi bindings
#[cfg(feature = "uniffi-25")]
extern crate uniffi_25 as uniffi;
#[cfg(feature = "uniffi-28")]
extern crate uniffi_28 as uniffi;
use std::sync::Arc; use std::sync::Arc;

View File

@@ -1,5 +1,10 @@
#[cfg(feature = "uniffi-28")]
extern crate uniffi_28 as uniffi;
#[cfg(feature = "uniffi-25")]
use std::process::Command; use std::process::Command;
#[cfg(feature = "uniffi-28")]
uniffi::build_foreign_language_testcases!( uniffi::build_foreign_language_testcases!(
"tests/bindings/test_breez_sdk_liquid.swift", "tests/bindings/test_breez_sdk_liquid.swift",
"tests/bindings/test_breez_sdk_liquid.kts", "tests/bindings/test_breez_sdk_liquid.kts",
@@ -7,6 +12,7 @@ uniffi::build_foreign_language_testcases!(
); );
#[test] #[test]
#[cfg(feature = "uniffi-25")]
fn test_csharp() { fn test_csharp() {
let output = Command::new("dotnet") let output = Command::new("dotnet")
.arg("run") .arg("run")
@@ -21,6 +27,7 @@ fn test_csharp() {
} }
#[test] #[test]
#[cfg(feature = "uniffi-25")]
fn test_golang() { fn test_golang() {
let output = Command::new("go") let output = Command::new("go")
.env( .env(

View File

@@ -1,14 +1,26 @@
#[cfg(feature = "uniffi-25")]
extern crate uniffi_25 as uniffi;
#[cfg(feature = "uniffi-28")]
extern crate uniffi_28 as uniffi;
#[cfg(feature = "uniffi-25")]
extern crate uniffi_bindgen_25 as uniffi_bindgen;
#[cfg(feature = "uniffi-25")]
use camino::Utf8Path; use camino::Utf8Path;
use uniffi_bindgen_kotlin_multiplatform::KotlinBindingGenerator;
fn main() { fn main() {
uniffi::uniffi_bindgen_main(); uniffi::uniffi_bindgen_main();
#[cfg(feature = "uniffi-25")]
build_kmp()
}
#[cfg(feature = "uniffi-25")]
fn build_kmp() {
let udl_file = "./src/breez_sdk_liquid.udl"; let udl_file = "./src/breez_sdk_liquid.udl";
let out_dir = Utf8Path::new("ffi/kmp"); let out_dir = Utf8Path::new("ffi/kmp");
let config = Utf8Path::new("uniffi.toml"); let config = Utf8Path::new("uniffi.toml");
uniffi_bindgen::generate_external_bindings( uniffi_bindgen::generate_external_bindings(
KotlinBindingGenerator {}, uniffi_bindgen_kotlin_multiplatform::KotlinBindingGenerator {},
udl_file, udl_file,
Some(config), Some(config),
Some(out_dir), Some(out_dir),

View File

@@ -10,6 +10,9 @@ crate-type = ["lib", "cdylib", "staticlib"]
[features] [features]
default = ["frb"] default = ["frb"]
frb = ["dep:flutter_rust_bridge"] frb = ["dep:flutter_rust_bridge"]
# Uniffi features required to build using cargo-lipo
uniffi-25 = []
uniffi-28 = []
[lints] [lints]
workspace = true workspace = true

View File

@@ -577,8 +577,6 @@ pub mod duplicates {
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use thiserror::Error; use thiserror::Error;
use crate::error::PaymentError;
#[derive(Clone, Debug, Error)] #[derive(Clone, Debug, Error)]
pub enum LnUrlPayError { pub enum LnUrlPayError {
/// This error is raised when attempting to pay an invoice that has already being paid. /// This error is raised when attempting to pay an invoice that has already being paid.
@@ -669,14 +667,6 @@ pub mod duplicates {
} }
} }
impl From<PaymentError> for sdk_common::prelude::LnUrlPayError {
fn from(value: PaymentError) -> Self {
Self::Generic {
err: format!("{value}"),
}
}
}
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum LnUrlWithdrawError { pub enum LnUrlWithdrawError {
/// This error is raised when a general error occurs not specific to other error variants /// This error is raised when a general error occurs not specific to other error variants
@@ -730,14 +720,6 @@ pub mod duplicates {
} }
} }
impl From<PaymentError> for sdk_common::prelude::LnUrlWithdrawError {
fn from(value: PaymentError) -> Self {
Self::Generic {
err: format!("{value}"),
}
}
}
#[derive(Clone, Serialize)] #[derive(Clone, Serialize)]
pub enum LnUrlWithdrawResult { pub enum LnUrlWithdrawResult {
Ok { data: LnUrlWithdrawSuccessData }, Ok { data: LnUrlWithdrawSuccessData },

View File

@@ -1,6 +1,6 @@
use anyhow::Error; use anyhow::Error;
use lwk_wollet::secp256k1; use lwk_wollet::secp256k1;
use sdk_common::prelude::LnUrlAuthError; use sdk_common::prelude::{LnUrlAuthError, LnUrlPayError, LnUrlWithdrawError};
pub type SdkResult<T, E = SdkError> = Result<T, E>; pub type SdkResult<T, E = SdkError> = Result<T, E>;
@@ -249,9 +249,25 @@ impl From<secp256k1::Error> for PaymentError {
} }
impl From<PaymentError> for LnUrlAuthError { impl From<PaymentError> for LnUrlAuthError {
fn from(value: PaymentError) -> Self { fn from(err: PaymentError) -> Self {
Self::Generic { Self::Generic {
err: format!("Failed to perform LNURL-auth: {value:?}"), err: err.to_string(),
}
}
}
impl From<PaymentError> for LnUrlPayError {
fn from(err: PaymentError) -> Self {
Self::Generic {
err: err.to_string(),
}
}
}
impl From<PaymentError> for LnUrlWithdrawError {
fn from(err: PaymentError) -> Self {
Self::Generic {
err: err.to_string(),
} }
} }
} }

View File

@@ -9,7 +9,7 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'package:freezed_annotation/freezed_annotation.dart' hide protected; import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
part 'duplicates.freezed.dart'; part 'duplicates.freezed.dart';
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from` // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`
@freezed @freezed
sealed class LnUrlAuthError with _$LnUrlAuthError implements FrbException { sealed class LnUrlAuthError with _$LnUrlAuthError implements FrbException {

View File

@@ -51,7 +51,7 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion 24 minSdkVersion 33
} }
} }

View File

@@ -51,7 +51,7 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion 24 minSdkVersion 33
} }
} }

View File

@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
android { android {
compileSdkVersion 34 compileSdkVersion 34
defaultConfig { defaultConfig {
minSdkVersion 24 minSdkVersion 33
targetSdkVersion 34 targetSdkVersion 34
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"

View File

@@ -3,7 +3,7 @@
buildscript { buildscript {
ext { ext {
buildToolsVersion = "33.0.0" buildToolsVersion = "33.0.0"
minSdkVersion = 24 minSdkVersion = 33
compileSdkVersion = 34 compileSdkVersion = 34
targetSdkVersion = 34 targetSdkVersion = 34
kotlin_version = "1.8.0" kotlin_version = "1.8.0"