Open History to see the last commit
1#!/bin/bash
2set -euo pipefail
3module_dir=$(cd "$(dirname "$0")/.." && pwd)
4sdk=$(xcrun --sdk macosx --show-sdk-path)
5compiler=$(xcrun --find swiftc)
6output=$(mktemp -d)
7trap 'rm -rf "$output"' EXIT
8# Keep the real content view and helpers; the Expo bridge is not needed by this harness.
9python3 - "$module_dir" "$output/main.swift" <<'PYTHON'
10import sys
11from pathlib import Path
12module = Path(sys.argv[1])
13source = (module / "ios/T3ReviewDiffView.swift").read_text()
14source = source.replace("import ExpoModulesCore\n", "")
15stubs = """
16public final class AppContext {}
17open 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}
22final class EventDispatcher {
23 func callAsFunction(_ payload: [String: Any]) {}
24}
25"""
26# Expo alone is stubbed; keep the real scroll container as well as the content view.
27Path(sys.argv[2]).write_text(source + "\n" + stubs + "\n"
28 + (module / "tests/ios/main.swift").read_text() + "\n"
29 + (module / "tests/ios/anchor.swift").read_text() + "\n"
30 + (module / "tests/ios/geometry.swift").read_text())
31PYTHON
32"$compiler" -O -target "$(uname -m)-apple-ios16.1-macabi" -sdk "$sdk" \
33 -F "$sdk/System/iOSSupport/System/Library/Frameworks" \
34 "$module_dir/ios/ReviewDiffCodeLayout.swift" "$output/main.swift" \
35 -o "$output/layout-tests"
36"$output/layout-tests"