forked from flutter/flutter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "Add support for Dart Development Service (DDS) in Flutter Too…
…ls (flutter#61276)" (flutter#61395) This reverts commit 5b9c6e2.
- Loading branch information
Showing
25 changed files
with
211 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:dds/dds.dart' as dds; | ||
import 'package:meta/meta.dart'; | ||
|
||
import 'io.dart' as io; | ||
import 'logger.dart'; | ||
|
||
/// Helper class to launch a [dds.DartDevelopmentService]. Allows for us to | ||
/// mock out this functionality for testing purposes. | ||
class DartDevelopmentService { | ||
DartDevelopmentService({@required this.logger}); | ||
|
||
final Logger logger; | ||
dds.DartDevelopmentService _ddsInstance; | ||
|
||
Future<void> startDartDevelopmentService( | ||
Uri observatoryUri, | ||
bool ipv6, | ||
) async { | ||
final Uri ddsUri = Uri( | ||
scheme: 'http', | ||
host: (ipv6 ? | ||
io.InternetAddress.loopbackIPv6 : | ||
io.InternetAddress.loopbackIPv4 | ||
).host, | ||
port: 0, | ||
); | ||
logger.printTrace( | ||
'Launching a Dart Developer Service (DDS) instance at $ddsUri, ' | ||
'connecting to VM service at $observatoryUri.', | ||
); | ||
try { | ||
_ddsInstance = await dds.DartDevelopmentService.startDartDevelopmentService( | ||
observatoryUri, | ||
serviceUri: ddsUri, | ||
); | ||
logger.printTrace('DDS is listening at ${_ddsInstance.uri}.'); | ||
} on dds.DartDevelopmentServiceException catch (e) { | ||
logger.printError('Warning: Failed to start DDS: ${e.message}'); | ||
} | ||
} | ||
|
||
Future<void> shutdown() async => await _ddsInstance?.shutdown(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.