-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathidb-companion.rb
More file actions
72 lines (64 loc) · 3.37 KB
/
Copy pathidb-companion.rb
File metadata and controls
72 lines (64 loc) · 3.37 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
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
class IdbCompanion < Formula
desc "Companion server for automating iOS Simulators"
homepage "https://fbidb.io"
url "https://github.com/facebook/idb/releases/download/v1.5.1/idb-companion.macos-arm64.tar.gz"
# Set explicitly: Homebrew infers the version from the URL and silently
# drops prerelease suffixes like ".b7", which would make a beta look like a
# final release.
version "1.5.1"
sha256 "60dcd8e57d0a97caa722ffdb860e9f7e9047892675bdbe1dd34a9c06ae70aaae"
license "MIT"
# Deliberately no `head` spec. Building idb from source through Homebrew has
# never worked -- see facebook/homebrew-fb issues 73, 75, 77 and 84, spanning
# 2021 to 2026. The immediate blocker is that superenv exports SDKROOT for the
# macOS SDK, which overrides the `-sdk iphonesimulator` build.sh passes for
# the iOS shims, so they fail on a missing UIKit; behind that, build.sh clones
# and builds grpc-swift and lets SwiftPM resolve dependencies, none of it
# checksummed. Anyone wanting a source build should clone the repo and run
# `./build.sh build all`, which is faster and gives better errors.
# Both are runtime requirements, not build ones: the companion loads
# CoreSimulator and MobileDevice from the selected developer directory, and
# the shipped binaries carry a macOS 15 minimum (LC_BUILD_VERSION minos 15.0,
# built against the 26.5 SDK).
depends_on macos: :sequoia
depends_on xcode: "26.0"
def install
# v1.5.0 ships a flat tree: idb_companion, idb-repl, Resources/ and the
# SwiftPM resource bundles all sit at the archive root. v1.1.8 nested
# everything under a wrapper directory holding bin/ and Frameworks/.
#
# idb_companion resolves Resources/ as a sibling of its own binary and
# crashes outright when the shims are absent, so keep the tree intact in
# libexec and symlink the executables rather than cherry-picking them.
libexec.install Dir["*"]
# install_symlink is FileUtils.ln_sf underneath and will happily create a
# dangling link, so a layout change would otherwise put a broken
# idb_companion on PATH and still report success. Fail here instead.
%w[idb_companion idb-repl].each do |exe|
odie "#{exe} missing from the staged tree: the layout has changed" unless (libexec/exe).exist?
end
bin.install_symlink libexec/"idb_companion"
bin.install_symlink libexec/"idb-repl"
end
test do
# Both bin entries must resolve back into libexec, alongside Resources/.
# Assert the layout directly: --help and --list succeed even on a tree with
# Resources/ deleted, so neither proves the install block is right.
%w[idb_companion idb-repl].each do |exe|
assert_equal (libexec/exe).realpath, (bin/exe).realpath
end
resources = libexec/"Resources"
assert_path_exists resources/"libShimulator-iOS.dylib"
assert_path_exists resources/"libRepl-iOS.dylib"
assert_path_exists resources/"SimulatorFrameworkBridge"
assert_path_exists resources/"ReplHost.app"
assert_path_exists resources/"IDBAPI.swiftinterface"
assert_match "build_date", shell_output("#{bin}/idb_companion --version")
assert_match "idb-repl built at", shell_output("#{bin}/idb-repl --version")
end
end