Skip to content

Commit 9ae3714

Browse files
geof90facebook-github-bot-6
authored and
facebook-github-bot-6
committed
Create offline package if not running in "Debug" config
Summary:**Problem**: As seen in #5820, many devs are confused by the fact that the offline bundle is not generated when running against the simulator, even when running in the "Release" configuration which is supposed to mimic "production" scenarios. This pull request is a small change that fixes #5820 by updating the `react-native-xcode.sh` shell script to still generate the ofline bundle during Release configuration. It also updates `AppDelegate.m` to better document this behaviour in the comments so as to avoid any surprises. **Test plan**: This is a simple change, the two tests done were 1. In a new React Native project, verify that an offline build is not generated when running against the simulator in "Debug" configuration as per normal. 2. Change to a "Release" configuration via Product > Scheme > Edit Scheme in XCode, then verify that the project runs with the offline build generated. ![screen shot 2016-02 Closes #6119 Differential Revision: D2970755 Pulled By: javache fb-gh-sync-id: 64f658512869c73aa19286ca1e3dc6e31b5ac617 shipit-source-id: 64f658512869c73aa19286ca1e3dc6e31b5ac617
1 parent 11843fd commit 9ae3714

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

local-cli/generator-ios/templates/app/AppDelegate.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3636
/**
3737
* OPTION 2
3838
* Load from pre-bundled file on disk. The static bundle is automatically
39-
* generated by "Bundle React Native code and images" build step.
39+
* generated by the "Bundle React Native code and images" build step when
40+
* running the project on an actual device or running the project on the
41+
* simulator in the "Release" build configuration.
4042
*/
4143

4244
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

packager/react-native-xcode.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
# This script is supposed to be invoked as part of Xcode build process
1111
# and relies on environment variables (including PWD) set by Xcode
1212

13-
# There is no point in creating an offline package for simulator builds
14-
# because the packager is supposed to be running during development anyways
15-
if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
16-
echo "Skipping bundling for Simulator platform"
17-
exit 0;
18-
fi
19-
2013
case "$CONFIGURATION" in
2114
Debug)
15+
# Speed up build times by skipping the creation of the offline package for debug
16+
# builds on the simulator since the packager is supposed to be running anyways.
17+
if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
18+
echo "Skipping bundling for Simulator platform"
19+
exit 0;
20+
fi
21+
2222
DEV=true
2323
;;
2424
"")

0 commit comments

Comments
 (0)