Skip to content

Commit

Permalink
build: use swift local build script from bdk-swift directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Mar 26, 2024
1 parent 61e5824 commit 10241e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-swift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
uses: actions/checkout@v3

- name: "Build Swift package"
run: bash ./bdk-swift/build-local-swift.sh
working-directory: bdk-swift
run: bash ./build-local-swift.sh

- name: "Run Swift tests"
working-directory: bdk-swift
Expand Down
11 changes: 4 additions & 7 deletions bdk-swift/build-local-swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# The results of this script can be used for locally testing your SPM package adding a local package
# to your application pointing at the bdk-swift directory.

# Run the script from the repo root directory, ie: ./bdk-swift/build-local-swift.sh

rustup install 1.73.0
rustup component add rust-src
rustup target add aarch64-apple-ios # iOS ARM64
Expand All @@ -13,8 +11,8 @@ rustup target add aarch64-apple-ios-sim # simulator mac M1
rustup target add aarch64-apple-darwin # mac M1
rustup target add x86_64-apple-darwin # mac x86_64

pushd bdk-ffi
mkdir -p Sources/BitcoinDevKit
cd ../bdk-ffi/
# mkdir -p temp/Sources/BitcoinDevKit
cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format

cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin
Expand All @@ -28,8 +26,7 @@ lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-appl
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

popd
pushd bdk-swift
cd ../bdk-swift/
mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift
cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64/bdkFFI.framework/Headers
cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/Headers
Expand All @@ -40,4 +37,4 @@ cp ../bdk-ffi/target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/m
rm Sources/BitcoinDevKit/bdkFFI.h
rm Sources/BitcoinDevKit/bdkFFI.modulemap
#rm bdkFFI.xcframework.zip || true
#zip -9 -r bdkFFI.xcframework.zip bdkFFI.xcframework
#zip -9 -r bdkFFI.xcframework.zip bdkFFI.xcframework

0 comments on commit 10241e6

Please sign in to comment.