From 8fd2d7d17caa4bc719583058f2e4113788fab7cb Mon Sep 17 00:00:00 2001 From: Bret Johnson Date: Wed, 24 Aug 2016 10:11:30 -0700 Subject: [PATCH] Added way to not launch packager during CI build, as it hangs CI builds Summary: Change & motivation: Added an environment variable, RCT_NO_LAUNCH_PACKAGER, that when set 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. Testing: I tested by building both with & without the environment variable defined, ensuring things work probably in both cases. I also added support to our VSTS build ask to use this and verified it works as expected too, when setting the variable.. Closes https://github.com/facebook/react-native/pull/6180 Differential Revision: D3764648 Pulled By: sahrens fbshipit-source-id: b41cc06152aec271bbfdb2bd52d4b83a5f9c09a7 --- 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 c986d4af301..540baea5cf6 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -698,7 +698,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;