Skip to content

Commit

Permalink
Temp 16: Revert back to uniffi 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Oct 5, 2023
1 parent 413ec98 commit 8d6e0e4
Show file tree
Hide file tree
Showing 20 changed files with 322 additions and 313 deletions.
48 changes: 27 additions & 21 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ on:

jobs:
build-test:
name: Build and test
name: "Build and test"
runs-on: ubuntu-20.04
defaults:
run:
working-directory: bdk-ffi
strategy:
matrix:
rust:
- version: 1.72.1 # STABLE
- version: 1.67.0
clippy: true
# TODO: Should we keep this? We'll need to pin dependencies
# - version: 1.61.0 # MSRV
steps:
- name: Checkout
- name: "Checkout"
uses: actions/checkout@v3

- name: Generate cache key
- name: "Generate cache key"
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key

- name: Cache
- name: "Cache"
uses: actions/cache@v3
with:
path: |
Expand All @@ -34,53 +37,56 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}

- name: Set default toolchain
- name: "Set default toolchain"
run: rustup default ${{ matrix.rust.version }}

- name: Set profile
- name: "Set profile"
run: rustup set profile minimal

- name: Add clippy
- name: "Add clippy"
if: ${{ matrix.rust.clippy }}
run: rustup component add clippy

- name: Update toolchain
- name: "Update toolchain"
run: rustup update

- name: Pin dependencies for MSRV
- name: "Pin dependencies for MSRV"
if: matrix.rust.version == '1.61.0'
run: |
cargo update -p hashlink --precise "0.8.1"
cargo update -p tokio --precise "1.29.1"
cargo update -p flate2 --precise "1.0.26"
- name: Build
- name: "Build"
run: cargo build

- name: Clippy
- name: "Clippy"
if: ${{ matrix.rust.clippy }}
run: cargo clippy --all-targets --features "uniffi/bindgen-tests" -- -D warnings

- name: Test
- name: "Test"
run: CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test --features uniffi/bindgen-tests

fmt:
name: Rust fmt
runs-on: ubuntu-latest
name: "Rust fmt"
runs-on: ubuntu-20.04
defaults:
run:
working-directory: bdk-ffi
steps:
- name: Checkout
- name: "Checkout"
uses: actions/checkout@v3

- name: Set default toolchain
- name: "Set default toolchain"
run: rustup default nightly

- name: Set profile
- name: "Set profile"
run: rustup set profile minimal

- name: Add rustfmt
- name: "Add rustfmt"
run: rustup component add rustfmt

- name: Update toolchain
- name: "Update toolchain"
run: rustup update

- name: Check fmt
- name: "Check fmt"
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
4 changes: 2 additions & 2 deletions .github/workflows/publish-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Install Rust Android targets"
run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish-jvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Install aarch64 Rust target"
run: rustup target add aarch64-apple-darwin
Expand Down Expand Up @@ -54,8 +54,8 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Install x86_64-pc-windows-msvc Rust target"
run: rustup target add x86_64-pc-windows-msvc
Expand Down Expand Up @@ -94,8 +94,8 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Build bdk-jvm library"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Install Rust Android targets"
run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/test-jvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,10 @@ jobs:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Run JVM tests"
run: |
cd bdk-jvm
./gradlew buildJvmLib
./gradlew test
- name: "Print directory structure"
run: |
pwd
ls -R
20 changes: 10 additions & 10 deletions .github/workflows/test-swift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ jobs:
build:
runs-on: macos-12
steps:
- name: Checkout
- name: "Checkout"
uses: actions/checkout@v3

- name: "Set default Rust version to 1.72.1"
run: rustup default 1.72.1
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: Install Rust targets
- name: "Install Rust targets"
run: |
rustup install nightly-x86_64-apple-darwin
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Run bdk-ffi-bindgen
- name: "Run bdk-ffi-bindgen"
working-directory: bdk-ffi
run: cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format

- name: Build bdk-ffi for x86_64-apple-darwin
- name: "Build bdk-ffi for x86_64-apple-darwin"
run: cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin

- name: Build bdk-ffi for aarch64-apple-darwin
- name: "Build bdk-ffi for aarch64-apple-darwin"
run: cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin

- name: Create lipo-macos
- name: "Create lipo-macos"
run: |
mkdir -p target/lipo-macos/release-smaller
lipo target/aarch64-apple-darwin/release-smaller/libbdkffi.a target/x86_64-apple-darwin/release-smaller/libbdkffi.a -create -output target/lipo-macos/release-smaller/libbdkffi.a
- name: Create bdkFFI.xcframework
- name: "Create bdkFFI.xcframework"
working-directory: bdk-swift
run: |
mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift
Expand All @@ -50,6 +50,6 @@ jobs:
rm Sources/BitcoinDevKit/bdkFFI.h
rm Sources/BitcoinDevkit/bdkFFI.modulemap
- name: Run Swift tests
- name: "Run Swift tests"
working-directory: bdk-swift
run: swift test
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@ internal class UniFfiAndroidPlugin : Plugin<Project> {
val generateAndroidBindings by tasks.register<Exec>("generateAndroidBindings") {
dependsOn(moveNativeAndroidLibs)

val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so"
workingDir("${project.projectDir}/../../bdk-ffi")
// val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so"
// workingDir("${project.projectDir}/../../bdk-ffi")
// val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")

val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")
// The code above worked for uniffi 0.24.3 using the --library flag
// The code below works for uniffi 0.23.0
workingDir("${project.projectDir}/../../bdk-ffi")
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")

executable("cargo")
args(cargoArgs)
Expand Down
Loading

0 comments on commit 8d6e0e4

Please sign in to comment.