[beta] Bump tools to 466bb19b8ad8b278c351914ce20bedb7b32bfc91

Requires the following commits, which have been applied to this change:
- https://github.com/dart-lang/sdk/commit/d27e14496fdee58aabbc9513bed2fa84fedf0696
- https://github.com/dart-lang/sdk/commit/d18d32d46c13ceee169f86d3bbebbe4850cc9f80
- https://github.com/dart-lang/sdk/commit/7bee1030fd2422990d15668b54557221208483da
- https://github.com/dart-lang/sdk/commit/e88d3d1a65bd8282552d3f3fcc2f1c6a7415cddb
- https://github.com/dart-lang/sdk/commit/2049a3045c934fb32077fe2fa5e14f6364f21197

Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/397001
Cherry-pick-request: https://github.com/dart-lang/sdk/issues/59602
Change-Id: I6ce4e5ae639126d45fbf042935e75b40a4707be7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397420
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/DEPS b/DEPS
index bbdb2d3..2a5aa55 100644
--- a/DEPS
+++ b/DEPS
@@ -8,7 +8,7 @@
 #
 # Packages can be rolled to the latest version with `tools/manage_deps.dart`.
 #
-# For example
+# For example:
 #
 #     dart tools/manage_deps.dart bump third_party/pkg/dart_style
 
@@ -120,19 +120,13 @@
   # EOL comment after a dependency to disable this and pin it at its current
   # revision.
 
-  "args_rev": "e623652744c82533829f2e62b1aba1a6cf06e291",
+  "args_rev": "09c0fca1785c9df39288a48f767994eed80bed40",
   "async_rev": "c0d81f8699682d01d657a9bf827107d11904a247",
-  "bazel_worker_rev": "aa3cc9e826350b960e0c5a67e6065bcedba8b0ac",
-  "benchmark_harness_rev": "44f125ae1d045aa3de09fe88a8dd70cb7352d563",
-  "boolean_selector_rev": "d6c7c36ae1111f11cc24306d71d3ab2deea8fa68",
-  "browser_launcher_rev": "e5fc5d488eb5038bfec2a6690c72ab8dd353e101",
   "characters_rev": "7633a16a22c626e19ca750223237396315268a06",
-  "cli_util_rev": "c36b3941e38092d6d6f87ac27d9e88f153d3ac38",
-  "clock_rev": "7956d60042f4ea979c4554d43eeb57d087627869",
   "collection_rev": "24b75d85df6a26aac7be13b56ff1ce4360c04a64",
   "convert_rev": "9035cafefc1da4315f26058734d0c2a19d5ab56a",
+  "core_rev": "2a436d5c21964c2658a3b669d9bdef802637dd81",
   "crypto_rev": "eede7d6918c51159c1422b7449f40dbac660ee57",
-  "csslib_rev": "a3700b05bbcc42782e8a7024790dbf019d89c249",
   # Note: Updates to dart_style have to be coordinated with the infrastructure
   # team so that the internal formatter `tools/sdks/dart-sdk/bin/dart format`
   # matches the version here. Please follow this process to make updates:
@@ -146,16 +140,13 @@
   "dart_style_rev": "5d35f4d829ffb8532d345d95d3e9504ae6cd839e", # disable tools/rev_sdk_deps.dart
   "dartdoc_rev": "5df03dd913a0a2e20421cac61112aa84111160e0",
   "ecosystem_rev": "2d58550f9e3fd8ecbc3b2e4444095fcb204a66c6",
-  "file_rev": "6842feaef1c4e06239bd30f8d3ef722838b1c97e",
   "fixnum_rev": "83293b8ed86ccd574a94fcf4a2da43f31c1b43e0",
   "flute_rev": "a531c96a8b43d015c6bfbbfe3ab54867b0763b8b",
   "glob_rev": "00a9c82d31c01ae88ec9ae4021d842e9b832aa52",
-  "html_rev": "6d3bc86cf2ab530ef3fa5f84b5980dc318a02af4",
   "http_rev": "f59cd79e1322c6272481e4f2ccfa9afcb37a6525",
   "http_multi_server_rev": "e7515b5896b83d522189802a1e14e103e19426c0",
   "http_parser_rev": "ce528cf82f3d26ac761e29b2494a9e0c270d4939",
   "intl_rev": "5d65e3808ce40e6282e40881492607df4e35669f",
-  "json_rpc_2_rev": "b4810dc7bee5828f240586c81f3f34853cacdbce",
   "leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # manually rolled
   "lints_rev": "5016d63c889936b2100520f999591d0492d9afe3",
   "logging_rev": "6fa056098ceca03d399bff64592822b2ae5dee6e",
@@ -184,7 +175,7 @@
   "test_descriptor_rev": "a3db1efe3dc725dcae9ee61647d3bfc19b3231ac",
   "test_process_rev": "52ee3f5ab70ed965bb7122c1d499081fbccd0bde",
   "test_reflective_loader_rev": "598af2f503955020af0eaa82558d574a03934078",
-  "tools_rev": "d4995d47b99d5e9564abfed2218f4a23df75983b",
+  "tools_rev": "466bb19b8ad8b278c351914ce20bedb7b32bfc91",
   "typed_data_rev": "2bb9e6ead6394e2d4ec6068c5ece8b2ec0e2b945",
   "vector_math_rev": "2cfbe2c115a57b368ccbc3c89ebd38a06764d3d1",
   "watcher_rev": "3b850778ad0b62db3aa2cfe48832870c2461db30",
@@ -382,34 +373,20 @@
       Var("dart_git") + "args.git" + "@" + Var("args_rev"),
   Var("dart_root") + "/third_party/pkg/async":
       Var("dart_git") + "async.git" + "@" + Var("async_rev"),
-  Var("dart_root") + "/third_party/pkg/bazel_worker":
-      Var("dart_git") + "bazel_worker.git" + "@" + Var("bazel_worker_rev"),
-  Var("dart_root") + "/third_party/pkg/benchmark_harness":
-      Var("dart_git") + "benchmark_harness.git" + "@" +
-      Var("benchmark_harness_rev"),
-  Var("dart_root") + "/third_party/pkg/boolean_selector":
-      Var("dart_git") + "boolean_selector.git" +
-      "@" + Var("boolean_selector_rev"),
-  Var("dart_root") + "/third_party/pkg/browser_launcher":
-      Var("dart_git") + "browser_launcher.git" + "@" + Var("browser_launcher_rev"),
   Var("dart_root") + "/third_party/pkg/characters": {
     # Contact athom@ or ensure that license requirements are met before using
     # this dependency in other parts of the Dart SDK.
     "url": Var("dart_git") + "characters.git" + "@" + Var("characters_rev"),
     "condition": "checkout_flute",
   },
-  Var("dart_root") + "/third_party/pkg/cli_util":
-      Var("dart_git") + "cli_util.git" + "@" + Var("cli_util_rev"),
-  Var("dart_root") + "/third_party/pkg/clock":
-      Var("dart_git") + "clock.git" + "@" + Var("clock_rev"),
   Var("dart_root") + "/third_party/pkg/collection":
       Var("dart_git") + "collection.git" + "@" + Var("collection_rev"),
   Var("dart_root") + "/third_party/pkg/convert":
       Var("dart_git") + "convert.git" + "@" + Var("convert_rev"),
+  Var("dart_root") + "/third_party/pkg/core":
+      Var("dart_git") + "core.git" + "@" + Var("core_rev"),
   Var("dart_root") + "/third_party/pkg/crypto":
       Var("dart_git") + "crypto.git" + "@" + Var("crypto_rev"),
-  Var("dart_root") + "/third_party/pkg/csslib":
-      Var("dart_git") + "csslib.git" + "@" + Var("csslib_rev"),
   Var("dart_root") + "/third_party/pkg/dart_style":
       Var("dart_git") + "dart_style.git" + "@" + Var("dart_style_rev"),
   Var("dart_root") + "/third_party/pkg/dartdoc":
@@ -422,13 +399,8 @@
     "url": Var("dart_git") + "flute.git" + "@" + Var("flute_rev"),
     "condition": "checkout_flute",
   },
-  Var("dart_root") + "/third_party/pkg/file":
-      Var("dart_git") + "external/github.com/google/file.dart"
-      + "@" + Var("file_rev"),
   Var("dart_root") + "/third_party/pkg/glob":
       Var("dart_git") + "glob.git" + "@" + Var("glob_rev"),
