From ea7b2ef36b1a0b141c4b64d0ab5d6d3a94be14a4 Mon Sep 17 00:00:00 2001 From: Alexander Jarvis Date: Sun, 21 Aug 2016 11:25:59 -0700 Subject: [PATCH] Check bundle file exists for release builds Summary: Motivation: While testing the RC, the bundle step failed (because the reset-cache true flag was still present) for an Archive build causing an app to be distributed without the JS bundle. This was obviously not great because the app just crashed on startup. This fix just checks that the bundle file is present and if not fails the build, as you would expect it to. Closes https://github.com/facebook/react-native/pull/9284 Differential Revision: D3749572 fbshipit-source-id: f1ccb8b6cd0b78f6d8267e7b4b0f10b4a3cec5a1 --- packager/react-native-xcode.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packager/react-native-xcode.sh b/packager/react-native-xcode.sh index 07be8fe12..ec4e0d14d 100755 --- a/packager/react-native-xcode.sh +++ b/packager/react-native-xcode.sh @@ -80,10 +80,18 @@ if [[ "$CONFIGURATION" = "Debug" && "$PLATFORM_NAME" != "iphonesimulator" ]]; th echo "$IP.xip.io" > "$DEST/ip.txt" fi +BUNDLE_FILE="$DEST/main.jsbundle" + $NODE_BINARY "$REACT_NATIVE_DIR/local-cli/cli.js" bundle \ --entry-file "$ENTRY_FILE" \ --platform ios \ --dev $DEV \ --reset-cache \ - --bundle-output "$DEST/main.jsbundle" \ + --bundle-output "$BUNDLE_FILE" \ --assets-dest "$DEST" + +if [[ ! $DEV && ! -f "$BUNDLE_FILE" ]]; then + echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2 + echo "React Native, please report it here: https://github.com/facebook/react-native/issues" + exit 2 +fi