[infra] Switch pkg bots to Dart 2

* Update named configs for unit tests to Dart 2.
* Bump json_rpc_2 in front_end package.
* Use named configurations in unit tests.
* Fix typing issues.

Change-Id: Id3b393a0d2abe92c8eaec10fa8057fb35d18a4c6
Reviewed-on: https://dart-review.googlesource.com/67341
Reviewed-by: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index b0448a3..77c908e 100644
--- a/pkg/front_end/pubspec.yaml
+++ b/pkg/front_end/pubspec.yaml
@@ -23,7 +23,7 @@
   build_integration:
     path: ../build_integration
   dart_style: '^1.0.7'
-  json_rpc_2: ^2.0.4
+  json_rpc_2: ^2.0.9
   mockito: ^2.0.2
   stream_channel: ^1.6.1
   test: ^0.12.0
diff --git a/pkg/front_end/test/fasta/incremental_expectations.dart b/pkg/front_end/test/fasta/incremental_expectations.dart
index efdb6ed..6ac7b34 100644
--- a/pkg/front_end/test/fasta/incremental_expectations.dart
+++ b/pkg/front_end/test/fasta/incremental_expectations.dart
@@ -32,7 +32,7 @@
       data = <String>[data];
     }
     if (data is List) {
-      return new IncrementalExpectation(data);
+      return new IncrementalExpectation(data.cast<String>());
     }
     return new IncrementalExpectation(extractMessages(data),
         commitChangesShouldFail: extractCommitChangesShouldFail(data),
diff --git a/pkg/front_end/test/fasta/messages_test.dart b/pkg/front_end/test/fasta/messages_test.dart
index 55797a8..b06f4ec 100644
--- a/pkg/front_end/test/fasta/messages_test.dart
+++ b/pkg/front_end/test/fasta/messages_test.dart
@@ -322,7 +322,7 @@
   final Uint8List bytes;
 
   BytesExample(String name, String code, this.node)
-      : bytes = new Uint8List.fromList(node.value),
+      : bytes = new Uint8List.fromList(node.cast<int>()),
         super(name, code);
 }
 