-  Var("dart_root") + "/third_party/pkg/html":
-      Var("dart_git") + "html.git" + "@" + Var("html_rev"),
   Var("dart_root") + "/third_party/pkg/http":
       Var("dart_git") + "http.git" + "@" + Var("http_rev"),
   Var("dart_root") + "/third_party/pkg/http_multi_server":
@@ -438,8 +410,6 @@
       Var("dart_git") + "http_parser.git" + "@" + Var("http_parser_rev"),
   Var("dart_root") + "/third_party/pkg/intl":
       Var("dart_git") + "intl.git" + "@" + Var("intl_rev"),
-  Var("dart_root") + "/third_party/pkg/json_rpc_2":
-      Var("dart_git") + "json_rpc_2.git" + "@" + Var("json_rpc_2_rev"),
   Var("dart_root") + "/third_party/pkg/leak_tracker":
       Var("dart_git") + "leak_tracker.git" + "@" + Var("leak_tracker_rev"),
   Var("dart_root") + "/third_party/pkg/lints":
diff --git a/pkg/dartdev/test/commands/pub_test.dart b/pkg/dartdev/test/commands/pub_test.dart
index 8356282..4cfe946 100644
--- a/pkg/dartdev/test/commands/pub_test.dart
+++ b/pkg/dartdev/test/commands/pub_test.dart
@@ -91,6 +91,7 @@
     var result = await p.run(['pub', 'deps', '--foo']);
     expect(result.exitCode, 64);
     expect(result.stdout, isEmpty);
-    expect(result.stderr, startsWith('Could not find an option named "foo".'));
+    expect(
+        result.stderr, startsWith('Could not find an option named "--foo".'));
   });
 }
diff --git a/pkg/dartdev/test/commands/run_test.dart b/pkg/dartdev/test/commands/run_test.dart
index 0c1a58b..6954dec 100644
--- a/pkg/dartdev/test/commands/run_test.dart
+++ b/pkg/dartdev/test/commands/run_test.dart
@@ -414,7 +414,7 @@
     expect(result.stdout, isEmpty);
     expect(
       result.stderr,
-      contains('Could not find an option named "vm-name".'),
+      contains('Could not find an option named "--vm-name".'),
     );
     expect(result.exitCode, 64);
   });
@@ -433,7 +433,7 @@
     expect(result.stdout, isEmpty);
     expect(
       result.stderr,
-      contains('Could not find an option named "verbose_gc".'),
+      contains('Could not find an option named "--verbose_gc".'),
     );
     expect(result.exitCode, 64);
   });
diff --git a/pkg/dev_compiler/test/worker/worker_test.dart b/pkg/dev_compiler/test/worker/worker_test.dart
index b6652aa..5e34116 100644
--- a/pkg/dev_compiler/test/worker/worker_test.dart
+++ b/pkg/dev_compiler/test/worker/worker_test.dart
@@ -113,7 +113,7 @@
 
       expect(result.exitCode, 64);
       expect(result.stdout,
-          contains('Could not find an option named "does-not-exist"'));
+          contains('Could not find an option named "--does-not-exist"'));
       expect(result.stderr, isEmpty);
       expect(outputJsFile.existsSync(), isFalse);
     });
diff --git a/pkg/dtd/CHANGELOG.md b/pkg/dtd/CHANGELOG.md
index ce5a751..5e13905 100644
--- a/pkg/dtd/CHANGELOG.md
+++ b/pkg/dtd/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.4.1-wip
+
+## 2.4.0
+- Bump `unified_analytics` dependency to ^7.0.0.
+
 ## 2.3.0
 - Indicate compatibility with `package:web_socket_channel` 2.x and 3.x.
 - Bump minimum version for `package:unified_analytics` to 6.1.0.
diff --git a/pkg/dtd/pubspec.yaml b/pkg/dtd/pubspec.yaml
index ee8d1e0..058acb6 100644
--- a/pkg/dtd/pubspec.yaml
+++ b/pkg/dtd/pubspec.yaml
@@ -1,5 +1,5 @@
 name: dtd
-version: 2.3.1-wip
+version: 2.4.1-wip
 description: A package for communicating with the Dart Tooling Daemon.
 repository: https://github.com/dart-lang/sdk/tree/main/pkg/dtd
 
@@ -9,7 +9,7 @@
 dependencies:
   json_rpc_2: ^3.0.2
   stream_channel: ^2.1.2
-  unified_analytics: ^6.1.0
+  unified_analytics: ^7.0.0
   web_socket_channel: '>=2.0.0 <4.0.0'
 
 # We use 'any' version constraints here as we get our package versions from
diff --git a/pkg/test_runner/test/options_test.dart b/pkg/test_runner/test/options_test.dart
index c8c1e93..204a284 100644
--- a/pkg/test_runner/test/options_test.dart
+++ b/pkg/test_runner/test/options_test.dart
@@ -86,16 +86,16 @@
       ['--timeout=1,2'], 'Integer value expected for option "--timeout".');
 
   expectValidationError(['--progress=unknown'],
-      '"unknown" is not an allowed value for option "progress".');
+      '"unknown" is not an allowed value for option "--progress".');
   // Don't allow multiple.
   expectValidationError(['--progress=compact,silent'],
-      '"compact,silent" is not an allowed value for option "progress".');
+      '"compact,silent" is not an allowed value for option "--progress".');
 
   expectValidationError(['--nnbd=unknown'],
-      '"unknown" is not an allowed value for option "nnbd".');
+      '"unknown" is not an allowed value for option "--nnbd".');
   // Don't allow multiple.
   expectValidationError(['--nnbd=weak,strong'],
-      '"weak,strong" is not an allowed value for option "nnbd".');
+      '"weak,strong" is not an allowed value for option "--nnbd".');
 
   // Don't allow invalid named configurations.
   expectValidationError(['-ninvalid-vm-android-simarm'],
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 4d486e8..729ac6d 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -88,23 +88,30 @@
   ];
   packages.sort((a, b) => a.name.compareTo(b.name));
 
-  // Remove any packages with identical names.
+  // Check for duplicate packages - the same package sourced from multiple
+  // repositories.
   final uniqueNames = packages.map((p) => p.name).toSet();
 
   var hasDuplicatePackages = false;
 
   for (var name in uniqueNames) {
-    var matches = [
-      for (final p in packages)
-        if (p.name == name) p
-    ];
+    var matches = packages.where((p) => p.name == name).toList();
     if (matches.length > 1) {
-      print('Duplicates found for package:$name');
-      for (var package in matches) {
-        print('  ${package.rootUri}');
-      }
+      final inMonorepos = matches.where((p) => p.inMonorepo).toList();
 
-      hasDuplicatePackages = true;
+      if (inMonorepos.length == 1) {
+        // De-duplicating package 'name' - select just the monorepo version.
+        packages.removeWhere((p) {
+          return p.name == name && !p.inMonorepo;
+        });
+      } else {
+        print('Duplicates found for package:$name');
+        for (var package in matches) {
+          print('  ${package.rootUri}');
+        }
+
+        hasDuplicatePackages = true;
+      }
     }
   }
 
@@ -292,6 +299,14 @@
     this.languageVersion,
   });
 
+  /// Whether this package lives in a monorepo.
+  bool get inMonorepo {
+    // By convention (and for our purposes), a monorepo package lives in a
+    // `pkgs` directory.
+    final paths = posix(rootUri).split('/');
+    return paths.length >= 2 && paths[paths.length - 2] == 'pkgs';
+  }
+
   Map<String, Object?> toMap(String relativeTo) {
     return {
       'name': name,
diff --git a/tools/package_deps/bin/package_deps.dart b/tools/package_deps/bin/package_deps.dart
index a2815be..ba3099c 100644
--- a/tools/package_deps/bin/package_deps.dart
+++ b/tools/package_deps/bin/package_deps.dart
@@ -453,8 +453,6 @@
     _findPackages(Directory('pkg'));
     _findPackages(Directory(path.join('third_party', 'devtools')));
     _findPackages(Directory(path.join('third_party', 'pkg')));
-    _findPackages(
-        Directory(path.join('third_party', 'pkg', 'file', 'packages')));
 
     if (verbose) {
       print('Package versions in the SDK:');