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

Swaps deprecated instruments cli out for xctrace #21952

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikelrob
Copy link
Contributor

@mikelrob mikelrob commented Apr 8, 2024

Replace deprecated instruments command with xctrace list devices
Updated test spec and fixtures

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

I need to retrieve information about devices connected to the machine running fastlane. I create my own action to call FastlaneCore::DeviceManager.connected_devices("iOS") and it caused the following error.

bundler: failed to load command: fastlane (/Users/mike.robinson/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bin/fastlane)
/Users/mike.robinson/.rbenv/versions/3.2.2/lib/ruby/3.2.0/open3.rb:222:in `spawn': No such file or directory - instruments (Errno::ENOENT)
	from /Users/mike.robinson/.rbenv/versions/3.2.2/lib/ruby/3.2.0/open3.rb:222:in `popen_run'
	from /Users/mike.robinson/.rbenv/versions/3.2.2/lib/ruby/3.2.0/open3.rb:103:in `popen3'
	from /Users/mike.robinson/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fastlane-2.219.0/fastlane_core/lib/fastlane_core/device_manager.rb:97:in `connected_devices'

The instruments cli tool was previously deprecated and has now been removed with the Release of Xcode 13. The deprecation notice advises:

instead, use xctrace.

Description

I investigated the use of xctrace and found it was able to list devices. Upon running the command xctrace list devices I was presented with a list of Devices and Simulators. The list was not too dissimilar from the previous output from instruments as can be compared in the changes to the fixtures within this PR.
I updated the DeviceManager to use xctrace, updated the regex used to match the UDID and updates the test specs and fixtures appropriately.

Testing Steps

I created my own action which called into the DeviceManager code and observed the desired output.
I also ran rspec and rubocop before creating the PR.

Updates regex to match output of xctrace - replaced square brackets with round
Updated test spec and fixtures
@CarlosNano
Copy link

👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants