Skip to content

Commit e42407f

Browse files
committed
chore: release v0.16.2-alpha.0
1 parent 19bc9bb commit e42407f

File tree

2 files changed

+30
-70
lines changed

2 files changed

+30
-70
lines changed

Package.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
// swift-tools-version: 5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

4+
import Foundation
45
import PackageDescription
56

7+
let FFIbinaryTarget: PackageDescription.Target
8+
9+
if ProcessInfo.processInfo.environment["LOCAL_BUILD"] != nil {
10+
FFIbinaryTarget = .binaryTarget(name: "LoroFFI", path: "./loroFFI.xcframework.zip")
11+
}else {
12+
FFIbinaryTarget = .binaryTarget(
13+
name: "LoroFFI",
14+
url: "https://github.com/loro/loro-swift/releases/download/0.16.2-alpha.0/loroFFI.xcframework.zip",
15+
checksum: "a98119540ba962f1896243b27cc1e9f94629db831c9477a7fec388359d438c0c"
16+
)
17+
}
18+
619
let package = Package(
720
name: "Loro",
821
platforms: [
@@ -18,7 +31,7 @@ let package = Package(
1831
targets: [
1932
// Targets are the basic building blocks of a package, defining a module or a test suite.
2033
// Targets can depend on other targets in this package and products from dependencies.
21-
.binaryTarget(name: "LoroFFI", path: "./loroFFI.xcframework.zip"),
34+
FFIbinaryTarget,
2235
.target(
2336
name: "Loro",
2437
dependencies: ["LoroFFI"]),

scripts/build_swift_ffi.sh

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ echo "▸ Building for aarch64-apple-ios"
6666
CFLAGS_aarch64_apple_ios="-target aarch64-apple-ios" \
6767
$cargo_build --target aarch64-apple-ios --locked --release
6868

69-
# echo "▸ Building for aarch64-apple-visionos-sim"
70-
# CFLAGS_aarch64_apple_visionos="-target aarch64-apple-visionos-sim" \
71-
# $cargo_build_nightly_with_std --target aarch64-apple-visionos-sim --locked --release
69+
echo "▸ Building for aarch64-apple-visionos-sim"
70+
CFLAGS_aarch64_apple_visionos="-target aarch64-apple-visionos-sim" \
71+
$cargo_build_nightly_with_std --target aarch64-apple-visionos-sim --locked --release
7272

73-
# echo "▸ Building for aarch64-apple-visionos"
74-
# CFLAGS_aarch64_apple_visionos="-target aarch64-apple-visionos" \
75-
# $cargo_build_nightly_with_std --target aarch64-apple-visionos --locked --release
73+
echo "▸ Building for aarch64-apple-visionos"
74+
CFLAGS_aarch64_apple_visionos="-target aarch64-apple-visionos" \
75+
$cargo_build_nightly_with_std --target aarch64-apple-visionos --locked --release
7676

7777
echo "▸ Building for aarch64-apple-darwin"
7878
CFLAGS_aarch64_apple_darwin="-target aarch64-apple-darwin" \
@@ -110,11 +110,11 @@ lipo -create \
110110
"${BUILD_FOLDER}/aarch64-apple-ios-sim/release/${LIB_NAME}" \
111111
-output "${BUILD_FOLDER}/ios-simulator/release/${LIB_NAME}"
112112

113-
# echo "▸ arm simulator static libraries into a static binary"
114-
# mkdir -p "${BUILD_FOLDER}/visionos-simulator/release"
115-
# lipo -create \
116-
# "${BUILD_FOLDER}/aarch64-apple-visionos-sim/release/${LIB_NAME}" \
117-
# -output "${BUILD_FOLDER}/visionos-simulator/release/${LIB_NAME}"
113+
echo "▸ arm simulator static libraries into a static binary"
114+
mkdir -p "${BUILD_FOLDER}/visionos-simulator/release"
115+
lipo -create \
116+
"${BUILD_FOLDER}/aarch64-apple-visionos-sim/release/${LIB_NAME}" \
117+
-output "${BUILD_FOLDER}/visionos-simulator/release/${LIB_NAME}"
118118

119119
echo "▸ Lipo (merge) x86 and arm macOS static libraries into a fat static binary"
120120
mkdir -p "${BUILD_FOLDER}/apple-darwin/release"
@@ -131,11 +131,12 @@ lipo -create \
131131
-output "${BUILD_FOLDER}/apple-macabi/release/${LIB_NAME}"
132132

133133

134-
# -library "$BUILD_FOLDER/aarch64-apple-visionos/release/$LIB_NAME" \
135-
# -headers "${BUILD_FOLDER}/includes" \
136-
# -library "${BUILD_FOLDER}/visionos-simulator/release/${LIB_NAME}" \
137-
# -headers "${BUILD_FOLDER}/includes" \
134+
138135
xcodebuild -create-xcframework \
136+
-library "$BUILD_FOLDER/aarch64-apple-visionos/release/$LIB_NAME" \
137+
-headers "${BUILD_FOLDER}/includes" \
138+
-library "${BUILD_FOLDER}/visionos-simulator/release/${LIB_NAME}" \
139+
-headers "${BUILD_FOLDER}/includes" \
139140
-library "$BUILD_FOLDER/aarch64-apple-ios/release/$LIB_NAME" \
140141
-headers "${BUILD_FOLDER}/includes" \
141142
-library "${BUILD_FOLDER}/ios-simulator/release/${LIB_NAME}" \
@@ -151,57 +152,3 @@ ditto -c -k --sequesterRsrc --keepParent "$XCFRAMEWORK_FOLDER" "$XCFRAMEWORK_FOL
151152

152153
echo "▸ Compute checksum"
153154
openssl dgst -sha256 "$XCFRAMEWORK_FOLDER.zip"
154-
155-
156-
#############
157-
# rm -rf gen-swift
158-
# mkdir -p gen-swift/includes
159-
# cd loro-rs
160-
# cargo run --features=cli --bin uniffi-bindgen generate src/loro.udl --language swift --out-dir ../gen-swift
161-
162-
# echo "Building x86_64-apple-ios"
163-
# CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios" \
164-
# cargo build --target x86_64-apple-ios --locked --release
165-
166-
# echo "Building aarch64-apple-ios-sim"
167-
# CFLAGS_x86_64_apple_ios="-aarch64-apple-ios-sim" \
168-
# cargo build --target aarch64-apple-ios-sim --locked --release
169-
170-
# echo "Building aarch64-apple-ios"
171-
# CFLAGS_x86_64_apple_ios="-target aarch64-apple-ios" \
172-
# cargo build --target aarch64-apple-ios --locked --release
173-
174-
# echo "Building aarch64-apple-visionos-sim"
175-
# CFLAGS_x86_64_apple_ios="-target aarch64-apple-visionos-sim" \
176-
# cargo build --target aarch64-apple-visionos-sim --locked --release
177-
178-
# echo "Building aarch64-apple-visionos"
179-
# CFLAGS_x86_64_apple_ios="-target aarch64-apple-visionos" \
180-
# cargo build --target aarch64-apple-visionos --locked --release
181-
182-
# echo "Building aarch64-apple-darwin"
183-
# CFLAGS_x86_64_apple_ios="-target aarch64-apple-darwin" \
184-
# cargo build --target aarch64-apple-darwin --locked --release
185-
186-
# echo "Building x86_64-apple-darwin"
187-
# CFLAGS_x86_64_apple_ios="-target x86_64-apple-darwin" \
188-
# cargo build --target x86_64-apple-darwin --locked --release
189-
190-
# echo "Building aarch64-apple-ios-macabi"
191-
# CFLAGS_x86_64_apple_ios="-target aarch64-apple-ios-macabi" \
192-
# cargo build --target aarch64-apple-ios-macabi --locked --release
193-
194-
# echo "Building x86_64-apple-ios-macabi"
195-
# CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios-macabi" \
196-
# cargo build --target x86_64-apple-ios-macabi --locked --release
197-
198-
199-
200-
# cd ..
201-
# mv gen-swift/loroFFI.h gen-swift/includes/loroFFI.h
202-
# mv gen-swift/loroFFI.modulemap gen-swift/includes/module.modulemap
203-
# xcodebuild -create-xcframework -library loro-rs/target/release/libloro.a -headers gen-swift/includes -output loroFFI.xcframework
204-
# zip -r loroFFI.xcframework.zip loroFFI.xcframework
205-
# mv gen-swift/loro.swift Sources/Loro/LoroFFI.swift
206-
# sh scripts/refine_trait.sh
207-
# rm -rf gen-swift loroFFI.xcframework

0 commit comments

Comments
 (0)