From 88d0ac17e8bf20c4134ba1b17827fa33eeec2ed2 Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Fri, 16 Aug 2019 10:35:31 -0700 Subject: [PATCH] Metro Bundler -> Metro Summary: This bothers me, we renamed the project to drop the "Metro" a while ago. Reviewed By: rubennorte Differential Revision: D16831281 fbshipit-source-id: bb6de412eccda61b617580f3660e3e635f2d2815 --- RNTester/README.md | 2 +- .../DevSupport/RCTInspectorDevServerHelper.mm | 71 +++++++++---------- scripts/launchPackager.bat | 2 +- scripts/launchPackager.command | 2 +- scripts/react-native-xcode.sh | 2 +- 5 files changed, 39 insertions(+), 40 deletions(-) diff --git a/RNTester/README.md b/RNTester/README.md index 33dfed103e0..14133712caf 100644 --- a/RNTester/README.md +++ b/RNTester/README.md @@ -70,7 +70,7 @@ When developing E2E tests, you may want to run in development mode, so that chan detox build -c ios.sim.debug detox test -c ios.sim.debug -You will also need to have Metro Bundler running in another terminal. Note that if you've previously run the E2E tests in release mode, you may need to delete the `RNTester/build` folder before rerunning `detox build`. +You will also need to have Metro running in another terminal. Note that if you've previously run the E2E tests in release mode, you may need to delete the `RNTester/build` folder before rerunning `detox build`. ## Building from source diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index ab339f5da14..466eb8f5436 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -7,8 +7,8 @@ #if RCT_DEV && !TARGET_OS_UIKITFORMAC -#import #import +#import #import #import @@ -37,12 +37,14 @@ static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) if (inspectorProxyPortStr && [inspectorProxyPortStr length] > 0) { inspectorProxyPort = [NSNumber numberWithInt:[inspectorProxyPortStr intValue]]; } - NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; - NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; + NSString *escapedDeviceName = [[[UIDevice currentDevice] name] + stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; + NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] + stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@", - getServerHost(bundleURL, inspectorProxyPort), - escapedDeviceName, - escapedAppName]]; + getServerHost(bundleURL, inspectorProxyPort), + escapedDeviceName, + escapedAppName]]; } static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title) @@ -52,18 +54,20 @@ static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title) if (metroBundlerPortStr && [metroBundlerPortStr length] > 0) { metroBundlerPort = [NSNumber numberWithInt:[metroBundlerPortStr intValue]]; } - NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; - NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; + NSString *escapedDeviceName = [[[UIDevice currentDevice] name] + stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; + NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] + stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/attach-debugger-nuclide?title=%@&device=%@&app=%@", - getServerHost(bundleURL, metroBundlerPort), - title, - escapedDeviceName, - escapedAppName]]; + getServerHost(bundleURL, metroBundlerPort), + title, + escapedDeviceName, + escapedAppName]]; } @implementation RCTInspectorDevServerHelper -RCT_NOT_IMPLEMENTED(- (instancetype)init) +RCT_NOT_IMPLEMENTED(-(instancetype)init) static NSMutableDictionary *socketConnections = nil; @@ -74,23 +78,18 @@ static void sendEventToAllConnections(NSString *event) } } -static void displayErrorAlert(UIViewController *view, NSString *message) { - UIAlertController *alert = - [UIAlertController alertControllerWithTitle:nil - message:message - preferredStyle:UIAlertControllerStyleAlert]; +static void displayErrorAlert(UIViewController *view, NSString *message) +{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil + message:message + preferredStyle:UIAlertControllerStyleAlert]; [view presentViewController:alert animated:YES completion:nil]; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5), - dispatch_get_main_queue(), - ^{ - [alert dismissViewControllerAnimated:YES completion:nil]; - }); + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5), dispatch_get_main_queue(), ^{ + [alert dismissViewControllerAnimated:YES completion:nil]; + }); } -+ (void)attachDebugger:(NSString *)owner - withBundleURL:(NSURL *)bundleURL - withView:(UIViewController *)view ++ (void)attachDebugger:(NSString *)owner withBundleURL:(NSURL *)bundleURL withView:(UIViewController *)view { NSURL *url = getAttachDeviceUrl(bundleURL, owner); @@ -98,15 +97,15 @@ static void displayErrorAlert(UIViewController *view, NSString *message) { [request setHTTPMethod:@"GET"]; __weak UIViewController *viewCapture = view; - [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler: - ^(__unused NSData *_Nullable data, - __unused NSURLResponse *_Nullable response, - NSError *_Nullable error) { - UIViewController *viewCaptureStrong = viewCapture; - if (error != nullptr && viewCaptureStrong != nullptr) { - displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro Bundler!"); - } - }] resume]; + [[[NSURLSession sharedSession] + dataTaskWithRequest:request + completionHandler:^( + __unused NSData *_Nullable data, __unused NSURLResponse *_Nullable response, NSError *_Nullable error) { + UIViewController *viewCaptureStrong = viewCapture; + if (error != nullptr && viewCaptureStrong != nullptr) { + displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro!"); + } + }] resume]; } + (void)disableDebugger diff --git a/scripts/launchPackager.bat b/scripts/launchPackager.bat index 83bfb8dc138..ce71959a16d 100644 --- a/scripts/launchPackager.bat +++ b/scripts/launchPackager.bat @@ -4,7 +4,7 @@ :: LICENSE file in the root directory of this source tree. @echo off -title Metro Bundler +title Metro call .packager.bat cd ../../../ node "%~dp0..\cli.js" start diff --git a/scripts/launchPackager.command b/scripts/launchPackager.command index 1c1278deb12..4a7748141bb 100755 --- a/scripts/launchPackager.command +++ b/scripts/launchPackager.command @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. # Set terminal title -echo -en "\\033]0;Metro Bundler\\a" +echo -en "\\033]0;Metro\\a" clear THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 8192eb94bc7..3cee6426783 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -12,7 +12,7 @@ set -x DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH -# Enables iOS devices to get the IP address of the machine running Metro Bundler +# Enables iOS devices to get the IP address of the machine running Metro if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then IP=$(ipconfig getifaddr en0) if [ -z "$IP" ]; then