Skip to content

Commit

Permalink
chore: use build-local-swift.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Jun 12, 2024
1 parent 3a2f07e commit 2d74ae1
Showing 1 changed file with 2 additions and 56 deletions.
58 changes: 2 additions & 56 deletions .github/workflows/publish-spm.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
name: Build, Tag and Create Release
env:
HEADERPATH: Sources/BitcoinDevKit/BitcoinDevKitFFI.h
MODMAPPATH: Sources/BitcoinDevKit/BitcoinDevKitFFI.modulemap
TARGETDIR: ../bdk-ffi/target
OUTDIR: .
RELDIR: release-smaller
STATIC_LIB_NAME: libbdkffi.a
NEW_HEADER_DIR: ../bdk-ffi/target/include
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -36,57 +28,11 @@ jobs:
with:
path: dist

- name: "Install Rust targets"
working-directory: build/bdk-ffi
run: |
rustup default 1.77.1
rustup component add rust-src
rustup target add aarch64-apple-ios # iOS ARM64
rustup target add x86_64-apple-ios # iOS x86_64
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
- name: "Run bdk-ffi-bindgen"
working-directory: build/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 all targets"
working-directory: build/bdk-ffi
run: |
cargo build --profile release-smaller --target x86_64-apple-darwin
cargo build --profile release-smaller --target aarch64-apple-darwin
cargo build --profile release-smaller --target x86_64-apple-ios
cargo build --profile release-smaller --target aarch64-apple-ios
cargo build --profile release-smaller --target aarch64-apple-ios-sim
- name: "Create lipo-ios-sim and lipo-macos"
working-directory: build/bdk-ffi
run: |
mkdir -p target/lipo-ios-sim/release-smaller
lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a
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"
working-directory: build/bdk-swift
run: |
# move bdk-ffi static lib header files to temporary directory
mkdir -p "${NEW_HEADER_DIR}"
mv "${HEADERPATH}" "${NEW_HEADER_DIR}"
mv "${MODMAPPATH}" "${NEW_HEADER_DIR}/module.modulemap"
# remove old xcframework directory
rm -rf "${OUTDIR}/bdkFFI.xcframework"
# create new xcframework directory from bdk-ffi static libs and headers
xcodebuild -create-xcframework \
-library "${TARGETDIR}/lipo-macos/${RELDIR}/${STATIC_LIB_NAME}" \
-headers "${NEW_HEADER_DIR}" \
-library "${TARGETDIR}/aarch64-apple-ios/${RELDIR}/${STATIC_LIB_NAME}" \
-headers "${NEW_HEADER_DIR}" \
-library "${TARGETDIR}/lipo-ios-sim/${RELDIR}/${STATIC_LIB_NAME}" \
-headers "${NEW_HEADER_DIR}" \
-output "${OUTDIR}/bdkFFI.xcframework"
# run the local script
./build-local-swift.sh
# remove old xcframework zip
rm bdkFFI.xcframework.zip || true
zip -9 -r bdkFFI.xcframework.zip bdkFFI.xcframework
Expand Down

0 comments on commit 2d74ae1

Please sign in to comment.