get adb config from env vars

Summary:
REact adb config from env vars:
- `ADB_SERVER_SOCKET`
- `ANDROID_ADB_SERVER_PORT`

Reviewed By: lawrencelomax

Differential Revision: D14002603

fbshipit-source-id: e30fa4354ab15048d4350654979fd0b6f394cd89
This commit is contained in:
Daniel Büchele
2019-02-11 02:48:14 -08:00
committed by Facebook Github Bot
parent 3c35d6d4cf
commit 6431d374c2
4 changed files with 75 additions and 9 deletions

View File

@@ -14,6 +14,7 @@ import type BaseDevice from '../devices/BaseDevice';
import type Logger from '../fb-stubs/Logger.js';
import {registerDeviceCallbackOnPlugins} from '../utils/onRegisterDevice.js';
import {reportPlatformFailures} from '../utils/metrics';
import adbConfig from '../utils/adbConfig';
const adb = require('adbkit-fb');
function createDevice(
@@ -79,11 +80,7 @@ export default (store: Store, logger: Logger) => {
);
}
})
.then(() =>
adb.createClient({
port: process.env.ANDROID_ADB_SERVER_PORT || '5037',
}),
),
.then(() => adb.createClient(adbConfig())),
'createADBClient.shell',
).catch(err => {
console.error(
@@ -92,7 +89,7 @@ export default (store: Store, logger: Logger) => {
/* In the event that starting adb with the above method fails, fallback
to using adbkit, though its known to be unreliable. */
const unsafeClient = adb.createClient();
const unsafeClient = adb.createClient(adbConfig());
return reportPlatformFailures(
promiseRetry(
(retry, number) => {