Skip to content

Commit 1a5c4cb

Browse files
committed
fix(swift): use binary target and versioned macOS framework for Xcode 26 compatibility
1 parent 44c2329 commit 1a5c4cb

File tree

7 files changed

+62
-97
lines changed

7 files changed

+62
-97
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
codesign --sign "${{ secrets.APPLE_TEAM_ID }}" --timestamp --options runtime dist/vector.xcframework # Then sign the xcframework wrapper
140140
ditto -c -k --keepParent dist/vector.xcframework dist/vector.xcframework.zip
141141
xcrun notarytool submit dist/vector.xcframework.zip --apple-id "${{ secrets.APPLE_ID }}" --password "${{ secrets.APPLE_PASSWORD }}" --team-id "${{ secrets.APPLE_TEAM_ID }}" --wait
142-
rm dist/vector.xcframework.zip
142+
rm -rf dist/vector.xcframework
143143
144144
- name: cleanup keychain for codesign
145145
if: matrix.os == 'macos-15'
@@ -224,7 +224,11 @@ jobs:
224224
if [[ "$name" != "vector-apple-xcframework" && "$name" != "vector-android-aar" ]]; then
225225
tar -czf "${name}-${VERSION}.tar.gz" -C "$folder" .
226226
fi
227-
if [[ "$name" != "vector-android-aar" ]]; then
227+
if [[ "$name" == "vector-apple-xcframework" ]]; then
228+
# Use the ditto-created zip that preserves macOS symlinks and extract for other steps
229+
cp "$folder/vector.xcframework.zip" "${name}-${VERSION}.zip"
230+
unzip -q "$folder/vector.xcframework.zip" -d "$folder/"
231+
elif [[ "$name" != "vector-android-aar" ]]; then
228232
(cd "$folder" && zip -rq "../../${name}-${VERSION}.zip" .)
229233
else
230234
cp "$folder"/*.aar "${name}-${VERSION}.aar"
@@ -344,6 +348,23 @@ jobs:
344348
echo " Platform packages: 7"
345349
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
346350
351+
- name: update Package.swift checksum and version
352+
if: steps.tag.outputs.version != ''
353+
run: |
354+
VERSION=${{ steps.tag.outputs.version }}
355+
ZIP="vector-apple-xcframework-${VERSION}.zip"
356+
if [ -f "$ZIP" ]; then
357+
CHECKSUM=$(swift package compute-checksum "$ZIP")
358+
URL="https://github.com/sqliteai/sqlite-vector/releases/download/${VERSION}/${ZIP}"
359+
sed -i "s|url: \".*apple-xcframework.*\"|url: \"${URL}\"|" Package.swift
360+
sed -i "s|checksum: \".*\"|checksum: \"${CHECKSUM}\"|" Package.swift
361+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
362+
git config --global user.name "$GITHUB_ACTOR"
363+
git add Package.swift
364+
git commit -m "Update Package.swift checksum for ${VERSION} [skip ci]" || true
365+
git push origin main || true
366+
fi
367+
347368
- uses: softprops/action-gh-release@v2.2.1
348369
if: steps.tag.outputs.version != ''
349370
with:

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ endef
185185
LIB_NAMES = ios.dylib ios-sim.dylib macos.dylib
186186
FMWK_NAMES = ios-arm64 ios-arm64_x86_64-simulator macos-arm64_x86_64
187187
$(DIST_DIR)/%.xcframework: $(LIB_NAMES)
188-
@$(foreach i,1 2 3,\
188+
@$(foreach i,1 2,\
189189
lib=$(word $(i),$(LIB_NAMES)); \
190190
fmwk=$(word $(i),$(FMWK_NAMES)); \
191191
mkdir -p $(DIST_DIR)/$$fmwk/vector.framework/Headers; \
@@ -196,6 +196,21 @@ $(DIST_DIR)/%.xcframework: $(LIB_NAMES)
196196
mv $(DIST_DIR)/$$lib $(DIST_DIR)/$$fmwk/vector.framework/vector; \
197197
install_name_tool -id "@rpath/vector.framework/vector" $(DIST_DIR)/$$fmwk/vector.framework/vector; \
198198
)
199+
@lib=$(word 3,$(LIB_NAMES)); \
200+
fmwk=$(word 3,$(FMWK_NAMES)); \
201+
mkdir -p $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Headers; \
202+
mkdir -p $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Modules; \
203+
mkdir -p $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Resources; \
204+
cp src/sqlite-vector.h $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Headers; \
205+
printf "$(PLIST)" > $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Resources/Info.plist; \
206+
printf "$(MODULEMAP)" > $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/Modules/module.modulemap; \
207+
mv $(DIST_DIR)/$$lib $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/vector; \
208+
install_name_tool -id "@rpath/vector.framework/vector" $(DIST_DIR)/$$fmwk/vector.framework/Versions/A/vector; \
209+
ln -sf A $(DIST_DIR)/$$fmwk/vector.framework/Versions/Current; \
210+
ln -sf Versions/Current/vector $(DIST_DIR)/$$fmwk/vector.framework/vector; \
211+
ln -sf Versions/Current/Headers $(DIST_DIR)/$$fmwk/vector.framework/Headers; \
212+
ln -sf Versions/Current/Modules $(DIST_DIR)/$$fmwk/vector.framework/Modules; \
213+
ln -sf Versions/Current/Resources $(DIST_DIR)/$$fmwk/vector.framework/Resources;
199214
xcodebuild -create-xcframework $(foreach fmwk,$(FMWK_NAMES),-framework $(DIST_DIR)/$(fmwk)/vector.framework) -output $@
200215
rm -rf $(foreach fmwk,$(FMWK_NAMES),$(DIST_DIR)/$(fmwk))
201216

Package.swift

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,20 @@ let package = Package(
77
name: "vector",
88
platforms: [.macOS(.v11), .iOS(.v11)],
99
products: [
10-
// Products can be used to vend plugins, making them visible to other packages.
11-
.plugin(
12-
name: "vectorPlugin",
13-
targets: ["vectorPlugin"]),
1410
.library(
1511
name: "vector",
1612
targets: ["vector"])
1713
],
1814
targets: [
19-
// Build tool plugin that invokes the Makefile
20-
.plugin(
21-
name: "vectorPlugin",
22-
capability: .buildTool(),
23-
path: "packages/swift/plugin"
15+
.binaryTarget(
16+
name: "vectorBinary",
17+
url: "https://github.com/sqliteai/sqlite-vector/releases/download/0.9.94/vector-apple-xcframework-0.9.94.zip",
18+
checksum: "0000000000000000000000000000000000000000000000000000000000000000"
2419
),
25-
// vector library target
2620
.target(
2721
name: "vector",
28-
dependencies: [],
29-
path: "packages/swift/extension",
30-
plugins: ["vectorPlugin"]
22+
dependencies: ["vectorBinary"],
23+
path: "packages/swift"
3124
),
3225
]
33-
)
26+
)

packages/swift/extension/vector.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/swift/plugin/vector.swift

Lines changed: 0 additions & 60 deletions
This file was deleted.

packages/swift/vector.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// vector.swift
2+
// Provides the path to the vector SQLite extension for use with sqlite3_load_extension.
3+
4+
import Foundation
5+
6+
public struct vector {
7+
/// Returns the absolute path to the vector dylib for use with sqlite3_load_extension.
8+
public static var path: String {
9+
#if os(macOS)
10+
return Bundle.main.bundlePath + "/Contents/Frameworks/vector.framework/vector"
11+
#else
12+
return Bundle.main.bundlePath + "/Frameworks/vector.framework/vector"
13+
#endif
14+
}
15+
}

src/sqlite-vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern "C" {
2525
#endif
2626

27-
#define SQLITE_VECTOR_VERSION "0.9.93"
27+
#define SQLITE_VECTOR_VERSION "0.9.94"
2828

2929
SQLITE_VECTOR_API int sqlite3_vector_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
3030

0 commit comments

Comments
 (0)