mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
9490c2c759
Summary: Works the same way as `react-native run-android`, but targets iOS simulator instead. Under the hood, it uses `xcodebuild` to compile the app and store it in `ios/build` folder, then triggers `instruments` and `simctl` to install and launch the app on simulator. Since Facebook relies on BUCK to build and run iOS app, we probably won't use `run-ios` internally. That's why I'm putting this as public PR instead of internal diff. To test this, I hacked global `react-native` script to install react native from my local checkout instead of from npm, cd into the folder and ran `react-native run-ios`. Closes https://github.com/facebook/react-native/pull/5119 Reviewed By: svcscm Differential Revision: D2805199 Pulled By: frantic fb-gh-sync-id: 423a45ba885cb5e48a16ac22095d757d8cca7e37
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* 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. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
type IOSSimulatorInfo = {
|
|
name: string;
|
|
udid: string;
|
|
version: string;
|
|
}
|
|
|
|
/**
|
|
* Parses the output of `xcrun simctl list devices` command
|
|
*/
|
|
function parseIOSSimulatorsList(text: string): Array<IOSSimulatorInfo> {
|
|
const devices = [];
|
|
var currentOS = null;
|
|
|
|
text.split('\n').forEach((line) => {
|
|
var section = line.match(/^-- (.+) --$/);
|
|
if (section) {
|
|
var header = section[1].match(/^iOS (.+)$/);
|
|
if (header) {
|
|
currentOS = header[1];
|
|
} else {
|
|
currentOS = null;
|
|
}
|
|
return;
|
|
}
|
|
|
|
const device = line.match(/^[ ]*([^()]+) \(([^()]+)\)/);
|
|
if (device && currentOS) {
|
|
var name = device[1];
|
|
var udid = device[2];
|
|
devices.push({udid, name, version: currentOS});
|
|
}
|
|
});
|
|
|
|
return devices;
|
|
}
|
|
|
|
module.exports = parseIOSSimulatorsList;
|