Version 2.17.0-136.0.dev

Merge commit 'b29bb7763b9de628cbc04a56b7a9ba4b3182609d' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index a5e1bb0..51bc8f5 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,6 @@
     "constraint, update this by running tools/generate_package_config.dart."
   ],
   "configVersion": 2,
-  "generated": "2022-02-17T08:48:00.006717",
   "generator": "tools/generate_package_config.dart",
   "packages": [
     {
diff --git a/.packages b/.packages
index 822b3c3..646a631 100644
--- a/.packages
+++ b/.packages
@@ -2,10 +2,9 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 #
-# .package file containing links to all packages in /pkg, and checked out
-# by DEPS into /third_party/pkg and /third_party/pkg_tested.
-# Please update this file if you add a package to DEPS or /pkg
-#
+# This file is generated; do not edit. To re-generate, run:
+#   'dart tools/generate_package_config.dart'.
+
 _fe_analyzer_shared:pkg/_fe_analyzer_shared/lib
 _js_interop_checks:pkg/_js_interop_checks/lib
 analysis_server:pkg/analysis_server/lib
@@ -20,10 +19,12 @@
 bazel_worker:third_party/pkg/bazel_worker/lib
 benchmark_harness:third_party/pkg/benchmark_harness/lib
 boolean_selector:third_party/pkg/boolean_selector/lib
-build_integration:pkg/build_integration/lib
 browser_launcher:third_party/pkg/browser_launcher/lib
+build_integration:pkg/build_integration/lib
+characters:third_party/pkg/characters/lib
 charcode:third_party/pkg/charcode/lib
 cli_util:third_party/pkg/cli_util/lib
+clock:third_party/pkg/clock/lib
 collection:third_party/pkg/collection/lib
 compiler:pkg/compiler/lib
 convert:third_party/pkg/convert/lib
@@ -44,9 +45,12 @@
 devtools_shared:third_party/devtools/devtools_shared/lib
 expect:pkg/expect/lib
 ffi:third_party/pkg/ffi/lib
+file:third_party/pkg/file/packages/file/lib
+file_testing:third_party/pkg/file/packages/file_testing/lib
 fixnum:third_party/pkg/fixnum/lib
-frontend_server:pkg/frontend_server/lib
 front_end:pkg/front_end/lib
+frontend_server:pkg/frontend_server/lib
+frontend_server_client:third_party/pkg/webdev/frontend_server_client/lib
 glob:third_party/pkg/glob/lib
 html:third_party/pkg/html/lib
 http:third_party/pkg/http/lib
@@ -72,7 +76,7 @@
 nnbd_migration:pkg/nnbd_migration/lib
 oauth2:third_party/pkg/oauth2/lib
 observatory:runtime/observatory/lib
-observatory_test_package:runtime/observatory/tests/service/observatory_test_package
+observatory_2:runtime/observatory_2/lib
 package_config:third_party/pkg_tested/package_config/lib
 path:third_party/pkg/path/lib
 pedantic:third_party/pkg/pedantic/lib
@@ -82,6 +86,7 @@
 protobuf:third_party/pkg/protobuf/protobuf/lib
 pub:third_party/pkg/pub/lib
 pub_semver:third_party/pkg/pub_semver/lib
+scrape:pkg/scrape/lib
 sdk_library_metadata:sdk/lib/_internal/sdk_library_metadata/lib
 shelf:third_party/pkg/shelf/lib
 shelf_packages_handler:third_party/pkg/shelf_packages_handler/lib
@@ -90,9 +95,9 @@
 shelf_web_socket:third_party/pkg/shelf_web_socket/lib
 smith:pkg/smith/lib
 source_map_stack_trace:third_party/pkg/source_map_stack_trace/lib
-sourcemap_testing:pkg/sourcemap_testing/lib
 source_maps:third_party/pkg/source_maps/lib
 source_span:third_party/pkg/source_span/lib
+sourcemap_testing:pkg/sourcemap_testing/lib
 sse:third_party/pkg/sse/lib
 stack_trace:third_party/pkg/stack_trace/lib
 status_file:pkg/status_file/lib
@@ -105,7 +110,6 @@
 test_api:third_party/pkg/test/pkgs/test_api/lib
 test_core:third_party/pkg/test/pkgs/test_core/lib
 test_descriptor:third_party/pkg/test_descriptor/lib
-test_package:pkg/vm_service/test/test_package
 test_process:third_party/pkg/test_process/lib
 test_reflective_loader:third_party/pkg/test_reflective_loader/lib
 test_runner:pkg/test_runner/lib
@@ -118,8 +122,9 @@
 vm_snapshot_analysis:pkg/vm_snapshot_analysis/lib
 wasm_builder:pkg/wasm_builder/lib
 watcher:third_party/pkg/watcher/lib
-webdriver:third_party/pkg/webdriver/lib
-webkit_inspection_protocol:third_party/pkg/webkit_inspection_protocol/lib
 web_components:third_party/pkg/web_components/lib
 web_socket_channel:third_party/pkg/web_socket_channel/lib
+webdriver:third_party/pkg/webdriver/lib
+webkit_inspection_protocol:third_party/pkg/webkit_inspection_protocol/lib
 yaml:third_party/pkg/yaml/lib
+yaml_edit:third_party/pkg/yaml_edit/lib
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index ca20354..568e70e 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -581,6 +581,17 @@
   DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
 };
 
+/***
+ * This class is intended for internal use by dart:io implementation and
+ * has no connection to dart:ffi Pointer class.
+ *
+ * It represents a pointer to a native resource of a known type.
+ *
+ * The receiving side will only see this pointer as an integer and will not
+ * see the specified finalizer.
+ *
+ * The specified finalizer will only be invoked if the message is not delivered.
+ **/
 class CObjectNativePointer : public CObject {
  public:
   DECLARE_COBJECT_CONSTRUCTORS(NativePointer)
diff --git a/runtime/include/dart_native_api.h b/runtime/include/dart_native_api.h
index 66e5f93..a938b49 100644
--- a/runtime/include/dart_native_api.h
+++ b/runtime/include/dart_native_api.h
@@ -32,6 +32,13 @@
  * the caller. The ownership of data for kExternalTyped is passed to the VM on
  * message send and returned when the VM invokes the
  * Dart_HandleFinalizer callback; a non-NULL callback must be provided.
+ *
+ * Note that Dart_CObject_kNativePointer is intended for internal use by
+ * dart:io implementation and has no connection to dart:ffi Pointer class.
+ * It represents a pointer to a native resource of a known type.
+ * The receiving side will only see this pointer as an integer and will not
+ * see the specified finalizer.
+ * The specified finalizer will only be invoked if the message is not delivered.
  */
 typedef enum {
   Dart_CObject_kNull = 0,
diff --git a/tools/VERSION b/tools/VERSION
index 39320fd..5e3c2a5 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 135
+PRERELEASE 136
 PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 4d8b3ce..b4ba277 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -1,9 +1,6 @@
 #!/usr/bin/env dart
 
 /// Generates the repo's ".dart_tool/package_config.json" file.
-
-// @dart = 2.9
-
 import 'dart:convert';
 import 'dart:io';
 
@@ -90,23 +87,24 @@
     ...makeCfePackageConfigs(cfePackageDirs),
     ...makeFeAnalyzerSharedPackageConfigs(feAnalyzerSharedPackageDirs)
   ];
-  packages.sort((a, b) => a["name"].compareTo(b["name"]));
+  packages.sort((a, b) => a['name']!.compareTo(b['name']!));
 
   var configFile = File(p.join(repoRoot, '.dart_tool', 'package_config.json'));
-  var json =
-      jsonDecode(configFile.readAsStringSync()) as Map<dynamic, dynamic>;
+  var json = jsonDecode(configFile.readAsStringSync()) as Map<dynamic, dynamic>;
   var oldPackages = json['packages'] as List<dynamic>;
 
-  // Validate the packages entry only, to avoid spurious failures from changes
-  // in the dates embedded in the other entries.
-  if (jsonEncode(packages) == jsonEncode(oldPackages)) {
-    print("Package config up to date");
-    exit(0);
-  } else if (checkOnly) {
-    print("Package config out of date");
-    print("Run `gclient sync -D && dart tools/generate_package_config.dart` "
-        "to update.");
-    exit(1);
+  if (checkOnly) {
+    // Validate the packages entry only, to avoid spurious failures from changes
+    // in the dates embedded in the other entries.
+    if (jsonEncode(packages) == jsonEncode(oldPackages)) {
+      print("Package config up to date.");
+      exit(0);
+    } else {
+      print("Package config out of date.");
+      print("Run `gclient sync -D && dart tools/generate_package_config.dart` "
+          "to update.");
+      exit(1);
+    }
   }
 
   var year = DateTime.now().year;
@@ -123,7 +121,6 @@
       'constraint, update this by running tools/generate_package_config.dart.'
     ],
     'configVersion': 2,
-    'generated': DateTime.now().toIso8601String(),
     'generator': 'tools/generate_package_config.dart',
     'packages': packages,
   };
@@ -131,8 +128,33 @@
   // TODO(rnystrom): Consider using package_config_v2 to generate this instead.
   var jsonString = JsonEncoder.withIndent('  ').convert(config);
   configFile.writeAsStringSync('$jsonString\n');
-  print('Generated .dart_tool/package_config.dart containing '
-      '${packages.length} packages.');
+
+  // Also generate the reop's .packages file.
+  var packagesFile = File(p.join(repoRoot, '.packages'));
+  var buffer = StringBuffer('''
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# This file is generated; do not edit. To re-generate, run:
+#   'dart tools/generate_package_config.dart'.
+
+''');
+  for (var package in packages) {
+    final name = package['name'];
+    var path = package['rootUri']!;
+    if (path.startsWith('../')) {
+      path = path.substring('../'.length);
+    }
+    var packageUri = package['packageUri'];
+    if (packageUri != null && packageUri.endsWith('/')) {
+      packageUri = packageUri.substring(0, packageUri.length - 1);
+    }
+    if (packageUri != null && packageUri != '.nonexisting') {
+      buffer.writeln('$name:$path/$packageUri');
+    }
+  }
+  packagesFile.writeAsStringSync(buffer.toString());
 }
 
 /// Generates package configurations for each package in [packageDirs].
@@ -198,9 +220,9 @@
 
 /// Infers the language version from the SDK constraint in the pubspec for
 /// [packageDir].
-///
-/// Returns `null` if there is no pubspec or no SDK constraint.
 Version pubspecLanguageVersion(String packageDir) {
+  final dartVersion2 = Version.parse('2.0.0');
+
   var pubspecFile = File(p.join(packageDir, 'pubspec.yaml'));
   var relative = p.relative(packageDir, from: repoRoot);
 
@@ -223,7 +245,9 @@
   }
 
   var sdkConstraint = VersionConstraint.parse(environment['sdk'] as String);
-  if (sdkConstraint is VersionRange) return sdkConstraint.min;
+  if (sdkConstraint is VersionRange) {
+    return sdkConstraint.min ?? dartVersion2;
+  }
 
   print("Error: SDK constraint $relative is not a version range.");
   exit(1);