Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to specify macCatalyst UDID as run target #2313

Open
mikehardy opened this issue Feb 28, 2024 · 0 comments
Open

Not possible to specify macCatalyst UDID as run target #2313

mikehardy opened this issue Feb 28, 2024 · 0 comments

Comments

@mikehardy
Copy link
Contributor

Environment

yarn react-native info from inside a project (note: npx react-native info does not work from outside a project)

System:
  OS: macOS 14.3.1
  CPU: (8) arm64 Apple M2
  Memory: 66.75 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 18.15.0
    path: /private/var/folders/mm/jkjz89x50k1bgv16lm9wwch80000gn/T/xfs-76f07cda/node
  Yarn:
    version: 4.1.0
    path: /private/var/folders/mm/jkjz89x50k1bgv16lm9wwch80000gn/T/xfs-76f07cda/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v18.15.0/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/mike/.asdf/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
    System Images:
      - android-23 | ARM 64 v8a
      - android-24 | Google Play Intel x86 Atom
      - android-33 | ARM 64 v8a
      - android-33 | Google APIs ATD ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/mike/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0-rc.1
    wanted: 0.74.0-rc.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Description

As requested in a comment on a PR I posted here for the CLI - this issue is about the difficulty of specifying macCatalyst as a run target

I have a script that does fully scripted / reproducible build testing for react-native-firebase + react-native, and I want to test the macCatalyst target since we support it.

As far as I know there is a run-ios command in the CLI but there is no run-catalyst (which makes sense, as it is really a sub-flavor of iOS)

So as far as I know the only way to specify that I want it to be a macCatalyst build is to either specify the device name (Preferred method!) or to specify the UDID of the machine.

Here's the problem: On Apple Silicon machines at least, xsimctl does not return the correct UDID for the available macCatalyst hostname!

This leads to two downstream problems in the CLI:

  • the CLI will refuse to build for the target specified by name since there does not appear to be a device by that name
  • even if you find the UDID yourself and request a build to UDID instead of build to name, the CLI will assert that the UDID does not exist and thus will not build

What is the solution? Determine why xsimctl isn't returning the right UDID I suppose but that's upstream, not in our control.

What I do in this patch is simply accept - with a warning - that if a developer has gone to the trouble to specify a UDID - that the UDID must be valid to try even though it doesn't show up in the device list from xsimctl and just have the CLI build to it anyway.

A little bit ugly but I also set it to catalyst build type at the same time - this part specifically is not great

It works.

And I get the UDID by on purpose requesting a build that will not work from xcodebuild so it gives me the list of UDIDs that will work and I parse out the catalyst UDID

CATALYST_DESTINATION=$(xcodebuild -workspace ios/rnfbdemo.xcworkspace -configuration Debug -scheme rnfbdemo -destination id=7153382A-C92B-5798-BEA3-D82D195F25F8 2>&1|grep macOS|grep Catalyst|head -1 |cut -d':' -f5 |cut -d' ' -f1)

That part is definitely awful but it does work. Why isn't xsimctl working ?

Reproducible Demo

Run this with a valid XCODE_DEVELOPMENT_TEAM set https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

It should try to build for catalyst. Modify as needed. Remove the patch hunk to see it fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant