Permalink
Browse files

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 #6180

Differential Revision: D3764648

Pulled By: sahrens

fbshipit-source-id: b41cc06152aec271bbfdb2bd52d4b83a5f9c09a7
  • Loading branch information...
1 parent 228dcd1 commit 8fd2d7d17caa4bc719583058f2e4113788fab7cb @BretJohnson BretJohnson committed with Facebook Github Bot 6 Aug 24, 2016
Showing with 1 addition and 1 deletion.
  1. +1 −1 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;

0 comments on commit 8fd2d7d

Please sign in to comment.