Unverified Commit 10658266 authored by Lau Ching Jun's avatar Lau Ching Jun Committed by GitHub

ProxiedDevice, connection to a remotely connected device via flutter daemon. (#95738)

Also allow daemon commands to pass binary streams
parent 94d9b02d
......@@ -237,7 +237,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
final Daemon daemon = boolArg('machine')
? Daemon(
DaemonConnection(
daemonStreams: StdioDaemonStreams(globals.stdio),
daemonStreams: DaemonStreams.fromStdio(globals.stdio, logger: globals.logger),
logger: globals.logger,
),
notifyingLogger: (globals.logger is NotifyingLogger)
......
......@@ -559,7 +559,7 @@ class RunCommand extends RunCommandBase {
}
final Daemon daemon = Daemon(
DaemonConnection(
daemonStreams: StdioDaemonStreams(globals.stdio),
daemonStreams: DaemonStreams.fromStdio(globals.stdio, logger: globals.logger),
logger: globals.logger,
),
notifyingLogger: (globals.logger is NotifyingLogger)
......
This diff is collapsed.
......@@ -37,6 +37,18 @@ class Category {
@override
String toString() => value;
static Category? fromString(String category) {
switch (category) {
case 'web':
return web;
case 'desktop':
return desktop;
case 'mobile':
return mobile;
}
return null;
}
}
/// The platform sub-folder that a device type supports.
......@@ -56,6 +68,28 @@ class PlatformType {
@override
String toString() => value;
static PlatformType? fromString(String platformType) {
switch (platformType) {
case 'web':
return web;
case 'android':
return android;
case 'ios':
return ios;
case 'linux':
return linux;
case 'macos':
return macos;
case 'windows':
return windows;
case 'fuchsia':
return fuchsia;
case 'custom':
return custom;
}
return null;
}
}
/// A discovery mechanism for flutter-supported development devices.
......@@ -809,6 +843,47 @@ class DebuggingOptions {
nullAssertions = false,
nativeNullAssertions = false;
DebuggingOptions._({
required this.buildInfo,
required this.debuggingEnabled,
required this.startPaused,
required this.dartFlags,
required this.dartEntrypointArgs,
required this.disableServiceAuthCodes,
required this.enableDds,
required this.enableSoftwareRendering,
required this.skiaDeterministicRendering,
required this.traceSkia,
required this.traceAllowlist,
required this.traceSkiaAllowlist,
required this.traceSystrace,
required this.endlessTraceBuffer,
required this.dumpSkpOnShaderCompilation,
required this.cacheSkSL,
required this.purgePersistentCache,
required this.useTestFonts,
required this.verboseSystemLogs,
required this.hostVmServicePort,
required this.deviceVmServicePort,
required this.disablePortPublication,
required this.ddsPort,
required this.devToolsServerAddress,
required this.port,
required this.hostname,
required this.webEnableExposeUrl,
required this.webUseSseForDebugProxy,
required this.webUseSseForDebugBackend,
required this.webUseSseForInjectedClient,
required this.webRunHeadless,
required this.webBrowserDebugPort,
required this.webEnableExpressionEvaluation,
required this.webLaunchUrl,
required this.vmserviceOutFile,
required this.fastStart,
required this.nullAssertions,
required this.nativeNullAssertions,
});
final bool debuggingEnabled;
final BuildInfo buildInfo;
......@@ -870,6 +945,88 @@ class DebuggingOptions {
final bool nativeNullAssertions;
bool get hasObservatoryPort => hostVmServicePort != null;
Map<String, Object?> toJson() => <String, Object?>{
'debuggingEnabled': debuggingEnabled,
'startPaused': startPaused,
'dartFlags': dartFlags,
'dartEntrypointArgs': dartEntrypointArgs,
'disableServiceAuthCodes': disableServiceAuthCodes,
'enableDds': enableDds,
'enableSoftwareRendering': enableSoftwareRendering,
'skiaDeterministicRendering': skiaDeterministicRendering,
'traceSkia': traceSkia,
'traceAllowlist': traceAllowlist,
'traceSkiaAllowlist': traceSkiaAllowlist,
'traceSystrace': traceSystrace,
'endlessTraceBuffer': endlessTraceBuffer,
'dumpSkpOnShaderCompilation': dumpSkpOnShaderCompilation,
'cacheSkSL': cacheSkSL,
'purgePersistentCache': purgePersistentCache,
'useTestFonts': useTestFonts,
'verboseSystemLogs': verboseSystemLogs,
'hostVmServicePort': hostVmServicePort,
'deviceVmServicePort': deviceVmServicePort,
'disablePortPublication': disablePortPublication,
'ddsPort': ddsPort,
'devToolsServerAddress': devToolsServerAddress.toString(),
'port': port,
'hostname': hostname,
'webEnableExposeUrl': webEnableExposeUrl,
'webUseSseForDebugProxy': webUseSseForDebugProxy,
'webUseSseForDebugBackend': webUseSseForDebugBackend,
'webUseSseForInjectedClient': webUseSseForInjectedClient,
'webRunHeadless': webRunHeadless,
'webBrowserDebugPort': webBrowserDebugPort,
'webEnableExpressionEvaluation': webEnableExpressionEvaluation,
'webLaunchUrl': webLaunchUrl,
'vmserviceOutFile': vmserviceOutFile,
'fastStart': fastStart,
'nullAssertions': nullAssertions,
'nativeNullAssertions': nativeNullAssertions,
};
static DebuggingOptions fromJson(Map<String, Object?> json, BuildInfo buildInfo) =>
DebuggingOptions._(
buildInfo: buildInfo,
debuggingEnabled: (json['debuggingEnabled'] as bool?)!,
startPaused: (json['startPaused'] as bool?)!,
dartFlags: (json['dartFlags'] as String?)!,
dartEntrypointArgs: ((json['dartEntrypointArgs'] as List<String>?)?.cast<String>())!,
disableServiceAuthCodes: (json['disableServiceAuthCodes'] as bool?)!,
enableDds: (json['enableDds'] as bool?)!,
enableSoftwareRendering: (json['enableSoftwareRendering'] as bool?)!,
skiaDeterministicRendering: (json['skiaDeterministicRendering'] as bool?)!,
traceSkia: (json['traceSkia'] as bool?)!,
traceAllowlist: json['traceAllowlist'] as String?,
traceSkiaAllowlist: json['traceSkiaAllowlist'] as String?,
traceSystrace: (json['traceSystrace'] as bool?)!,
endlessTraceBuffer: (json['endlessTraceBuffer'] as bool?)!,
dumpSkpOnShaderCompilation: (json['dumpSkpOnShaderCompilation'] as bool?)!,
cacheSkSL: (json['cacheSkSL'] as bool?)!,
purgePersistentCache: (json['purgePersistentCache'] as bool?)!,
useTestFonts: (json['useTestFonts'] as bool?)!,
verboseSystemLogs: (json['verboseSystemLogs'] as bool?)!,
hostVmServicePort: json['hostVmServicePort'] as int? ,
deviceVmServicePort: json['deviceVmServicePort'] as int?,
disablePortPublication: (json['disablePortPublication'] as bool?)!,
ddsPort: json['ddsPort'] as int?,
devToolsServerAddress: json['devToolsServerAddress'] != null ? Uri.parse(json['devToolsServerAddress']! as String) : null,
port: json['port'] as String?,
hostname: json['hostname'] as String?,
webEnableExposeUrl: json['webEnableExposeUrl'] as bool?,
webUseSseForDebugProxy: (json['webUseSseForDebugProxy'] as bool?)!,
webUseSseForDebugBackend: (json['webUseSseForDebugBackend'] as bool?)!,
webUseSseForInjectedClient: (json['webUseSseForInjectedClient'] as bool?)!,
webRunHeadless: (json['webRunHeadless'] as bool?)!,
webBrowserDebugPort: json['webBrowserDebugPort'] as int?,
webEnableExpressionEvaluation: (json['webEnableExpressionEvaluation'] as bool?)!,
webLaunchUrl: json['webLaunchUrl'] as String?,
vmserviceOutFile: json['vmserviceOutFile'] as String?,
fastStart: (json['fastStart'] as bool?)!,
nullAssertions: (json['nullAssertions'] as bool?)!,
nativeNullAssertions: (json['nativeNullAssertions'] as bool?)!,
);
}
class LaunchResult {
......
This diff is collapsed.
......@@ -168,6 +168,14 @@ class FakePollingDeviceDiscovery extends PollingDeviceDiscovery {
devices.forEach(addDevice);
}
bool discoverDevicesCalled = false;
@override
Future<List<Device>> discoverDevices({Duration? timeout}) {
discoverDevicesCalled = true;
return super.discoverDevices(timeout: timeout);
}
@override
Stream<Device> get onAdded => _onAddedController.stream;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment