mirror of
https://github.com/status-im/react-native.git
synced 2025-01-26 17:30:25 +00:00
add --port options to run-android, defaults to 8081
Summary: Closes https://github.com/facebook/react-native/pull/15316 Differential Revision: D5582599 Pulled By: javache fbshipit-source-id: 575e0540965792a25e6cc572cff103da2c65a262
This commit is contained in:
parent
66a788fd99
commit
898790d88a
@ -66,10 +66,10 @@ function getAdbPath() {
|
||||
}
|
||||
|
||||
// Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager
|
||||
function tryRunAdbReverse(device) {
|
||||
function tryRunAdbReverse(packagerPort, device) {
|
||||
try {
|
||||
const adbPath = getAdbPath();
|
||||
const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];
|
||||
const adbArgs = ['reverse', `tcp:${packagerPort}`, `tcp:${packagerPort}`];
|
||||
|
||||
// If a device is specified then tell adb to use it
|
||||
if (device) {
|
||||
@ -177,7 +177,7 @@ function tryLaunchAppOnDevice(device, packageNameWithSuffix, packageName, adbPat
|
||||
}
|
||||
|
||||
function installAndLaunchOnDevice(args, selectedDevice, packageNameWithSuffix, packageName, adbPath) {
|
||||
tryRunAdbReverse(selectedDevice);
|
||||
tryRunAdbReverse(args.port, selectedDevice);
|
||||
tryInstallAppOnDevice(args, selectedDevice);
|
||||
tryLaunchAppOnDevice(selectedDevice, packageNameWithSuffix, packageName, adbPath, args.mainActivity);
|
||||
}
|
||||
@ -226,7 +226,7 @@ function runOnAllDevices(args, cmd, packageNameWithSuffix, packageName, adbPath)
|
||||
const devices = adb.getDevices();
|
||||
if (devices && devices.length > 0) {
|
||||
devices.forEach((device) => {
|
||||
tryRunAdbReverse(device);
|
||||
tryRunAdbReverse(args.port, device);
|
||||
tryLaunchAppOnDevice(device, packageNameWithSuffix, packageName, adbPath, args.mainActivity);
|
||||
});
|
||||
} else {
|
||||
@ -317,5 +317,9 @@ module.exports = {
|
||||
}, {
|
||||
command: '--no-packager',
|
||||
description: 'Do not launch packager while building',
|
||||
}, {
|
||||
command: '--port [number]',
|
||||
default: 8081,
|
||||
parse: (val: string) => Number(val),
|
||||
}],
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user