Launch DDS using DartDevelopmentServiceLauncher (#154015)

`DartDevelopmentServiceLauncher` was created to share the DDS launch
logic from flutter_tools with other Dart tooling.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
This commit is contained in:
Ben Konyi
2024-08-29 16:16:27 -04:00
committed by GitHub
parent 055350f84a
commit 04595bc088
5 changed files with 104 additions and 245 deletions

View File

@@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:io' as io show IOSink, ProcessSignal, Stdout, StdoutException;
import 'package:dds/dds_launcher.dart';
import 'package:flutter_tools/src/android/android_sdk.dart';
import 'package:flutter_tools/src/android/android_studio.dart';
import 'package:flutter_tools/src/android/java.dart';
@@ -696,6 +697,32 @@ class FakeJava extends Fake implements Java {
}
}
class FakeDartDevelopmentServiceLauncher extends Fake
implements DartDevelopmentServiceLauncher {
FakeDartDevelopmentServiceLauncher({
required this.uri,
this.devToolsUri,
this.dtdUri,
});
@override
final Uri uri;
@override
final Uri? devToolsUri;
@override
final Uri? dtdUri;
@override
Future<void> get done => _completer.future;
@override
Future<void> shutdown() async => _completer.complete();
final Completer<void> _completer = Completer<void>();
}
class FakeDevtoolsLauncher extends Fake implements DevtoolsLauncher {
FakeDevtoolsLauncher({DevToolsServerAddress? serverAddress})
: _serverAddress = serverAddress;