Skip to content

Commit 84adffa

Browse files
Merge pull request #16 from Jasonvdb/spm
feat: swift package manager support
2 parents 7c5b7ea + dbc3586 commit 84adffa

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

Package.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// swift-tools-version:5.5
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let tag = "v0.1.0"
7+
let checksum = "fd9eb84a478402af8f790519a463b6e1bf6ab3987f5951cd8375afb9d39e7a4b"
8+
let url = "https://github.com/synonymdev/bitkit-core/releases/download/\(tag)/BitkitCore.xcframework.zip"
9+
10+
let package = Package(
11+
name: "bitkitcore",
12+
platforms: [
13+
.iOS(.v15),
14+
.macOS(.v12),
15+
],
16+
products: [
17+
// Products define the executables and libraries a package produces, and make them visible to other packages.
18+
.library(
19+
name: "BitkitCore",
20+
targets: ["BitkitCoreFFI", "BitkitCore"]),
21+
],
22+
targets: [
23+
.target(
24+
name: "BitkitCore",
25+
dependencies: ["BitkitCoreFFI"],
26+
path: "./bindings/ios",
27+
sources: ["bitkitcore.swift"]
28+
),
29+
.binaryTarget(
30+
name: "BitkitCoreFFI",
31+
url: url,
32+
checksum: checksum
33+
)
34+
]
35+
)

build_ios.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,15 @@ echo "Cleaning up temporary directories..."
8989
rm -rf "bindings/ios/ios-arm64"
9090
rm -rf "bindings/ios/ios-arm64-sim"
9191

92-
echo "iOS build process completed successfully!"
92+
# Create zip file for distribution and checksum calculation
93+
echo "Creating XCFramework zip file..."
94+
rm -f ./bindings/ios/BitkitCore.xcframework.zip
95+
ditto -c -k --sequesterRsrc --keepParent ./bindings/ios/BitkitCore.xcframework ./bindings/ios/BitkitCore.xcframework.zip || { echo "Failed to create zip file"; exit 1; }
96+
97+
# Compute checksum
98+
echo "Computing checksum..."
99+
CHECKSUM=`swift package compute-checksum ./bindings/ios/BitkitCore.xcframework.zip` || { echo "Failed to compute checksum"; exit 1; }
100+
echo "New checksum: $CHECKSUM"
101+
102+
echo "iOS build process completed successfully!"
103+
echo "Update Package.swift with the new checksum: $CHECKSUM"

0 commit comments

Comments
 (0)