From dd517faed169686142d161ddb07d9c49362b47b0 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Mon, 26 Jun 2017 12:47:37 -0700 Subject: [PATCH 1/3] Skip creation of offline package even on real phone Anything running in Debug should use the packager; no need to bundle. This saves a huge amount of time during development. The code being modified was originally introduced in https://github.com/facebook/react-native/commit/9ae3714f4bebdd2bcab4d7fdbf23acebdc5ed2ba to speed up builds on the simulator, but the change can be applied to real devices, too. --- scripts/react-native-xcode.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index fd563fc293fbb6..8bf8caaf4219b3 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -12,14 +12,9 @@ case "$CONFIGURATION" in *Debug*) - # Speed up build times by skipping the creation of the offline package for debug - # builds on the simulator since the packager is supposed to be running anyways. - if [[ "$PLATFORM_NAME" == *simulator ]]; then - echo "Skipping bundling for Simulator platform" - exit 0; - fi - - DEV=true + # Speed up build times by skipping the creation of the offline package. + echo "Skipping bundling for Debug (since the packager is supposed to be running)" + exit 0; ;; "") echo "$0 must be invoked by Xcode" From a46ac603ddb9f14b6d208399c2049f7e768a8afb Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Sun, 16 Jul 2017 17:13:07 -0700 Subject: [PATCH 2/3] Accept SKIP_BUNDLING and FORCE_BUNDLING flags during build e.g. ``` export SKIP_BUNDLING=true ../node_modules/react-native/packager/react-native-xcode.sh ``` --- scripts/react-native-xcode.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 8bf8caaf4219b3..073d240aa1a50a 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -10,11 +10,21 @@ # This script is supposed to be invoked as part of Xcode build process # and relies on environment variables (including PWD) set by Xcode +if [[ "$SKIP_BUNDLING" ]]; then + echo "SKIP_BUNDLING enabled; skipping." + exit 0; +fi + case "$CONFIGURATION" in *Debug*) - # Speed up build times by skipping the creation of the offline package. - echo "Skipping bundling for Debug (since the packager is supposed to be running)" - exit 0; + if [[ "$FORCE_BUNDLING" ]]; then + echo "FORCE_BUNDLING enabled; bundling even in Debug." + else + echo "Skipping bundling in Debug (since the packager bundles for you). Use the FORCE_BUNDLING flag if you want to change this behavior." + exit 0; + fi + + DEV=true ;; "") echo "$0 must be invoked by Xcode" From 5250fe81a25d394d543bd334586fafbfe7fc0c8b Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Tue, 18 Jul 2017 10:21:17 -0700 Subject: [PATCH 3/3] Bundle by default on physical devices (original behavior) --- scripts/react-native-xcode.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 073d240aa1a50a..be9c75c58b1f22 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -17,11 +17,15 @@ fi case "$CONFIGURATION" in *Debug*) - if [[ "$FORCE_BUNDLING" ]]; then - echo "FORCE_BUNDLING enabled; bundling even in Debug." + if [[ "$PLATFORM_NAME" == *simulator ]]; then + if [[ "$FORCE_BUNDLING" ]]; then + echo "FORCE_BUNDLING enabled; continuing to bundle." + else + echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior." + exit 0; + fi else - echo "Skipping bundling in Debug (since the packager bundles for you). Use the FORCE_BUNDLING flag if you want to change this behavior." - exit 0; + echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior." fi DEV=true