Initialise flipper-ui-browser with socket connection
Summary: This diff sets up the socket connection between flipper-browser and flipper-server, and verifies that the initial UI initialisation work (e.g. `get-config` command works). The initial RenderHost is initialised as well based on the config and browser APIs. Note that flipper-ui-core itself isn't started yet, as that has still a plethora of node imports, so Metro will correctly refuse to bundle Not in this diff * remove Node usage from flipper-ui-core * implement all RenderHost APIs Reviewed By: aigoncharov Differential Revision: D32644074 fbshipit-source-id: 2c8065caf0191771a3867b69a431ca50eeb7a5a3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
29a907c733
commit
5d45bd741b
@@ -26,7 +26,13 @@ import {
|
||||
loadSettings,
|
||||
setupPrefetcher,
|
||||
} from 'flipper-server-core';
|
||||
import {getLogger, isTest, Logger, setLoggerInstance} from 'flipper-common';
|
||||
import {
|
||||
getLogger,
|
||||
isTest,
|
||||
Logger,
|
||||
setLoggerInstance,
|
||||
Settings,
|
||||
} from 'flipper-common';
|
||||
import constants from './fb-stubs/constants';
|
||||
import {initializeElectron} from './electron/initializeElectron';
|
||||
import path from 'path';
|
||||
@@ -99,6 +105,8 @@ async function start() {
|
||||
|
||||
initializeElectron(flipperServer, flipperServerConfig);
|
||||
|
||||
setProcessState(flipperServerConfig.settings);
|
||||
|
||||
// By turning this in a require, we force the JS that the body of this module (init) has completed (initializeElectron),
|
||||
// before starting the rest of the Flipper process.
|
||||
// This prevent issues where the render host is referred at module initialisation level,
|
||||
@@ -185,3 +193,21 @@ function createDelegatedLogger(): Logger {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function setProcessState(settings: Settings) {
|
||||
const androidHome = settings.androidHome;
|
||||
const idbPath = settings.idbPath;
|
||||
|
||||
if (!process.env.ANDROID_HOME && !process.env.ANDROID_SDK_ROOT) {
|
||||
process.env.ANDROID_HOME = androidHome;
|
||||
}
|
||||
|
||||
// emulator/emulator is more reliable than tools/emulator, so prefer it if
|
||||
// it exists
|
||||
process.env.PATH =
|
||||
['emulator', 'tools', 'platform-tools']
|
||||
.map((directory) => path.resolve(androidHome, directory))
|
||||
.join(':') +
|
||||
`:${idbPath}` +
|
||||
`:${process.env.PATH}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user