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

Backwards compatibility in findMatchingSimulator version input #23305

Closed

Conversation

osunnarvik
Copy link

@osunnarvik osunnarvik commented Feb 6, 2019

Summary

handling dot-version input in findMatchingSimulator also when using newest xcrun to list devices. Format of xcrun output has changed

When parsing simulator names in order to run on iOS simulator, the version provided by xcrun now is separated by a dash instead of a dot. Therefore when input to run-ios --simulator is specified with an iOS version (in dot-format), the simulator will not be found.

This started happening for me after I installed the latest XCode (beta). I am currently using XCode "Version 10.2 beta (10P82s)", but I have tried using xcode-select to point towards the latest stable XCode version as well, but the problem still occurs. My version of xcrun is "xcrun version 43.1."

Changelog

[iOS] [Changed] - Backwards compatibility in input format for run-ios --simulator "<device-type (device-version)>"

Test Plan

Run the command "react-native run-ios --simulator "iPhone X (12.2)". Without the fix I get the error
Could not find iPhone X simulator
With the fix, it starts fine (Assuming you have an iPhone X 12.2 simulator installed on your machine.)

…ewest xcrun to list devices. Format of xcrun output has changed
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 6, 2019
Copy link

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code analysis results:

  • eslint found some issues.

@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) {
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
let versionWithDashReplacedByDot = version.replace(/-/g,'\.')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier/prettier: Replace '\.') with ·'.');

@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) {
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
let versionWithDashReplacedByDot = version.replace(/-/g,'\.')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semi: Missing semicolon.

@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) {
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
let versionWithDashReplacedByDot = version.replace(/-/g,'\.')
if (simulatorVersion && !versionWithDashReplacedByDot.endsWith(simulatorVersion)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier/prettier: Replace simulatorVersion·&&·!versionWithDashReplacedByDot.endsWith(simulatorVersion) with ⏎······simulatorVersion·&&⏎······!versionWithDashReplacedByDot.endsWith(simulatorVersion)⏎····

@pull-bot
Copy link

pull-bot commented Feb 6, 2019

Warnings
⚠️

📋 Release Notes - This PR appears to be missing Release Notes.

⚠️

❔ Base Branch - The base branch for this PR is something other than master. Are you sure you want to merge these changes into a stable release? If you are interested in backporting updates to an older release, the suggested approach is to land those changes on master first and then cherry-pick the commits into the branch for that release. The Releases Guide has more information.

Generated by 🚫 dangerJS

Copy link

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code analysis results:

  • eslint found some issues.

@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) {
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
let versionWithDashReplacedByDot = version.replace(/-/g,'\.');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier/prettier: Replace '\ with ·'

@cpojer
Copy link
Contributor

cpojer commented Feb 6, 2019

Thanks for making us aware of this issue. I noticed that we already had this fix in the newer version of the CLI that was extracted, so I decided to just backport that one and push it to the 0.58 branch.

@cpojer cpojer closed this Feb 6, 2019
@osunnarvik osunnarvik deleted the xcrun_devices_format_changed branch February 6, 2019 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants