The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | #!/bin/bash |
| 2 | set -euo pipefail |
| 3 | module_dir=$(cd "$(dirname "$0")/.." && pwd) |
| 4 | sdk=$(xcrun --sdk macosx --show-sdk-path) |
| 5 | compiler=$(xcrun --find swiftc) |
| 6 | output=$(mktemp -d) |
| 7 | trap 'rm -rf "$output"' EXIT |
| 8 | # Compile the real editor view; only the Expo bridge and clipboard are stubbed. |
| 9 | python3 - "$module_dir" "$output/main.swift" <<'PYTHON' |
| 10 | import sys |
| 11 | from pathlib import Path |
| 12 | module = Path(sys.argv[1]) |
| 13 | source = (module / "ios/T3ComposerEditorView.swift").read_text() |
| 14 | source = source.replace("import ExpoModulesCore\n", "") |
| 15 | stubs = """ |
| 16 | public final class AppContext {} |
| 17 | open class ExpoView: UIView { |
| 18 | public required init(appContext: AppContext? = nil) { super.init(frame: .zero) } |
| 19 | @available(*, unavailable) |
| 20 | public required init?(coder: NSCoder) { fatalError("init(coder:) is unused") } |
| 21 | } |
| 22 | final class EventDispatcher { |
| 23 | var payloads: [[String: Any]] = [] |
| 24 | func callAsFunction(_ payload: [String: Any] = [:]) { payloads.append(payload) } |
| 25 | } |
| 26 | enum T3ComposerClipboard { |
| 27 | static func hasThreadLink(_ text: String) -> Bool { false } |
| 28 | static func read() -> [String: String] { [:] } |
| 29 | static func write(text: String, fragment: String) {} |
| 30 | } |
| 31 | """ |
| 32 | Path(sys.argv[2]).write_text(source + "\n" + stubs + "\n" + (module / "tests/ios/main.swift").read_text()) |
| 33 | PYTHON |
| 34 | "$compiler" -target "$(uname -m)-apple-ios16.1-macabi" -sdk "$sdk" \ |
| 35 | -F "$sdk/System/iOSSupport/System/Library/Frameworks" \ |
| 36 | "$output/main.swift" -o "$output/editor-tests" |
| 37 | "$output/editor-tests" |