Re-enable asar and unpack PortForwardingMacApp

Summary: Enabled asar packaging for Flipper resources, and set PortForwardingMacApp as unpacked from it, because it is launched as external app.

Reviewed By: passy

Differential Revision: D26006771

fbshipit-source-id: 91c8401a469a390144bf9867996a66d754ea90e6
This commit is contained in:
Anton Nikolaev
2021-01-22 08:19:26 -08:00
committed by Facebook GitHub Bot
parent ab31ad69e9
commit 8ce69975a5
2 changed files with 22 additions and 12 deletions

View File

@@ -18,9 +18,9 @@ import child_process from 'child_process';
const execFile = child_process.execFile; const execFile = child_process.execFile;
import iosUtil from '../utils/iOSContainerUtility'; import iosUtil from '../utils/iOSContainerUtility';
import IOSDevice from '../devices/IOSDevice'; import IOSDevice from '../devices/IOSDevice';
import isProduction from '../utils/isProduction';
import {registerDeviceCallbackOnPlugins} from '../utils/onRegisterDevice'; import {registerDeviceCallbackOnPlugins} from '../utils/onRegisterDevice';
import {addErrorNotification} from '../reducers/notifications'; import {addErrorNotification} from '../reducers/notifications';
import {getStaticPath} from '../utils/pathUtils';
type iOSSimulatorDevice = { type iOSSimulatorDevice = {
state: 'Booted' | 'Shutdown' | 'Shutting Down'; state: 'Booted' | 'Shutdown' | 'Shutting Down';
@@ -53,18 +53,27 @@ function isAvailable(simulator: iOSSimulatorDevice): boolean {
); );
} }
const portforwardingClient = isProduction() const portforwardingClient = path.join(
? path.resolve( getStaticPath(),
__dirname, 'PortForwardingMacApp.app/Contents/MacOS/PortForwardingMacApp',
'PortForwardingMacApp.app/Contents/MacOS/PortForwardingMacApp', );
)
: 'PortForwardingMacApp.app/Contents/MacOS/PortForwardingMacApp';
function forwardPort(port: number, multiplexChannelPort: number) { function forwardPort(port: number, multiplexChannelPort: number) {
return execFile(portforwardingClient, [ const childProcess = execFile(
`-portForward=${port}`, portforwardingClient,
`-multiplexChannelPort=${multiplexChannelPort}`, [`-portForward=${port}`, `-multiplexChannelPort=${multiplexChannelPort}`],
]); (err, stdout, stderr) => {
console.error('Port forwarding app failed to start', err, stdout, stderr);
},
);
console.log('Port forwarding app started', childProcess);
childProcess.addListener('error', (err) =>
console.error('Port forwarding app error', err),
);
childProcess.addListener('exit', (code) =>
console.log(`Port forwarding app exited with code ${code}`),
);
return childProcess;
} }
function startDevicePortForwarders(): void { function startDevicePortForwarders(): void {

View File

@@ -81,7 +81,8 @@
"publisherName": "Facebook, Inc.", "publisherName": "Facebook, Inc.",
"sign": null "sign": null
}, },
"asar": false, "asar": true,
"asarUnpack": ["PortForwardingMacApp.app/**/*"],
"fileAssociations": [ "fileAssociations": [
{ {
"ext": [ "ext": [