Skip to content

Commit

Permalink
Move packager launcher scripts outside of packager/
Browse files Browse the repository at this point in the history
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.

Reviewed By: javache

Differential Revision: D5112193

fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
  • Loading branch information
davidaurelio authored and facebook-github-bot committed May 23, 2017
1 parent 674a642 commit a710f9a
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Note that you'll need the Android NDK installed, see [prerequisites](https://git
```bash
./gradlew :Examples:Movies:android:app:installDebug
# Start the packager in a separate shell (make sure you ran npm install):
./packager/packager.sh
./scripts/packager.sh
# Open the Movies app in your emulator
```

Expand Down
4 changes: 2 additions & 2 deletions RNTester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Start an Android emulator ([Genymotion](https://www.genymotion.com) is recommend

cd react-native
./gradlew :RNTester:android:app:installDebug
./packager/packager.sh
./scripts/packager.sh

_Note: Building for the first time can take a while._

Expand All @@ -46,7 +46,7 @@ Run the following commands from the react-native folder:
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
buck fetch rntester
buck install -r rntester
./packager/packager.sh
./scripts/packager.sh

_Note: The native libs are still built using gradle. Full build with buck is coming soon(tm)._

Expand Down
4 changes: 2 additions & 2 deletions RNTester/RNTester.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
};
68CD48B71D2BCB2C007E06A9 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -1453,7 +1453,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
4 changes: 2 additions & 2 deletions RNTester/RNTesterLegacy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
};
68CD48B71D2BCB2C007E06A9 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -1446,7 +1446,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
4 changes: 2 additions & 2 deletions React/React.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3335,7 +3335,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
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/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
showEnvVarsInLog = 0;
};
142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = {
Expand Down Expand Up @@ -3394,7 +3394,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
showEnvVarsInLog = 0;
};
3D383D3E1EBD27B9005632C8 /* Install Third Party */ = {
Expand Down
4 changes: 2 additions & 2 deletions React/ReactLegacy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
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/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
showEnvVarsInLog = 0;
};
142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = {
Expand Down Expand Up @@ -2443,7 +2443,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
4 changes: 2 additions & 2 deletions docs/IntegrationWithExistingApps.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ import React
<block class="objc" />

> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/packager/` to generate that pre-bundled file.
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/scripts/` to generate that pre-bundled file.
<block class="swift" />

> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `let mainBundle = NSBundle(URLForResource: "main" withExtension:"jsbundle")`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/packager/` to generate that pre-bundled file.
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `let mainBundle = NSBundle(URLForResource: "main" withExtension:"jsbundle")`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/scripts/` to generate that pre-bundled file.
<block class="objc swift" />

Expand Down
2 changes: 1 addition & 1 deletion local-cli/core/__fixtures__/files/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../node_modules/react-native/packager/react-native-xcode.sh";
shellScript = "../node_modules/react-native/scripts/react-native-xcode.sh";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion local-cli/link/__fixtures__/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
6 changes: 3 additions & 3 deletions local-cli/runAndroid/runAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ function startServerInNewWindow() {
const scriptFile = /^win/.test(process.platform) ?
'launchPackager.bat' :
'launchPackager.command';
const packagerDir = path.resolve(__dirname, '..', '..', 'packager');
const launchPackagerScript = path.resolve(packagerDir, scriptFile);
const procConfig = {cwd: packagerDir};
const scriptsDir = path.resolve(__dirname, '..', '..', 'scripts');
const launchPackagerScript = path.resolve(scriptsDir, scriptFile);
const procConfig = {cwd: scriptsDir};

if (process.platform === 'darwin') {
if (yargV.open) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -888,7 +888,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
"init.sh",
"scripts/ios-configure-glog.sh",
"scripts/ios-install-third-party.sh",
"scripts/launchPackager.bat",
"scripts/launchPackager.command",
"scripts/packager.sh",
"scripts/react-native-xcode.sh",
"jest-preset.json",
"jest",
"lib",
Expand All @@ -114,7 +118,7 @@
"test": "jest",
"flow": "flow",
"lint": "eslint RNTester/ Libraries/",
"start": "/usr/bin/env bash -c './packager/packager.sh \"$@\" || true' --",
"start": "/usr/bin/env bash -c './scripts/packager.sh \"$@\" || true' --",
"test-android-setup": "docker pull containership/android-base:latest",
"test-android-build": "docker build -t react/android -f ContainerShip/Dockerfile.android .",
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ echo -en "\033]0;React Packager\a"
clear

THIS_DIR=$(dirname "$0")
pushd "$THIS_DIR/.."
. packager/packager.sh
popd
. "$THIS_DIR/packager.sh"

echo "Process terminated. Press <enter> to close the window"
read
6 changes: 3 additions & 3 deletions scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ trap cleanup EXIT

if [ "$1" = "test" ]; then

# Start the packager
open "./packager/launchPackager.command" || echo "Can't start packager automatically"
# Start the packager
open "./scripts/launchPackager.command" || echo "Can't start packager automatically"
# Start the WebSocket test server
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"

Expand Down Expand Up @@ -73,6 +73,6 @@ xcodebuild \
-project "RNTester/RNTester.xcodeproj" \
-scheme $SCHEME \
-sdk $SDK \
build
build

fi
File renamed without changes.
File renamed without changes.

0 comments on commit a710f9a

Please sign in to comment.