diff --git a/pkg/front_end/test/summary_generator_test.dart b/pkg/front_end/test/summary_generator_test.dart
index e705c97..a74d5e2 100644
--- a/pkg/front_end/test/summary_generator_test.dart
+++ b/pkg/front_end/test/summary_generator_test.dart
@@ -52,7 +52,7 @@
 
   test('non-sdk dependencies are marked external', () async {
     var summaryA = await summarize(['a.dart'], allSources);
-    var sourcesWithA = new Map.from(allSources);
+    var sourcesWithA = new Map<String, dynamic>.from(allSources);
     sourcesWithA['a.dill'] = summaryA;
     var summaryB =
         await summarize(['b.dart'], sourcesWithA, inputSummaries: ['a.dill']);
@@ -66,13 +66,13 @@
 
   test('dependencies can be combined without conflict', () async {
     var summaryA = await summarize(['a.dart'], allSources);
-    var sourcesWithA = new Map.from(allSources);
+    var sourcesWithA = new Map<String, dynamic>.from(allSources);
     sourcesWithA['a.dill'] = summaryA;
 
     var summaryBC = await summarize(['b.dart', 'c.dart'], sourcesWithA,
         inputSummaries: ['a.dill']);
 
-    var sourcesWithABC = new Map.from(sourcesWithA);
+    var sourcesWithABC = new Map<String, dynamic>.from(sourcesWithA);
     sourcesWithABC['bc.dill'] = summaryBC;
 
     // Note: a is loaded first, bc.dill have a.dart as an external reference so
@@ -85,13 +85,13 @@
 
   test('dependencies can be combined in any order', () async {
     var summaryA = await summarize(['a.dart'], allSources);
-    var sourcesWithA = new Map.from(allSources);
+    var sourcesWithA = new Map<String, dynamic>.from(allSources);
     sourcesWithA['a.dill'] = summaryA;
 
     var summaryBC = await summarize(['b.dart', 'c.dart'], sourcesWithA,
         inputSummaries: ['a.dill']);
 
-    var sourcesWithABC = new Map.from(sourcesWithA);
+    var sourcesWithABC = new Map<String, dynamic>.from(sourcesWithA);
     sourcesWithABC['bc.dill'] = summaryBC;
 
     // Note: unlinke the previous test now bc.dill is loaded first and contains
@@ -111,7 +111,7 @@
     expect(
         component.libraries.single.importUri.path.endsWith('a.dart'), isTrue);
 
-    var sourcesWithA = new Map.from(allSources);
+    var sourcesWithA = new Map<String, dynamic>.from(allSources);
     sourcesWithA['a.dill'] = summaryA;
     var summaryB = await summarize(['b.dart'], sourcesWithA,
         inputSummaries: ['a.dill'], truncate: true);
@@ -131,7 +131,7 @@
   // TODO(sigmund): test trimDependencies when it is part of the public API.
 }
 
-var allSources = {
+var allSources = <String, String>{
   'a.dart': 'class A { foo() { print("hi"); } }',
   'b.dart': 'import "a.dart"; class B extends A {}',
   'c.dart': 'class C { bar() => 1; }',
diff --git a/pkg/front_end/test/tool/reload.dart b/pkg/front_end/test/tool/reload.dart
index 275c9d1..31e10a1 100644
--- a/pkg/front_end/test/tool/reload.dart
+++ b/pkg/front_end/test/tool/reload.dart
@@ -17,7 +17,6 @@
 
 import 'dart:async';
 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
-import 'package:stream_channel/stream_channel.dart';
 import 'package:web_socket_channel/io.dart';
 
 /// APIs to communicate with a remote VM via the VM's service protocol.
@@ -42,9 +41,8 @@
 
   /// Establishes the JSON rpc connection.
   json_rpc.Peer _createPeer() {
-    StreamChannel socket =
-        new IOWebSocketChannel.connect('ws://127.0.0.1:$port/ws');
-    var peer = new json_rpc.Peer(socket);
+    var socket = new IOWebSocketChannel.connect('ws://127.0.0.1:$port/ws');
+    var peer = new json_rpc.Peer(socket.cast<String>());
     peer.listen().then((_) {
       if (VERBOSE_DEBUG) print('connection to vm-service closed');
       return disconnect();
diff --git a/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart b/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
index 4decb5d..2f00335 100644
--- a/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
+++ b/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
@@ -41,7 +41,7 @@
   });
 }
 
-withTemporaryDirectory(String prefix, Future f(Uri tmp)) async {
+withTemporaryDirectory(String prefix, Future<void> f(Uri tmp)) async {
   Directory tmp = await Directory.systemTemp.createTemp(prefix);
   try {
     await f(tmp.uri);
diff --git a/pkg/front_end/tool/_fasta/compile_platform_test.dart b/pkg/front_end/tool/_fasta/compile_platform_test.dart
index ac0ea114..d36b852 100644
--- a/pkg/front_end/tool/_fasta/compile_platform_test.dart
+++ b/pkg/front_end/tool/_fasta/compile_platform_test.dart
@@ -42,7 +42,7 @@
   });
 }
 
-withTemporaryDirectory(String prefix, Future f(Uri tmp)) async {
+withTemporaryDirectory(String prefix, Future<void> f(Uri tmp)) async {
   Directory tmp = await Directory.systemTemp.createTemp(prefix);
   try {
     await f(tmp.uri);
diff --git a/pkg/pkg.status b/pkg/pkg.status
index d6724a8..c8f7401 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -219,9 +219,6 @@
 [ $compiler == dart2js && $csp ]
 mutation_observer: Skip # This test cannot run under CSP because it is injecting a JavaScript polyfill
 
-[ $compiler == dart2js && $strong ]
-status_file/test/status_expression_dnf_test: RuntimeError # not strong-clean
-
 [ $compiler == dart2js && ($runtime == chrome || $runtime == ff) ]
 async/test/stream_zip_test: SkipSlow # Times out. Issue 22050
 collection/test/unmodifiable_collection_test: SkipSlow # Times out. Issue 22050
diff --git a/pkg/smith/lib/configuration.dart b/pkg/smith/lib/configuration.dart
index 3e5b417..e002d81 100644
--- a/pkg/smith/lib/configuration.dart
+++ b/pkg/smith/lib/configuration.dart
@@ -390,7 +390,7 @@
       runtime.hashCode ^
       system.hashCode ^
       builderTag.hashCode ^
-      vmOptions.hashCode ^
+      vmOptions.join(" & ").hashCode ^
       timeout.hashCode ^
       (enableAsserts ? 1 : 0) ^
       (isChecked ? 2 : 0) ^
@@ -419,7 +419,7 @@
     fields.add("system: $system");
 
     if (builderTag != "") fields.add("builder-tag: $builderTag");
-    if (vmOptions != "") fields.add("vm-options: $vmOptions");
+    if (vmOptions != "") fields.add("vm-options: [${vmOptions.join(", ")}]");
     if (timeout != 0) fields.add("timeout: $timeout");
     if (enableAsserts) fields.add("enable-asserts");
     if (isChecked) fields.add("checked");
diff --git a/pkg/smith/test/test_matrix_test.dart b/pkg/smith/test/test_matrix_test.dart
index 3872422..7c20a66 100644
--- a/pkg/smith/test/test_matrix_test.dart
+++ b/pkg/smith/test/test_matrix_test.dart
@@ -11,12 +11,12 @@
       var testMatrix = TestMatrix.fromJson({
         "configurations": {
           "x64-dart2js-debug-vm-linux": <String, dynamic>{
-            "options": <String, dynamic>{"enableAsserts": true},
+            "options": <String, dynamic>{"enable-asserts": true},
           },
           "x64-dartdevc-vm-linux": <String, dynamic>{
             "options": <String, dynamic>{
               "mode": "release",
-              "enableAsserts": true
+              "enable-asserts": true
             },
           },
         }
@@ -51,10 +51,10 @@
           {
             "configurations": {
               "one-x64-dart2js-debug-vm-linux": <String, dynamic>{
-                "options": <String, dynamic>{"enableAsserts": true}
+                "options": <String, dynamic>{"enable-asserts": true}
               },
               "two-x64-dart2js-debug-vm-linux": <String, dynamic>{
-                "options": <String, dynamic>{"enableAsserts": true}
+                "options": <String, dynamic>{"enable-asserts": true}
               },
             }
           });
diff --git a/pkg/status_file/lib/src/disjunctive.dart b/pkg/status_file/lib/src/disjunctive.dart
index 55dd7b7..4c461b2 100644
--- a/pkg/status_file/lib/src/disjunctive.dart
+++ b/pkg/status_file/lib/src/disjunctive.dart
@@ -102,7 +102,7 @@
   });
   var combinedMinSets = _combineMinSets(
       clauses.map((e) => [new LogicExpression.and(e)]).toList(), []);
-  List<List<LogicExpression>> minCover = _findMinCover(combinedMinSets, []);
+  List<List<Expression>> minCover = _findMinCover(combinedMinSets, []);
   var finalOperands = minCover.map((minSet) => _reduceMinSet(minSet)).toList();
   return new LogicExpression.or(finalOperands).normalize();
 }
diff --git a/pkg/vm/test/frontend_server_test.dart b/pkg/vm/test/frontend_server_test.dart
index e7e60d0..94d5c69 100644
--- a/pkg/vm/test/frontend_server_test.dart
+++ b/pkg/vm/test/frontend_server_test.dart
@@ -3,7 +3,6 @@
 import 'dart:io';
 import 'dart:isolate';
 
-import 'package:args/src/arg_results.dart';
 import 'package:kernel/binary/ast_to_binary.dart';
 import 'package:kernel/ast.dart' show Component;
 import 'package:kernel/kernel.dart' show loadComponentFromBinary;
@@ -45,7 +44,7 @@
         'sdkroot',
       ];
       await starter(args, compiler: compiler);
-      final List<ArgResults> capturedArgs = verify(compiler.compile(
+      final List<dynamic> capturedArgs = verify(compiler.compile(
         argThat(equals('server.dart')),
         captureAny,
         generator: anyNamed('generator'),
@@ -62,7 +61,7 @@
         '--strong',
       ];
       await starter(args, compiler: compiler);
-      final List<ArgResults> capturedArgs = verify(compiler.compile(
+      final List<dynamic> capturedArgs = verify(compiler.compile(
         argThat(equals('server.dart')),
         captureAny,
         generator: anyNamed('generator'),
@@ -81,7 +80,7 @@
         '--no-sync-async',
       ];
       await starter(args, compiler: compiler);
-      final List<ArgResults> capturedArgs = verify(compiler.compile(
+      final List<dynamic> capturedArgs = verify(compiler.compile(
         argThat(equals('server.dart')),
         captureAny,
         generator: anyNamed('generator'),
@@ -99,7 +98,7 @@
         '--link-platform',
       ];
       await starter(args, compiler: compiler);
-      final List<ArgResults> capturedArgs = verify(compiler.compile(
+      final List<dynamic> capturedArgs = verify(compiler.compile(
         argThat(equals('server.dart')),
         captureAny,
         generator: anyNamed('generator'),
@@ -455,7 +454,7 @@
           '/foo/bar/server.incremental.dart.dill',
         ];
         expect(await starter(args, compiler: compiler), 0);
-        final List<ArgResults> capturedArgs = verify(compiler.compile(
+        final List<dynamic> capturedArgs = verify(compiler.compile(
           argThat(equals('server.dart')),
           captureAny,
           generator: anyNamed('generator'),
diff --git a/pkg/vm/test/incremental_compiler_test.dart b/pkg/vm/test/incremental_compiler_test.dart
index f7204ca..16e6dad 100644
--- a/pkg/vm/test/incremental_compiler_test.dart
+++ b/pkg/vm/test/incremental_compiler_test.dart
@@ -15,7 +15,6 @@
 import 'package:kernel/kernel.dart';
 import 'package:kernel/target/targets.dart';
 import 'package:kernel/text/ast_to_text.dart';
-import 'package:stream_channel/stream_channel.dart';
 import 'package:test/test.dart';
 import 'package:web_socket_channel/io.dart';
 
@@ -180,9 +179,8 @@
 
   /// Establishes the JSON rpc connection.
   json_rpc.Peer _createPeer() {
-    StreamChannel socket =
-        new IOWebSocketChannel.connect('ws://127.0.0.1:$port/ws');
-    var peer = new json_rpc.Peer(socket);
+    var socket = new IOWebSocketChannel.connect('ws://127.0.0.1:$port/ws');
+    var peer = new json_rpc.Peer(socket.cast<String>());
     peer.listen().then((_) {
       print('connection to vm-service closed');
       return disconnect();
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 4174ff1..e369244 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -147,22 +147,29 @@
   "configurations": {
     "unittest-(linux|win|mac)": {
       "options": {
-        "compiler": "none",
-        "runtime": "vm",
+        "compiler": "dartk",
         "mode": "release",
-        "preview-dart-2": false,
-        "use-sdk": true,
-        "checked": true,
-        "timeout": 240
+        "runtime": "vm",
+        "timeout": 240,
+        "use-sdk": true
       }},
     "unittest-asserts-(linux|mac|win)": {
       "options": {
-        "compiler": "none",
-        "runtime": "vm",
+        "compiler": "dartk",
+        "enable-asserts": true,
         "mode": "release",
-        "use-sdk": true,
-        "enable-asserts": true
+        "runtime": "vm",
+        "timeout": 240,
+        "use-sdk": true
       }},
+      "unittest-asserts-no-sdk-(linux|mac|win)": {
+        "options": {
+          "compiler": "dartk",
+          "enable-asserts": true,
+          "mode": "release",
+          "runtime": "vm",
+          "timeout": 240
+        }},
     "unittest-analyzer_use_fasta-linux": {
       "options": {
         "compiler": "none",
@@ -470,12 +477,12 @@
         {
           "name": "unit tests",
           "arguments": [
-            "-nunittest-${system}",
-            "--checked",
-            "--compiler=none",
-            "--no-preview-dart-2",
+            "-nunittest-asserts-${system}",
+            "--compiler=dartk",
+            "--enable-asserts",
             "--runtime=vm",
             "--timeout=240",
+            "--use-sdk",
             "pkg/(kernel|front_end|fasta)"
           ]
         },
@@ -1269,14 +1276,13 @@
         {
           "name": "dart2js unit tests",
           "arguments": [
-            "-nunittest-linux",
-            "--compiler=none",
+            "-nunittest-asserts-no-sdk-linux",
+            "--compiler=dartk",
+            "--enable-asserts",
             "--runtime=vm",
-            "--timeout=120",
-            "--checked",
-            "--no-preview-dart-2",
+            "--timeout=240",
             "dart2js",
-            "pkg/compiler"
+            "pkg//compiler/"
           ]
         }
       ]
@@ -1777,8 +1783,10 @@
           "name": "analyzer unit tests",
           "arguments": [
             "-nunittest-asserts-${system}",
-            "--compiler=none",
+            "--compiler=dartk",
             "--enable-asserts",
+            "--runtime=vm",
+            "--timeout=240",
             "--use-sdk",
             "pkg/analyzer"
           ],
@@ -1789,8 +1797,10 @@
           "name": "analysis_server unit tests",
           "arguments": [
             "-nunittest-asserts-${system}",
-            "--compiler=none",
+            "--compiler=dartk",
             "--enable-asserts",
+            "--runtime=vm",
+            "--timeout=240",
             "--use-sdk",
             "pkg/analysis_server"
           ],
@@ -1820,8 +1830,10 @@
           "name": "analyzer_cli unit tests",
           "arguments": [
             "-nunittest-asserts-${system}",
-            "--compiler=none",
+            "--compiler=dartk",
             "--enable-asserts",
+            "--runtime=vm",
+            "--timeout=240",
             "--use-sdk",
             "pkg/analyzer_cli"
           ]
@@ -1830,8 +1842,10 @@
           "name": "analyzer_plugin unit tests",
           "arguments": [
             "-nunittest-asserts-${system}",
-            "--compiler=none",
+            "--compiler=dartk",
             "--enable-asserts",
+            "--runtime=vm",
+            "--timeout=240",
             "--use-sdk",
             "pkg/analyzer_plugin"
           ]
@@ -2269,10 +2283,9 @@
         {
           "name": "package unit tests",
           "arguments": [
-            "-nunittest-${system}",
-            "--checked",
-            "--compiler=none",
-            "--no-preview-dart-2",
+            "-nunittest-asserts-${system}",
+            "--compiler=dartk",
+            "--enable-asserts",
             "--runtime=vm",
             "--timeout=240",
             "--use-sdk"
@@ -2282,10 +2295,9 @@
         {
           "name": "third_party/pkg_tested unit tests",
           "arguments": [
-            "-nunittest-${system}",
-            "--checked",
-            "--compiler=none",
-            "--no-preview-dart-2",
+            "-nunittest-asserts-${system}",
+            "--compiler=dartk",
+            "--enable-asserts",
             "--runtime=vm",
             "--timeout=240",
             "--use-sdk"