Addressed some earlier diff comments
Summary: Async processed review feedback from stack D31474919 (cfd44b592a) e.o. (decapitate)
Reviewed By: passy
Differential Revision: D31608309
fbshipit-source-id: 536b3c9350f7acc40530000ecf5e46d5b074d50f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f307566318
commit
f43ff73591
@@ -10,7 +10,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {State, Store} from '../reducers/index';
|
import {State, Store} from '../reducers/index';
|
||||||
import {Logger} from 'flipper-common';
|
import {Logger} from 'flipper-common';
|
||||||
import {FlipperServerImpl, setFlipperServerConfig} from 'flipper-server-core';
|
import {FlipperServerImpl} from 'flipper-server-core';
|
||||||
import {selectClient} from '../reducers/connections';
|
import {selectClient} from '../reducers/connections';
|
||||||
import Client from '../Client';
|
import Client from '../Client';
|
||||||
import {notification} from 'antd';
|
import {notification} from 'antd';
|
||||||
@@ -24,7 +24,9 @@ import constants from '../fb-stubs/constants';
|
|||||||
export default async (store: Store, logger: Logger) => {
|
export default async (store: Store, logger: Logger) => {
|
||||||
const {enableAndroid, androidHome, idbPath, enableIOS, enablePhysicalIOS} =
|
const {enableAndroid, androidHome, idbPath, enableIOS, enablePhysicalIOS} =
|
||||||
store.getState().settingsState;
|
store.getState().settingsState;
|
||||||
setFlipperServerConfig({
|
|
||||||
|
const server = new FlipperServerImpl(
|
||||||
|
{
|
||||||
enableAndroid,
|
enableAndroid,
|
||||||
androidHome,
|
androidHome,
|
||||||
idbPath,
|
idbPath,
|
||||||
@@ -33,8 +35,9 @@ export default async (store: Store, logger: Logger) => {
|
|||||||
staticPath: getStaticPath(),
|
staticPath: getStaticPath(),
|
||||||
tmpPath: getAppTempPath(),
|
tmpPath: getAppTempPath(),
|
||||||
validWebSocketOrigins: constants.VALID_WEB_SOCKET_REQUEST_ORIGIN_PREFIXES,
|
validWebSocketOrigins: constants.VALID_WEB_SOCKET_REQUEST_ORIGIN_PREFIXES,
|
||||||
});
|
},
|
||||||
const server = new FlipperServerImpl(logger);
|
logger,
|
||||||
|
);
|
||||||
|
|
||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: 'SET_FLIPPER_SERVER',
|
type: 'SET_FLIPPER_SERVER',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import {FlipperServerImpl, setFlipperServerConfig} from 'flipper-server-core';
|
import {FlipperServerImpl} from 'flipper-server-core';
|
||||||
import {
|
import {
|
||||||
ClientDescription,
|
ClientDescription,
|
||||||
Logger,
|
Logger,
|
||||||
@@ -63,8 +63,11 @@ async function start(deviceTitle: string, appName: string, pluginId: string) {
|
|||||||
console.debug = () => {};
|
console.debug = () => {};
|
||||||
console.info = console.error;
|
console.info = console.error;
|
||||||
|
|
||||||
|
// TODO: initialise FB user manager to be able to do certificate exchange
|
||||||
|
|
||||||
|
const server = new FlipperServerImpl(
|
||||||
|
{
|
||||||
// TODO: make these better overridable
|
// TODO: make these better overridable
|
||||||
setFlipperServerConfig({
|
|
||||||
enableAndroid: true,
|
enableAndroid: true,
|
||||||
androidHome: process.env.ANDROID_HOME || '/opt/android_sdk',
|
androidHome: process.env.ANDROID_HOME || '/opt/android_sdk',
|
||||||
idbPath: '/usr/local/bin/idb',
|
idbPath: '/usr/local/bin/idb',
|
||||||
@@ -73,10 +76,9 @@ async function start(deviceTitle: string, appName: string, pluginId: string) {
|
|||||||
staticPath: path.resolve(__dirname, '..', '..', 'static'),
|
staticPath: path.resolve(__dirname, '..', '..', 'static'),
|
||||||
tmpPath: os.tmpdir(),
|
tmpPath: os.tmpdir(),
|
||||||
validWebSocketOrigins: [],
|
validWebSocketOrigins: [],
|
||||||
});
|
},
|
||||||
// TODO: initialise FB user manager to be able to do certificate exchange
|
logger,
|
||||||
|
);
|
||||||
const server = new FlipperServerImpl(logger);
|
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`Waiting for device '${deviceTitle}' client '${appName}' plugin '${pluginId}' ...`,
|
`Waiting for device '${deviceTitle}' client '${appName}' plugin '${pluginId}' ...`,
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ import {ServerDevice} from './devices/ServerDevice';
|
|||||||
import {Base64} from 'js-base64';
|
import {Base64} from 'js-base64';
|
||||||
import MetroDevice from './devices/metro/MetroDevice';
|
import MetroDevice from './devices/metro/MetroDevice';
|
||||||
import {launchEmulator} from './devices/android/AndroidDevice';
|
import {launchEmulator} from './devices/android/AndroidDevice';
|
||||||
import {getFlipperServerConfig} from './FlipperServerConfig';
|
import {
|
||||||
|
FlipperServerConfig,
|
||||||
|
setFlipperServerConfig,
|
||||||
|
} from './FlipperServerConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FlipperServer takes care of all incoming device & client connections.
|
* FlipperServer takes care of all incoming device & client connections.
|
||||||
@@ -49,8 +52,8 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
android: AndroidDeviceManager;
|
android: AndroidDeviceManager;
|
||||||
ios: IOSDeviceManager;
|
ios: IOSDeviceManager;
|
||||||
|
|
||||||
constructor(public logger: Logger) {
|
constructor(config: FlipperServerConfig, public logger: Logger) {
|
||||||
getFlipperServerConfig(); // Config should be available at this point!
|
setFlipperServerConfig(config);
|
||||||
const server = (this.server = new ServerController(this));
|
const server = (this.server = new ServerController(this));
|
||||||
this.android = new AndroidDeviceManager(this);
|
this.android = new AndroidDeviceManager(this);
|
||||||
this.ios = new IOSDeviceManager(this);
|
this.ios = new IOSDeviceManager(this);
|
||||||
@@ -89,7 +92,7 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
title: `Timed out establishing connection with "${client.appName}" on "${client.deviceName}".`,
|
title: `Timed out establishing connection with "${client.appName}" on "${client.deviceName}".`,
|
||||||
description:
|
description:
|
||||||
medium === 'WWW'
|
medium === 'WWW'
|
||||||
? `Verify that both your computer and mobile device are on Lighthouse/VPN that you are logged in to Facebook Intern so that certificates can be exhanged. See: https://www.internalfb.com/intern/wiki/Ops/Network/Enterprise_Network_Engineering/ene_wlra/VPN_Help/Vpn/mobile/`
|
? `Verify that both your computer and mobile device are on Lighthouse/VPN that you are logged in to Facebook Intern so that certificates can be exhanged. See: https://fburl.com/flippervpn`
|
||||||
: 'Verify that your client is connected to Flipper and that there is no error related to idb.',
|
: 'Verify that your client is connected to Flipper and that there is no error related to idb.',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {parseXcodeFromCoreSimPath} from '../iOSDeviceManager';
|
|||||||
import {getLogger} from 'flipper-common';
|
import {getLogger} from 'flipper-common';
|
||||||
import {IOSBridge} from '../IOSBridge';
|
import {IOSBridge} from '../IOSBridge';
|
||||||
import {FlipperServerImpl} from '../../../FlipperServerImpl';
|
import {FlipperServerImpl} from '../../../FlipperServerImpl';
|
||||||
|
import {getFlipperServerConfig} from '../../../FlipperServerConfig';
|
||||||
|
|
||||||
|
const testConfig = getFlipperServerConfig();
|
||||||
|
|
||||||
const standardCoresimulatorLog =
|
const standardCoresimulatorLog =
|
||||||
'username 1264 0.0 0.1 5989740 41648 ?? Ss 2:23PM 0:12.92 /Applications/Xcode_12.4.0_fb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/libexec/mobileassetd';
|
'username 1264 0.0 0.1 5989740 41648 ?? Ss 2:23PM 0:12.92 /Applications/Xcode_12.4.0_fb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/libexec/mobileassetd';
|
||||||
@@ -53,7 +56,7 @@ test('test parseXcodeFromCoreSimPath from standard locations', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test getAllPromisesForQueryingDevices when xcode detected', () => {
|
test('test getAllPromisesForQueryingDevices when xcode detected', () => {
|
||||||
const flipperServer = new FlipperServerImpl(getLogger());
|
const flipperServer = new FlipperServerImpl(testConfig, getLogger());
|
||||||
flipperServer.ios.iosBridge = {} as IOSBridge;
|
flipperServer.ios.iosBridge = {} as IOSBridge;
|
||||||
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
||||||
true,
|
true,
|
||||||
@@ -63,7 +66,7 @@ test('test getAllPromisesForQueryingDevices when xcode detected', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test getAllPromisesForQueryingDevices when xcode is not detected', () => {
|
test('test getAllPromisesForQueryingDevices when xcode is not detected', () => {
|
||||||
const flipperServer = new FlipperServerImpl(getLogger());
|
const flipperServer = new FlipperServerImpl(testConfig, getLogger());
|
||||||
flipperServer.ios.iosBridge = {} as IOSBridge;
|
flipperServer.ios.iosBridge = {} as IOSBridge;
|
||||||
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
||||||
false,
|
false,
|
||||||
@@ -73,7 +76,7 @@ test('test getAllPromisesForQueryingDevices when xcode is not detected', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test getAllPromisesForQueryingDevices when xcode and idb are both unavailable', () => {
|
test('test getAllPromisesForQueryingDevices when xcode and idb are both unavailable', () => {
|
||||||
const flipperServer = new FlipperServerImpl(getLogger());
|
const flipperServer = new FlipperServerImpl(testConfig, getLogger());
|
||||||
flipperServer.ios.iosBridge = {} as IOSBridge;
|
flipperServer.ios.iosBridge = {} as IOSBridge;
|
||||||
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
||||||
false,
|
false,
|
||||||
@@ -83,7 +86,7 @@ test('test getAllPromisesForQueryingDevices when xcode and idb are both unavaila
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test getAllPromisesForQueryingDevices when both idb and xcode are available', () => {
|
test('test getAllPromisesForQueryingDevices when both idb and xcode are available', () => {
|
||||||
const flipperServer = new FlipperServerImpl(getLogger());
|
const flipperServer = new FlipperServerImpl(testConfig, getLogger());
|
||||||
flipperServer.ios.iosBridge = {} as IOSBridge;
|
flipperServer.ios.iosBridge = {} as IOSBridge;
|
||||||
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
const promises = flipperServer.ios.getAllPromisesForQueryingDevices(
|
||||||
true,
|
true,
|
||||||
|
|||||||
@@ -7,10 +7,4 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {
|
|
||||||
FlipperServerConfig,
|
|
||||||
getFlipperServerConfig,
|
|
||||||
setFlipperServerConfig,
|
|
||||||
} from './FlipperServerConfig';
|
|
||||||
|
|
||||||
export {FlipperServerImpl} from './FlipperServerImpl';
|
export {FlipperServerImpl} from './FlipperServerImpl';
|
||||||
|
|||||||
Reference in New Issue
Block a user