mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(doctor): check usbmuxd socket instead of iproxy on PATH
This commit is contained in:
1 parent
5bb068e77c
commit
d2af3f4456
2 files changed
+23
-7
No files matched your search
@@ -61,8 +61,9 @@ func androidChecks() []doctorCheck {
|
|||||||
|
|
||||||
// iosChecks covers the simulator path, which the native companion drives with
|
// iosChecks covers the simulator path, which the native companion drives with
|
||||||
// no JVM. A simulator host with no Java still passes. Physical-device runs
|
// no JVM. A simulator host with no Java still passes. Physical-device runs
|
||||||
// additionally need devicectl, iproxy, a connected device, and signing
|
// additionally need devicectl, the usbmuxd socket, a connected device, and
|
||||||
// credentials, covered by iosDeviceChecks and surfaced through the "all" union.
|
// signing credentials, covered by iosDeviceChecks and surfaced through the
|
||||||
|
// "all" union.
|
||||||
func iosChecks() []doctorCheck {
|
func iosChecks() []doctorCheck {
|
||||||
return []doctorCheck{
|
return []doctorCheck{
|
||||||
{Name: "xcrun on PATH (ios simulator)", Run: checkExecutableOnPath("xcrun")},
|
{Name: "xcrun on PATH (ios simulator)", Run: checkExecutableOnPath("xcrun")},
|
||||||
@@ -71,13 +72,15 @@ func iosChecks() []doctorCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iosDeviceChecks covers the prerequisites a physical iOS device needs: the
|
// iosDeviceChecks covers the prerequisites a physical iOS device needs: the
|
||||||
// runner is built and driven over a usbmux tunnel, so devicectl installs the
|
// runner is built and driven over a native usbmux tunnel, so devicectl installs
|
||||||
// app, iproxy forwards the tunnel, a device must be connected and paired, and
|
// the app, the macOS usbmuxd socket carries the tunnel, a device must be
|
||||||
// App Store Connect signing credentials must be present for the no-UI build.
|
// connected and paired, and App Store Connect signing credentials must be
|
||||||
|
// present for the no-UI build. Everything here is part of macOS + Xcode; nothing
|
||||||
|
// is installed.
|
||||||
func iosDeviceChecks() []doctorCheck {
|
func iosDeviceChecks() []doctorCheck {
|
||||||
return []doctorCheck{
|
return []doctorCheck{
|
||||||
{Name: "devicectl available (ios physical device)", Run: checkDevicectl},
|
{Name: "devicectl available (ios physical device)", Run: checkDevicectl},
|
||||||
{Name: "iproxy on PATH (ios physical device)", Run: checkExecutableOnPath("iproxy")},
|
{Name: "usbmuxd socket present (ios physical device)", Run: checkUsbmuxd},
|
||||||
{Name: "an iOS device is connected and paired", Run: checkDeviceConnected},
|
{Name: "an iOS device is connected and paired", Run: checkDeviceConnected},
|
||||||
{Name: "App Store Connect signing credentials present", Run: checkDeviceSigning},
|
{Name: "App Store Connect signing credentials present", Run: checkDeviceSigning},
|
||||||
}
|
}
|
||||||
@@ -142,6 +145,19 @@ func checkDevicectl(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// usbmuxdSocketPath is the macOS usbmuxd unix socket. It ships with the OS, so
|
||||||
|
// the device tunnel needs nothing installed.
|
||||||
|
const usbmuxdSocketPath = "/var/run/usbmuxd"
|
||||||
|
|
||||||
|
// checkUsbmuxd confirms the macOS usbmuxd socket is present: the native device
|
||||||
|
// tunnel speaks to it directly instead of shelling out to a third-party client.
|
||||||
|
func checkUsbmuxd(_ context.Context) error {
|
||||||
|
if _, err := os.Stat(usbmuxdSocketPath); err != nil {
|
||||||
|
return fmt.Errorf("usbmuxd socket not found at %s: %w", usbmuxdSocketPath, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// checkDeviceConnected confirms at least one physical iOS device is connected
|
// checkDeviceConnected confirms at least one physical iOS device is connected
|
||||||
// and paired, the prerequisite for the tunnel and the install.
|
// and paired, the prerequisite for the tunnel and the install.
|
||||||
func checkDeviceConnected(ctx context.Context) error {
|
func checkDeviceConnected(ctx context.Context) error {
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func TestDoctorChecksFor_iOSDevice_CoversDevicePrereqs(t *testing.T) {
|
|||||||
t.Errorf("device checks must not include the retired %q", c.Name)
|
t.Errorf("device checks must not include the retired %q", c.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, want := range []string{"devicectl", "iproxy", "connected and paired", "signing credentials"} {
|
for _, want := range []string{"devicectl", "usbmuxd", "connected and paired", "signing credentials"} {
|
||||||
found := false
|
found := false
|
||||||
for _, c := range checks {
|
for _, c := range checks {
|
||||||
if strings.Contains(c.Name, want) {
|
if strings.Contains(c.Name, want) {
|
||||||
|
|||||||
Reference in new issue
Block a user