From 5fa51e665f70e094921747339f55fcd2bebaa249 Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Mon, 10 Oct 2022 01:26:29 -0700 Subject: [PATCH] introduce SKIP_BUNDLING_METRO_IP to skip ip.txt generation (#31829) Summary: ios debug archiving build will generate ip.txt that will leak metro server address for other people testing. moreover, it will slow down launch time for metro server availability to wrong address. this pr introduce `SKIP_BUNDLING_METRO_IP` to prevent ip.txt generation. ## Changelog [Internal] [iOS] [Changed] - introduce SKIP_BUNDLING_METRO_IP to skip ip.txt generation Pull Request resolved: https://github.com/facebook/react-native/pull/31829 Test Plan: ### Classic build will generate ip.txt ```sh xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphoneos -destination 'generic/platform=iOS' find $HOME/Library/Developer/Xcode/DerivedData/RNTesterPods-* -name 'ip.txt' ``` this will find the ip.txt ### Specify `SKIP_BUNDLING_METRO_IP=1` will not generate ip.txt ```sh SKIP_BUNDLING_METRO_IP=1 xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphoneos -destination 'generic/platform=iOS' find $HOME/Library/Developer/Xcode/DerivedData/RNTesterPods-* -name 'ip.txt' ``` this will NOT find the ip.txt Reviewed By: hramos Differential Revision: D40095785 Pulled By: hramos fbshipit-source-id: 0c913f078e683879e07e9ce3306e899d631206b2 --- scripts/react-native-xcode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 92c7e244912d01..30a5ac2227afa4 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -13,7 +13,7 @@ set -x DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH # Enables iOS devices to get the IP address of the machine running Metro -if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then +if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then for num in 0 1 2 3 4 5 6 7 8; do IP=$(ipconfig getifaddr en${num}) if [ ! -z "$IP" ]; then