-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.swift
More file actions
120 lines (119 loc) · 6.32 KB
/
Copy pathPackage.swift
File metadata and controls
120 lines (119 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "ThreeFingerSwitcher",
platforms: [
.macOS(.v15)
],
products: [
// Product name is UNCHANGED so scripts/build-app.sh keeps working.
.executable(name: "ThreeFingerSwitcher", targets: ["ThreeFingerSwitcher"]),
.executable(name: "TouchSpike", targets: ["TouchSpike"])
],
dependencies: [
.package(url: "https://github.com/Kyome22/OpenMultitouchSupport.git", from: "4.0.0"),
// The shared device-link packages (wire contract / mirror store / pairing crypto): a standalone
// cross-platform package (macOS + iOS, no MLX) so the iOS companion app can consume the same code.
// VENDORED in-repo at ./DeviceLinkKit (rather than a `../` sibling) so CI can resolve it — the
// sibling path only existed on the maintainer's machine and broke the release build. Keep this
// copy in sync with the standalone package if the iOS app consumes a separate copy.
.package(path: "DeviceLinkKit"),
// The MLX/Gemma 4 runtime. Pulls mlx-swift / swift-transformers / mlx-swift-lm transitively.
// Building anything that links this needs `xcodebuild` (Metal shaders) — see GemmaRuntime target.
// PINNED to an exact revision (not `branch: "main"`): the upstream `main` drifts and has shipped
// commits that fail to compile (e.g. a `Float`→`MLXArray` type error in LoRA/TurboQuant). A
// branch requirement let CI re-resolve to a broken HEAD and fail the release build even though
// the committed Package.resolved pinned a good commit. An exact revision freezes it everywhere.
// To bump: change the SHA here, re-resolve, and verify with `xcodebuild`.
.package(url: "https://github.com/VincentGourbin/gemma-4-swift-mlx",
revision: "c6f8ab5820379898b1d437e8e5c463f376672613"),
// Flux 2 image-generation runtime (MLX). Pins mlx-swift to the SAME exact 0.31.4 as
// gemma-4-swift-mlx, so it resolves with no version change. Linked into GemmaRuntime ONLY
// (keeps ThreeFingerSwitcherCore MLX-free). PINNED to an exact revision (same rationale as
// gemma above: upstream `main` drifts). To bump: change the SHA here, re-resolve, verify
// with `xcodebuild`.
.package(url: "https://github.com/VincentGourbin/flux-2-swift-mlx",
revision: "add498c4a30581d4457ef513bbfe8c9c097c504c")
],
targets: [
// All app logic lives in this library so the test target can `@testable import` it.
// (A test target cannot @testable-import an executable module with top-level code.)
.target(
name: "ThreeFingerSwitcherCore",
dependencies: [
.product(name: "OpenMultitouchSupport", package: "OpenMultitouchSupport"),
// The shared wire contract — used by the device-link inbound adapter (LinkItem → ClipboardEntry).
.product(name: "DeviceLinkProtocol", package: "DeviceLinkKit"),
// The shared pairing crypto — used by the Mac QR pairing (PairingExchange / QR payload).
.product(name: "DeviceLinkPairing", package: "DeviceLinkKit")
],
path: "Sources/ThreeFingerSwitcher",
swiftSettings: [
// Pragmatic: v5 language mode avoids strict-concurrency friction in the GUI
// layer. The Kyome package remains Sendable-clean across the boundary.
.swiftLanguageMode(.v5)
]
),
// The MLX/Gemma 4 runtime, ISOLATED in its own target so `ThreeFingerSwitcherCore` and the
// test target stay MLX-free and keep building under plain `swift build`/`swift test`. This
// target links MLX (Metal shaders) so it — and anything depending on it (the app) — builds
// ONLY via `xcodebuild`, never `swift build`. It conforms to Core's public `LLMRuntime` seam.
.target(
name: "GemmaRuntime",
dependencies: [
"ThreeFingerSwitcherCore",
.product(name: "Gemma4Swift", package: "gemma-4-swift-mlx"),
// Flux 2 image-generation (MLX). Same exact mlx-swift 0.31.4 as Gemma — no version
// change. Kept in GemmaRuntime so Core stays MLX-free.
.product(name: "Flux2Core", package: "flux-2-swift-mlx"),
.product(name: "FluxTextEncoders", package: "flux-2-swift-mlx")
],
path: "Sources/GemmaRuntime",
swiftSettings: [
.swiftLanguageMode(.v5)
]
),
// Thin executable: calls runThreeFingerSwitcher() from Core and injects the real Gemma runtime
// (from GemmaRuntime) at the model seam. Builds via `xcodebuild` (it transitively links MLX).
.executableTarget(
name: "ThreeFingerSwitcher",
dependencies: [
"ThreeFingerSwitcherCore", "GemmaRuntime"
],
path: "Sources/ThreeFingerSwitcherApp",
swiftSettings: [
.swiftLanguageMode(.v5)
]
),
.testTarget(
name: "ThreeFingerSwitcherTests",
dependencies: [
"ThreeFingerSwitcherCore",
// The adapter/connection/QR tests import the wire contract + pairing crypto directly.
.product(name: "DeviceLinkProtocol", package: "DeviceLinkKit"),
.product(name: "DeviceLinkPairing", package: "DeviceLinkKit")
],
path: "Tests/ThreeFingerSwitcherTests",
swiftSettings: [
.swiftLanguageMode(.v5)
]
),
// Throwaway verification harness (Section 1 spikes). Not bundled in the shipped app.
.executableTarget(
name: "TouchSpike",
dependencies: [
.product(name: "OpenMultitouchSupport", package: "OpenMultitouchSupport")
],
path: "Sources/TouchSpike"
),
// Throwaway harness for the four-finger-launcher spikes (S-OQ1 haptics, S-OQ3 window move).
// Not bundled in the shipped app.
.executableTarget(
name: "LauncherSpike",
path: "Sources/LauncherSpike",
swiftSettings: [
.swiftLanguageMode(.v5)
]
)
]
)