From 2625e8e10af05eaeffe3780efd459e38739ef8af Mon Sep 17 00:00:00 2001 From: Bret Johnson Date: Fri, 26 Feb 2016 21:10:39 -0500 Subject: [PATCH] Added an environment variable, RCT_NO_LAUNCH_PACKAGER, that when set makes Xcode not the launch the packager when building. This switch is needed for CI builds, where launching the packager, which stays running, causes the build to hang; port conflicts can be an issue as well. Really the packager is only appropriate for interactive developer builds. This is a problem for Visual Studio Team Services where we just added React Native CI build support with a React Native build extension and surely a problem for all CI systems. This fix is simple, and now if the build machine sets RCT_NO_LAUNCH_PACKAGER globally or passes it as an arg to xcodebuild, the packager won't launch and all is well. --- React/React.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index 30a1710b4a48a4..3884795bb2aef8 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -634,7 +634,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\nelse\n open \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi"; + shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi"; }; 142C4F7F1B582EA6001F0B58 /* ShellScript */ = { isa = PBXShellScriptBuildPhase;