Roll dart e182eac158cf..9bc7d4604277 (flutter/engine#22332)

This commit is contained in:
Kaushik Iska
2020-11-05 17:59:02 -06:00
committed by GitHub
parent c8d04697db
commit b2bcc689b7
5 changed files with 65 additions and 58 deletions

6
DEPS
View File

@@ -34,7 +34,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': 'e182eac158cfc108c40c078616c3a5b874c581ca',
'dart_revision': '9bc7d4604277dd545a7d902a3d81bffe7021df00',
# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -298,7 +298,7 @@ deps = {
Var('dart_git') + '/source_maps.git@53eb92ccfe6e64924054f83038a534b959b12b3e',
'src/third_party/dart/third_party/pkg/source_span':
Var('dart_git') + '/source_span.git@cc7c4288a83f71ecef3414199947b52a8c112c65',
Var('dart_git') + '/source_span.git@49ff31eabebed0da0ae6634124f8ba5c6fbf57f1',
'src/third_party/dart/third_party/pkg/sse':
Var('dart_git') + '/sse.git' + '@' + Var('dart_sse_tag'),
@@ -349,7 +349,7 @@ deps = {
Var('dart_git') + '/package_config.git@9c586d04bd26fef01215fd10e7ab96a3050cfa64',
'src/third_party/dart/tools/sdks':
{'packages': [{'version': 'version:2.11.0-190.0.dev', 'package': 'dart/dart-sdk/${{platform}}'}], 'dep_type': 'cipd'},
{'packages': [{'version': 'version:2.12.0-0.0.dev', 'package': 'dart/dart-sdk/${{platform}}'}], 'dep_type': 'cipd'},
# WARNING: end of dart dependencies list that is cleaned up automatically - see create_updated_flutter_deps.py.

View File

@@ -12,10 +12,12 @@ class ShellProcess {
final Completer<Uri> _observatoryUriCompleter = Completer<Uri>();
final Process _process;
ShellProcess(this._process) : assert(_process != null) {
ShellProcess(this._process) {
// Scan stdout and scrape the Observatory Uri.
_process.stdout.transform(utf8.decoder)
.transform(const LineSplitter()).listen((String line) {
_process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen((String line) {
const String observatoryUriPrefix = 'Observatory listening on ';
if (line.startsWith(observatoryUriPrefix)) {
print(line);
@@ -26,9 +28,6 @@ class ShellProcess {
}
Future<bool> kill() async {
if (_process == null) {
return false;
}
return _process.kill();
}
@@ -48,17 +47,15 @@ class ShellLauncher {
final String mainDartPath;
final bool startPaused;
ShellLauncher(this.shellExecutablePath,
this.mainDartPath,
this.startPaused,
List<String> extraArgs) {
ShellLauncher(this.shellExecutablePath, this.mainDartPath, this.startPaused,
List<String> extraArgs) {
if (extraArgs is List) {
args.addAll(extraArgs);
}
args.add(mainDartPath);
}
Future<ShellProcess> launch() async {
Future<ShellProcess?> launch() async {
try {
final List<String> shellArguments = <String>[];
if (startPaused) {
@@ -66,11 +63,12 @@ class ShellLauncher {
}
shellArguments.addAll(args);
print('Launching $shellExecutablePath $shellArguments');
final Process process = await Process.start(shellExecutablePath, shellArguments);
final Process process =
await Process.start(shellExecutablePath, shellArguments);
return ShellProcess(process);
} catch (e) {
print('Error launching shell: $e');
return null;
}
return null;
}
}

View File

@@ -8,20 +8,22 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
class ServiceClient {
Completer<dynamic> isolateStartedId;
Completer<dynamic> isolatePausedId;
Completer<dynamic> isolateResumeId;
Completer<dynamic>? isolateStartedId;
Completer<dynamic>? isolatePausedId;
Completer<dynamic>? isolateResumeId;
ServiceClient(this.client, {this.isolateStartedId, this.isolatePausedId,
this.isolateResumeId}) {
client.listen(_onData,
onError: _onError,
cancelOnError: true);
ServiceClient(
this.client, {
this.isolateStartedId,
this.isolatePausedId,
this.isolateResumeId,
}) {
client.listen(_onData, onError: _onError, cancelOnError: true);
}
Future<Map<String, dynamic>> invokeRPC(String method, [Map<String, dynamic> params]) async {
Future<Map<String, dynamic>> invokeRPC(String method,
[Map<String, dynamic>? params]) async {
final String key = _createKey();
final String request = json.encode(<String, dynamic>{
'jsonrpc': '2.0',
@@ -30,7 +32,8 @@ class ServiceClient {
'id': key,
});
client.add(request);
final Completer<Map<String, dynamic>> completer = Completer<Map<String, dynamic>>();
final Completer<Map<String, dynamic>> completer =
Completer<Map<String, dynamic>>();
_outstandingRequests[key] = completer;
print('-> $key ($method)');
return completer.future;
@@ -43,7 +46,8 @@ class ServiceClient {
}
void _onData(dynamic message) {
final Map<String, dynamic> response = json.decode(message);
final Map<String, dynamic> response =
json.decode(message as String) as Map<String, dynamic>;
final dynamic key = response['id'];
if (key != null) {
print('<- $key');
@@ -60,16 +64,17 @@ class ServiceClient {
}
} else {
if (response['method'] == 'streamNotify') {
_onServiceEvent(response['params']);
_onServiceEvent(response['params'] as Map<String, dynamic>?);
}
}
}
void _onServiceEvent(Map<String, dynamic> params) {
void _onServiceEvent(Map<String, dynamic>? params) {
if (params == null) {
return;
}
final Map<String, dynamic> event = params['event'];
final Map<String, dynamic>? event =
params['event'] as Map<String, dynamic>?;
if (event == null || event['type'] != 'Event') {
return;
}
@@ -98,6 +103,7 @@ class ServiceClient {
}
final WebSocket client;
final Map<String, Completer<dynamic>> _outstandingRequests = <String, Completer<dynamic>>{};
final Map<String, Completer<dynamic>> _outstandingRequests =
<String, Completer<dynamic>>{};
int _id = 1;
}

View File

@@ -63,7 +63,8 @@ Future<Null> testHttpProtocolRequest(Uri uri) async {
final HttpClientRequest request = await client.getUrl(uri);
final HttpClientResponse response = await request.close();
Expect.equals(response.statusCode, 200);
final Map<String, dynamic> responseAsMap = json.decode(await readResponse(response));
final Map<String, dynamic> responseAsMap =
json.decode(await readResponse(response)) as Map<String, dynamic>;
Expect.equals(responseAsMap['jsonrpc'], '2.0');
client.close();
}
@@ -80,7 +81,7 @@ Future<Null> testWebSocketProtocolRequest(Uri uri) async {
Expect.notExecuted();
} catch (e) {
// Method not found.
Expect.equals(e['code'], -32601);
Expect.equals((e as Map<String, dynamic>)['code'], -32601);
}
}
@@ -105,22 +106,26 @@ Future<Null> testStartPaused(Uri uri) async {
isolateStartedId: isolateStartedId,
isolatePausedId: isolatePausedId,
isolateResumeId: isolateResumeId);
await serviceClient.invokeRPC('streamListen', <String, String>{ 'streamId': 'Isolate'});
await serviceClient.invokeRPC('streamListen', <String, String>{ 'streamId': 'Debug'});
await serviceClient
.invokeRPC('streamListen', <String, String>{'streamId': 'Isolate'});
await serviceClient
.invokeRPC('streamListen', <String, String>{'streamId': 'Debug'});
final Map<String, dynamic> response = await serviceClient.invokeRPC('getVM');
Expect.equals(response['type'], 'VM');
String isolateId;
if (response['isolates'].length > 0) {
isolateId = response['isolates'][0]['id'];
final List<dynamic> isolates = response['isolates'] as List<dynamic>;
if (isolates.isNotEmpty) {
isolateId = (isolates[0] as Map<String, String>)['id']!;
} else {
// Wait until isolate starts.
isolateId = await isolateStartedId.future;
isolateId = await isolateStartedId.future as String;
}
// Grab the isolate.
Map<String, dynamic> isolate = await serviceClient.invokeRPC('getIsolate', <String, String>{
'isolateId': isolateId,
Map<String, dynamic> isolate =
await serviceClient.invokeRPC('getIsolate', <String, String>{
'isolateId': isolateId,
});
Expect.equals(isolate['type'], 'Isolate');
Expect.isNotNull(isolate['pauseEvent']);
@@ -130,7 +135,7 @@ Future<Null> testStartPaused(Uri uri) async {
isolate = await serviceClient.invokeRPC('getIsolate', <String, String>{
'isolateId': isolateId,
});
}
}
// Verify that it is paused at start.
Expect.equals(isolate['pauseEvent']['kind'], 'PauseStart');
@@ -140,8 +145,8 @@ Future<Null> testStartPaused(Uri uri) async {
});
// Wait until the isolate has resumed.
await isolateResumeId.future;
final Map<String, dynamic> resumedResponse = await serviceClient.invokeRPC(
'getIsolate', <String, String>{'isolateId': isolateId});
final Map<String, dynamic> resumedResponse = await serviceClient
.invokeRPC('getIsolate', <String, String>{'isolateId': isolateId});
Expect.equals(resumedResponse['type'], 'Isolate');
Expect.isNotNull(resumedResponse['pauseEvent']);
Expect.equals(resumedResponse['pauseEvent']['kind'], 'Resume');
@@ -161,11 +166,14 @@ final List<TestFunction> startPausedTests = <TestFunction>[
];
Future<bool> runTests(ShellLauncher launcher, List<TestFunction> tests) async {
final ShellProcess process = await launcher.launch();
final ShellProcess? process = await launcher.launch();
if (process == null) {
return false;
}
final Uri uri = await process.waitForObservatory();
try {
for (int i = 0; i < tests.length; i++) {
print('Executing test ${i+1}/${tests.length}');
print('Executing test ${i + 1}/${tests.length}');
await tests[i](uri);
}
} catch (e) {
@@ -179,24 +187,19 @@ Future<bool> runTests(ShellLauncher launcher, List<TestFunction> tests) async {
Future<Null> main(List<String> args) async {
if (args.length < 2) {
print('Usage: dart ${Platform.script} '
'<sky_shell_executable> <main_dart> ...');
'<sky_shell_executable> <main_dart> ...');
return;
}
final String shellExecutablePath = args[0];
final String mainDartPath = args[1];
final List<String> extraArgs = args.length <= 2 ? <String>[] : args.sublist(2);
final List<String> extraArgs =
args.length <= 2 ? <String>[] : args.sublist(2);
final ShellLauncher launcher =
ShellLauncher(shellExecutablePath,
mainDartPath,
false,
extraArgs);
ShellLauncher(shellExecutablePath, mainDartPath, false, extraArgs);
final ShellLauncher startPausedlauncher =
ShellLauncher(shellExecutablePath,
mainDartPath,
true,
extraArgs);
ShellLauncher(shellExecutablePath, mainDartPath, true, extraArgs);
await runTests(launcher, basicTests);
await runTests(startPausedlauncher, startPausedTests);

View File

@@ -102,7 +102,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
if (argResults['html']) {
lintArgs.addAll(<String>['--html', argResults['out']]);
}
final String javaHome = await getJavaHome();
final String? javaHome = await getJavaHome();
final Process lintProcess = await processManager.start(
lintArgs,
environment: javaHome != null
@@ -165,7 +165,7 @@ ArgParser setupOptions() {
/// On macOS, we can try to find Java 1.8.
///
/// Otherwise, default to whatever JAVA_HOME is already.
Future<String> getJavaHome() async {
Future<String?> getJavaHome() async {
if (Platform.isMacOS) {
final ProcessResult result = await processManager.run(
<String>['/usr/libexec/java_home', '-v', '1.8', '-F'],