Add support for Dart Development Service (DDS) in Flutter Tools (#59114)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:dds/dds.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:package_config/package_config.dart';
|
||||
import 'package:stream_channel/stream_channel.dart';
|
||||
@@ -514,7 +515,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
Uri processObservatoryUri;
|
||||
_pipeStandardStreamsToConsole(
|
||||
process,
|
||||
reportObservatoryUri: (Uri detectedUri) {
|
||||
reportObservatoryUri: (Uri detectedUri) async {
|
||||
assert(processObservatoryUri == null);
|
||||
assert(explicitObservatoryPort == null ||
|
||||
explicitObservatoryPort == detectedUri.port);
|
||||
@@ -527,13 +528,14 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
globals.printTrace('test $ourTestCount: using observatory uri $detectedUri from pid ${process.pid}');
|
||||
}
|
||||
processObservatoryUri = detectedUri;
|
||||
await DartDevelopmentService.startDartDevelopmentService(processObservatoryUri);
|
||||
{
|
||||
globals.printTrace('Connecting to service protocol: $processObservatoryUri');
|
||||
final Future<vm_service.VmService> localVmService = connectToVmService(processObservatoryUri,
|
||||
compileExpression: _compileExpressionService);
|
||||
localVmService.then((vm_service.VmService vmservice) {
|
||||
unawaited(localVmService.then((vm_service.VmService vmservice) {
|
||||
globals.printTrace('Successfully connected to service protocol: $processObservatoryUri');
|
||||
});
|
||||
}));
|
||||
}
|
||||
gotProcessObservatoryUri.complete();
|
||||
watcher?.handleStartedProcess(
|
||||
@@ -870,8 +872,9 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
void _pipeStandardStreamsToConsole(
|
||||
Process process, {
|
||||
void startTimeoutTimer(),
|
||||
void reportObservatoryUri(Uri uri),
|
||||
Future<void> reportObservatoryUri(Uri uri),
|
||||
}) {
|
||||
|
||||
const String observatoryString = 'Observatory listening on ';
|
||||
for (final Stream<List<int>> stream in <Stream<List<int>>>[
|
||||
process.stderr,
|
||||
@@ -881,7 +884,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen(
|
||||
(String line) {
|
||||
(String line) async {
|
||||
if (line == _kStartTimeoutTimerMessage) {
|
||||
if (startTimeoutTimer != null) {
|
||||
startTimeoutTimer();
|
||||
@@ -894,7 +897,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
try {
|
||||
final Uri uri = Uri.parse(line.substring(observatoryString.length));
|
||||
if (reportObservatoryUri != null) {
|
||||
reportObservatoryUri(uri);
|
||||
await reportObservatoryUri(uri);
|
||||
}
|
||||
} on Exception catch (error) {
|
||||
globals.printError('Could not parse shell observatory port message: $error');
|
||||
|
||||
Reference in New Issue
Block a user