react-native/local-cli/runIOS/runIOS.js

313 lines
11 KiB
JavaScript
Raw Normal View History

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const child_process = require('child_process');
const fs = require('fs');
const path = require('path');
const findXcodeProject = require('./findXcodeProject');
Make the CLI recognize CRNA projects Summary: 1. Make running `react-native run-ios` or `react-native run-android` inside a project created with Create React Native App run the corresponding react-native-scripts command instead of failing. **Before**: <img width="762" alt="screen shot 2017-07-21 at 16 55 32" src="https://user-images.githubusercontent.com/497214/28467425-86b309c8-6e38-11e7-8946-139bda927d93.png"><img width="762" alt="screen shot 2017-07-21 at 16 55 52" src="https://user-images.githubusercontent.com/497214/28467436-8df02482-6e38-11e7-8a03-3fa664944cac.png"> **After**: <img width="762" alt="screen shot 2017-07-21 at 16 52 15" src="https://user-images.githubusercontent.com/497214/28467522-e4bb6cae-6e38-11e7-97bb-9cfa9cb4dc67.png"> 2. Make running `react-native link` inside a CRNA project display a helpful error message. **Before**: <img width="762" alt="screen shot 2017-07-21 at 16 55 10" src="https://user-images.githubusercontent.com/497214/28467608-1d1781fa-6e39-11e7-9620-cc16c8b1b40f.png"> **After**: <img width="762" alt="screen shot 2017-07-21 at 16 53 10" src="https://user-images.githubusercontent.com/497214/28467637-2cd6ed1a-6e39-11e7-8947-6df69b3f321e.png"> Fixes #14828. * Run `react-native run-ios`, `react-native run-android` and `react-native link` in: * A CRNA project (screenshot above) * A traditional RN project (existing behaviour) * A folder that contains neither (existing behaviour) Closes https://github.com/facebook/react-native/pull/15139 Differential Revision: D5498914 Pulled By: hramos fbshipit-source-id: 94b6196e3451857bbaa45335a01643c89bed19a0
2017-08-03 18:55:40 +00:00
const findReactNativeScripts = require('../util/findReactNativeScripts');
const parseIOSDevicesList = require('./parseIOSDevicesList');
const findMatchingSimulator = require('./findMatchingSimulator');
fixed issue with runIOS not being able to launch tvOS app Summary: Yes. Yes Environment: OS: MacOS X 10.12.6 (16G29) Node: 8.9.4 Yarn: N/A npm: 5.4.2 Watchman: Not Found Xcode: 9.2 (9C40b) Android Studio: N/A [CLI iOS runIOS] When using `react-native-cli` to try to launch the tvOS scheme the user get's an error because the current implementation for launching simulators ignores any simulator/device who's name does not start with `iOS` StackOverflow issue also found here : https://stackoverflow.com/questions/48069690/how-to-select-project-to-run-tvos-version-with-npm-start Actual command line steps ``` $npm i -g react-native-cli ... $react-native init CoolProject ... $cd CoolProject/ $react-native run-ios --simulator "Apple TV" --scheme "CoolProject-tvOS" Scanning folders for symlinks in /Users/jjiron/CoolProject/node_modules (7ms) Found Xcode project CoolProject.xcodeproj CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo' Could not find Apple TV simulator ``` The cli tool should launch the tvOS application on the simulator. The user get's an error message saying "Could not find Apple TV simulator" Don't ignore appletv simulators when looking for simulators to launch. Also use the correct application build when selecting which app to launch on the simulator/device. Added automated test for `findMatchingSimulator.js` to allow tvOS simulators [react-native-cli] Fixed issue where you cannot launch tvOS app on Apple TV simulator Closes https://github.com/facebook/react-native/pull/17660 Differential Revision: D6806327 Pulled By: hramos fbshipit-source-id: 1a4f37058f3c5d8223012a3e4050e7bbfaafa6c4
2018-01-29 21:20:48 +00:00
const getBuildPath = function (configuration = 'Debug', appName, isDevice) {
let device;
if (isDevice) {
device = 'iphoneos';
} else if (appName.toLowerCase().includes('tvos')) {
device = 'appletvsimulator';
} else {
device = 'iphonesimulator';
}
return `build/Build/Products/${configuration}-${device}/${appName}.app`;
};
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
const xcprettyAvailable = function() {
try {
child_process.execSync('xcpretty --version', {
stdio: [ 0, 'pipe', 'ignore', ]
});
} catch (error) {
return false;
}
return true;
};
function runIOS(argv, config, args) {
Make the CLI recognize CRNA projects Summary: 1. Make running `react-native run-ios` or `react-native run-android` inside a project created with Create React Native App run the corresponding react-native-scripts command instead of failing. **Before**: <img width="762" alt="screen shot 2017-07-21 at 16 55 32" src="https://user-images.githubusercontent.com/497214/28467425-86b309c8-6e38-11e7-8946-139bda927d93.png"><img width="762" alt="screen shot 2017-07-21 at 16 55 52" src="https://user-images.githubusercontent.com/497214/28467436-8df02482-6e38-11e7-8a03-3fa664944cac.png"> **After**: <img width="762" alt="screen shot 2017-07-21 at 16 52 15" src="https://user-images.githubusercontent.com/497214/28467522-e4bb6cae-6e38-11e7-97bb-9cfa9cb4dc67.png"> 2. Make running `react-native link` inside a CRNA project display a helpful error message. **Before**: <img width="762" alt="screen shot 2017-07-21 at 16 55 10" src="https://user-images.githubusercontent.com/497214/28467608-1d1781fa-6e39-11e7-9620-cc16c8b1b40f.png"> **After**: <img width="762" alt="screen shot 2017-07-21 at 16 53 10" src="https://user-images.githubusercontent.com/497214/28467637-2cd6ed1a-6e39-11e7-8947-6df69b3f321e.png"> Fixes #14828. * Run `react-native run-ios`, `react-native run-android` and `react-native link` in: * A CRNA project (screenshot above) * A traditional RN project (existing behaviour) * A folder that contains neither (existing behaviour) Closes https://github.com/facebook/react-native/pull/15139 Differential Revision: D5498914 Pulled By: hramos fbshipit-source-id: 94b6196e3451857bbaa45335a01643c89bed19a0
2017-08-03 18:55:40 +00:00
if (!fs.existsSync(args.projectPath)) {
const reactNativeScriptsPath = findReactNativeScripts();
if (reactNativeScriptsPath) {
child_process.spawnSync(
reactNativeScriptsPath,
['ios'].concat(process.argv.slice(1)),
{stdio: 'inherit'}
);
return;
} else {
throw new Error('iOS project folder not found. Are you sure this is a React Native project?');
}
}
process.chdir(args.projectPath);
const xcodeProject = findXcodeProject(fs.readdirSync('.'));
if (!xcodeProject) {
throw new Error('Could not find Xcode project files in ios folder');
}
const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));
const scheme = args.scheme || inferredSchemeName;
console.log(`Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${xcodeProject.name}`);
const devices = parseIOSDevicesList(
child_process.execFileSync('xcrun', ['instruments', '-s'], {encoding: 'utf8'})
);
if (args.device) {
const selectedDevice = matchingDevice(devices, args.device);
if (selectedDevice) {
Pass port when running on device (fix #17973) Summary: <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> Building for iOS device `react-native run-ios --device [id]` fails since port is not passed. This is a blocker for us and prevents us from updating to latest React Native stable. I've tested this in our app and also in fresh app using RN master and verified that it works. None. [CLI] [BUGFIX] [local-cli/runIOS/runIOS.js] - Pass metro port when running on device <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes https://github.com/facebook/react-native/pull/17983 Differential Revision: D6988299 Pulled By: hramos fbshipit-source-id: 5169706600f87f13b9c9c105eb7d6db7a40194f1
2018-02-14 16:02:13 +00:00
return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager, args.verbose, args.port);
} else {
if (devices && devices.length > 0) {
console.log('Could not find device with the name: "' + args.device + '".');
console.log('Choose one of the following:');
printFoundDevices(devices);
} else {
console.log('No iOS devices connected.');
}
}
} else if (args.udid) {
return runOnDeviceByUdid(args, scheme, xcodeProject, devices);
} else {
return runOnSimulator(xcodeProject, args, scheme);
}
}
function runOnDeviceByUdid(args, scheme, xcodeProject, devices) {
const selectedDevice = matchingDeviceByUdid(devices, args.udid);
if (selectedDevice) {
return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager, args.verbose, args.port);
} else {
if (devices && devices.length > 0) {
console.log('Could not find device with the udid: "' + args.udid + '".');
console.log('Choose one of the following:');
printFoundDevices(devices);
} else {
console.log('No iOS devices connected.');
}
}
}
function runOnSimulator(xcodeProject, args, scheme) {
return new Promise((resolve) => {
try {
var simulators = JSON.parse(
child_process.execFileSync('xcrun', ['simctl', 'list', '--json', 'devices'], {encoding: 'utf8'})
);
} catch (e) {
throw new Error('Could not parse the simulator list output');
}
const selectedSimulator = findMatchingSimulator(simulators, args.simulator);
if (!selectedSimulator) {
throw new Error(`Could not find ${args.simulator} simulator`);
}
if (!selectedSimulator.booted) {
const simulatorFullName = formattedDeviceName(selectedSimulator);
console.log(`Launching ${simulatorFullName}...`);
try {
child_process.spawnSync('xcrun', ['instruments', '-w', selectedSimulator.udid]);
} catch (e) {
// instruments always fail with 255 because it expects more arguments,
// but we want it to only launch the simulator
}
}
2018-04-05 21:30:39 +00:00
buildProject(xcodeProject, selectedSimulator.udid, scheme, args.configuration, args.packager, args.verbose, args.port)
.then((appName) => resolve({ udid: selectedSimulator.udid, appName }));
})
2018-04-05 21:30:39 +00:00
.then(({udid, appName}) => {
if (!appName) {
appName = scheme;
}
let appPath = getBuildPath(args.configuration, appName);
console.log(`Installing ${appPath}`);
child_process.spawnSync('xcrun', ['simctl', 'install', udid, appPath], {stdio: 'inherit'});
const bundleID = child_process.execFileSync(
'/usr/libexec/PlistBuddy',
['-c', 'Print:CFBundleIdentifier', path.join(appPath, 'Info.plist')],
{encoding: 'utf8'}
).trim();
console.log(`Launching ${bundleID}`);
child_process.spawnSync('xcrun', ['simctl', 'launch', udid, bundleID], {stdio: 'inherit'});
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
});
}
function runOnDevice(selectedDevice, scheme, xcodeProject, configuration, launchPackager, verbose, port) {
return buildProject(xcodeProject, selectedDevice.udid, scheme, configuration, launchPackager, verbose, port)
.then((appName) => {
if (!appName) {
appName = scheme;
}
const iosDeployInstallArgs = [
'--bundle', getBuildPath(configuration, appName, true),
'--id' , selectedDevice.udid,
'--justlaunch'
];
console.log(`installing and launching your app on ${selectedDevice.name}...`);
const iosDeployOutput = child_process.spawnSync('ios-deploy', iosDeployInstallArgs, {encoding: 'utf8'});
if (iosDeployOutput.error) {
console.log('');
console.log('** INSTALLATION FAILED **');
console.log('Make sure you have ios-deploy installed globally.');
console.log('(e.g "npm install -g ios-deploy")');
} else {
console.log('** INSTALLATION SUCCEEDED **');
}
});
}
function buildProject(xcodeProject, udid, scheme, configuration = 'Debug', launchPackager = false, verbose, port) {
return new Promise((resolve,reject) =>
{
var xcodebuildArgs = [
xcodeProject.isWorkspace ? '-workspace' : '-project', xcodeProject.name,
'-configuration', configuration,
'-scheme', scheme,
'-destination', `id=${udid}`,
'-derivedDataPath', 'build',
];
console.log(`Building using "xcodebuild ${xcodebuildArgs.join(' ')}"`);
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
let xcpretty;
if (!verbose) {
xcpretty = xcprettyAvailable() && child_process.spawn('xcpretty', [], { stdio: ['pipe', process.stdout, process.stderr] });
}
const buildProcess = child_process.spawn('xcodebuild', xcodebuildArgs, getProcessOptions(launchPackager, port));
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
let buildOutput = '';
buildProcess.stdout.on('data', function(data) {
buildOutput += data.toString();
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
if (xcpretty) {
xcpretty.stdin.write(data);
} else {
console.log(data.toString());
}
});
buildProcess.stderr.on('data', function(data) {
console.error(data.toString());
});
buildProcess.on('close', function(code) {
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
if (xcpretty) {
xcpretty.stdin.end();
}
//FULL_PRODUCT_NAME is the actual file name of the app, which actually comes from the Product Name in the build config, which does not necessary match a scheme name, example output line: export FULL_PRODUCT_NAME="Super App Dev.app"
let productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec(buildOutput);
if (productNameMatch && productNameMatch.length && productNameMatch.length > 1) {
return resolve(productNameMatch[1]);//0 is the full match, 1 is the app name
}
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
return buildProcess.error ? reject(buildProcess.error) : resolve();
});
});
}
function matchingDevice(devices, deviceName) {
if (deviceName === true && devices.length === 1)
{
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
console.log(`Using first available device ${devices[0].name} due to lack of name supplied.`);
return devices[0];
}
for (let i = devices.length - 1; i >= 0; i--) {
if (devices[i].name === deviceName || formattedDeviceName(devices[i]) === deviceName) {
return devices[i];
}
}
}
function matchingDeviceByUdid(devices, udid) {
for (let i = devices.length - 1; i >= 0; i--) {
if (devices[i].udid === udid) {
return devices[i];
}
}
}
function formattedDeviceName(simulator) {
return `${simulator.name} (${simulator.version})`;
}
function printFoundDevices(devices) {
for (let i = devices.length - 1; i >= 0; i--) {
console.log(devices[i].name + ' Udid: ' + devices[i].udid);
}
}
function getProcessOptions(launchPackager, port) {
if (launchPackager) {
return {
env: { ...process.env, RCT_METRO_PORT: port }
};
}
return {
env: { ...process.env, RCT_NO_LAUNCH_PACKAGER: true },
};
}
module.exports = {
name: 'run-ios',
description: 'builds your app and starts it on iOS simulator',
func: runIOS,
examples: [
{
desc: 'Run on a different simulator, e.g. iPhone 5',
cmd: 'react-native run-ios --simulator "iPhone 5"',
},
{
desc: 'Pass a non-standard location of iOS directory',
cmd: 'react-native run-ios --project-path "./app/ios"',
},
{
desc: "Run on a connected device, e.g. Max's iPhone",
cmd: 'react-native run-ios --device "Max\'s iPhone"',
},
fixed issue with runIOS not being able to launch tvOS app Summary: Yes. Yes Environment: OS: MacOS X 10.12.6 (16G29) Node: 8.9.4 Yarn: N/A npm: 5.4.2 Watchman: Not Found Xcode: 9.2 (9C40b) Android Studio: N/A [CLI iOS runIOS] When using `react-native-cli` to try to launch the tvOS scheme the user get's an error because the current implementation for launching simulators ignores any simulator/device who's name does not start with `iOS` StackOverflow issue also found here : https://stackoverflow.com/questions/48069690/how-to-select-project-to-run-tvos-version-with-npm-start Actual command line steps ``` $npm i -g react-native-cli ... $react-native init CoolProject ... $cd CoolProject/ $react-native run-ios --simulator "Apple TV" --scheme "CoolProject-tvOS" Scanning folders for symlinks in /Users/jjiron/CoolProject/node_modules (7ms) Found Xcode project CoolProject.xcodeproj CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo' Could not find Apple TV simulator ``` The cli tool should launch the tvOS application on the simulator. The user get's an error message saying "Could not find Apple TV simulator" Don't ignore appletv simulators when looking for simulators to launch. Also use the correct application build when selecting which app to launch on the simulator/device. Added automated test for `findMatchingSimulator.js` to allow tvOS simulators [react-native-cli] Fixed issue where you cannot launch tvOS app on Apple TV simulator Closes https://github.com/facebook/react-native/pull/17660 Differential Revision: D6806327 Pulled By: hramos fbshipit-source-id: 1a4f37058f3c5d8223012a3e4050e7bbfaafa6c4
2018-01-29 21:20:48 +00:00
{
desc: 'Run on the AppleTV simulator',
cmd: 'react-native run-ios --simulator "Apple TV" --scheme "helloworld-tvOS"',
}
],
options: [{
command: '--simulator [string]',
description: 'Explicitly set simulator to use',
default: 'iPhone 6',
} , {
command: '--configuration [string]',
description: 'Explicitly set the scheme configuration to use',
} , {
command: '--scheme [string]',
description: 'Explicitly set Xcode scheme to use',
}, {
command: '--project-path [string]',
description: 'Path relative to project root where the Xcode project '
+ '(.xcodeproj) lives. The default is \'ios\'.',
default: 'ios',
}, {
command: '--device [string]',
description: 'Explicitly set device to use by name. The value is not required if you have a single device connected.',
}, {
command: '--udid [string]',
description: 'Explicitly set device to use by udid',
}, {
command: '--no-packager',
description: 'Do not launch packager while building',
Use xcpretty for iOS build output if installed Summary: iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format. This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag. - Create a project from master - run `react-native run-ios` - Confirm output looks like this: ```tabrindle-mbp:shop-rn tabrindle$ make Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms) Found Xcode project Shop.xcodeproj We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time. Launching iPhone 6 (iOS 10.3)... Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build" ▸ Building React/yoga [Debug] ▸ Check Dependencies ▸ Building React/double-conversion [Debug] ▸ Check Dependencies ▸ Running script 'Install Third Party' ▸ Building React/third-party [Debug] ▸ Check Dependencies ▸ Building React/jschelpers [Debug] ▸ Check Dependencies ▸ Building React/cxxreact [Debug] ▸ Check Dependencies ▸ Building React/React [Debug] ▸ Check Dependencies ▸ Running script 'Start Packager' ▸ Running script 'Include RCTJSCProfiler' ▸ Building RCTSettings/RCTSettings [Debug] ▸ Check Dependencies ▸ Building BVLinearGradient/BVLinearGradient [Debug] ▸ Check Dependencies ▸ Building RCTActionSheet/RCTActionSheet [Debug] ▸ Check Dependencies ▸ Building RCTLinking/RCTLinking [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/fishhook [Debug] ▸ Check Dependencies ▸ Building RCTWebSocket/RCTWebSocket [Debug] ▸ Check Dependencies ▸ Building RCTText/RCTText [Debug] ▸ Check Dependencies ▸ Building RCTNetwork/RCTNetwork [Debug] ▸ Check Dependencies ▸ Building RCTAnimation/RCTAnimation [Debug] ▸ Check Dependencies ▸ Building RCTGeolocation/RCTGeolocation [Debug] ▸ Check Dependencies ▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug] ▸ Check Dependencies ▸ Building RNI18n/RNI18n [Debug] ▸ Check Dependencies ▸ Building RCTImage/RCTImage [Debug] ▸ Check Dependencies ▸ Building RNVectorIcons/RNVectorIcons [Debug] ▸ Check Dependencies ▸ Building RCTVibration/RCTVibration [Debug] ▸ Check Dependencies ▸ Building Shop/Shop [Debug] ▸ Check Dependencies ▸ Running script 'Bundle React Native code and images' ▸ Building Shop/ShopTests [Debug] ▸ Check Dependencies ▸ Build Succeeded Installing build/Build/Products/Debug-iphonesimulator/Shop.app Launching com.marketamerica.MAMobile com.marketamerica.MAMobile: 43497``` - run `react-native run-ios --verbose` - confirm output looks as normal Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years. Closes https://github.com/facebook/react-native/pull/15607 Differential Revision: D5740684 Pulled By: shergin fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 16:57:22 +00:00
}, {
command: '--verbose',
description: 'Do not use xcpretty even if installed',
},{
command: '--port [number]',
default: process.env.RCT_METRO_PORT || 8081,
parse: (val: string) => Number(val),
}],
};