4545
4646# swiftpm binary target name → local-filename-prefix pairs. Names match the
4747# `.binaryTarget(name: "X", ...)` entries in Package.swift.
48+ # Since v0.19.0, iOS xcframework zips are suffixed "-ios-" to disambiguate
49+ # from Android per-ABI zips. ONNX Runtime is now bundled into RABackendONNX
50+ # and no longer distributed as a separate artifact.
4851declare_mapping () {
4952 # Printed form: BINARY_NAME|ZIP_PREFIX
50- echo " RACommonsBinary|RACommons"
51- echo " RABackendLlamaCPPBinary|RABackendLLAMACPP"
52- echo " RABackendONNXBinary|RABackendONNX"
53- echo " RABackendMetalRTBinary|RABackendMetalRT"
54- echo " ONNXRuntimeiOSBinary|onnxruntime-ios"
55- echo " ONNXRuntimemacOSBinary|onnxruntime-macos"
53+ echo " RACommonsBinary|RACommons-ios"
54+ echo " RABackendLlamaCPPBinary|RABackendLLAMACPP-ios"
55+ echo " RABackendONNXBinary|RABackendONNX-ios"
56+ echo " RABackendMetalRTBinary|RABackendMetalRT-ios"
5657}
5758
5859sha256_of () {
@@ -77,9 +78,13 @@ binary_name, new_sum, path = sys.argv[1], sys.argv[2], sys.argv[3]
7778with open(path) as f:
7879 src = f.read()
7980
80- # Find the `name: "X"` line and the first `checksum: "..."` within 6 lines.
81+ # Find the remote-mode binaryTarget: `name: "X", url: "...", checksum: "..."`.
82+ # We require `url:` between name and checksum to avoid the local-mode entry
83+ # (which uses `path:` and has no checksum) — without this anchor, the non-
84+ # greedy `.*?` would skip past the local entry and match the checksum of
85+ # the NEXT remote target in the file, causing cross-target mis-assignment.
8186pattern = re.compile(
82- r'(name:\s*"' + re.escape(binary_name) + r'".*? checksum:\s*")([0-9a-f]{64})(")',
87+ r'(name:\s*"' + re.escape(binary_name) + r'"\s*,\s*url:\s*"[^"]+"\s*,\s* checksum:\s*")([0-9a-f]{64})(")',
8388 re.DOTALL,
8489)
8590
0 commit comments