Revert "Auto-generate the package_config.json file on gclient sync."
This reverts commit 92868580b4ad7fb3f3e7c6ad7ba10396c26da703.
Reason for revert: I'm seeing failures in golem:
ninja: error: '../../third_party/dart/.dart_tool/package_config.json', needed by 'vm_outline_strong.dill', missing and no known rule to make it
Original change's description:
> Auto-generate the package_config.json file on gclient sync.
>
> Change-Id: Ibb5e548c0738e7dd0061433cf054af8336a0683b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234320
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>
TBR=lrn@google.com,devoncarew@google.com,athom@google.com
Change-Id: Ic2b7ae3feedfa064ddbbdb0b36f0e3db088bf177
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234802
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
new file mode 100644
index 0000000..51bc8f5
--- /dev/null
+++ b/.dart_tool/package_config.json
@@ -0,0 +1,825 @@
+{
+ "copyright": [
+ "Copyright (c) 2022, 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."
+ ],
+ "comment": [
+ "Package configuration for all packages in /pkg, and checked out by DEPS",
+ "into /third_party/pkg and /third_party/pkg_tested.",
+ "If you add a package to DEPS or /pkg or change a package's SDK",
+ "constraint, update this by running tools/generate_package_config.dart."
+ ],
+ "configVersion": 2,
+ "generator": "tools/generate_package_config.dart",
+ "packages": [
+ {
+ "name": "_fe_analyzer_shared",
+ "rootUri": "../pkg/_fe_analyzer_shared",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "_fe_analyzer_shared_assigned_variables",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_definite_assignment",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_definite_unassignment",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_inheritance",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/inheritance",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_nullability",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/nullability",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_reachability",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/reachability",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_type_promotion",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_fe_analyzer_shared_why_not_promoted",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "_js_interop_checks",
+ "rootUri": "../pkg/_js_interop_checks",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "analysis_server",
+ "rootUri": "../pkg/analysis_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "analysis_server_client",
+ "rootUri": "../pkg/analysis_server_client",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "analyzer",
+ "rootUri": "../pkg/analyzer",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "analyzer_cli",
+ "rootUri": "../pkg/analyzer_cli",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "analyzer_plugin",
+ "rootUri": "../pkg/analyzer_plugin",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "analyzer_utilities",
+ "rootUri": "../pkg/analyzer_utilities",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "args",
+ "rootUri": "../third_party/pkg/args",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "async",
+ "rootUri": "../third_party/pkg/async",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "async_helper",
+ "rootUri": "../pkg/async_helper",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "bazel_worker",
+ "rootUri": "../third_party/pkg/bazel_worker",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "benchmark_harness",
+ "rootUri": "../third_party/pkg/benchmark_harness",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "boolean_selector",
+ "rootUri": "../third_party/pkg/boolean_selector",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "browser_launcher",
+ "rootUri": "../third_party/pkg/browser_launcher",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "build_integration",
+ "rootUri": "../pkg/build_integration",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "characters",
+ "rootUri": "../third_party/pkg/characters",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "charcode",
+ "rootUri": "../third_party/pkg/charcode",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "cli_util",
+ "rootUri": "../third_party/pkg/cli_util",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "clock",
+ "rootUri": "../third_party/pkg/clock",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "collection",
+ "rootUri": "../third_party/pkg/collection",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "compiler",
+ "rootUri": "../pkg/compiler",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "convert",
+ "rootUri": "../third_party/pkg/convert",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "crypto",
+ "rootUri": "../third_party/pkg/crypto",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "csslib",
+ "rootUri": "../third_party/pkg/csslib",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dart2js_info",
+ "rootUri": "../pkg/dart2js_info",
+ "packageUri": "lib/",
+ "languageVersion": "2.11"
+ },
+ {
+ "name": "dart2js_runtime_metrics",
+ "rootUri": "../pkg/dart2js_runtime_metrics",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "dart2js_tools",
+ "rootUri": "../pkg/dart2js_tools",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dart2native",
+ "rootUri": "../pkg/dart2native",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dart2wasm",
+ "rootUri": "../pkg/dart2wasm",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dart_internal",
+ "rootUri": "../pkg/dart_internal",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dart_style",
+ "rootUri": "../third_party/pkg_tested/dart_style",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dartdev",
+ "rootUri": "../pkg/dartdev",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "dartdoc",
+ "rootUri": "../third_party/pkg/dartdoc",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "dds",
+ "rootUri": "../pkg/dds",
+ "packageUri": "lib/",
+ "languageVersion": "2.13"
+ },
+ {
+ "name": "dds_service_extensions",
+ "rootUri": "../pkg/dds_service_extensions",
+ "packageUri": "lib/",
+ "languageVersion": "2.13"
+ },
+ {
+ "name": "dev_compiler",
+ "rootUri": "../pkg/dev_compiler",
+ "packageUri": "lib/",
+ "languageVersion": "2.15"
+ },
+ {
+ "name": "devtools_shared",
+ "rootUri": "../third_party/devtools/devtools_shared",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "expect",
+ "rootUri": "../pkg/expect",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "ffi",
+ "rootUri": "../third_party/pkg/ffi",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "file",
+ "rootUri": "../third_party/pkg/file/packages/file",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "file_testing",
+ "rootUri": "../third_party/pkg/file/packages/file_testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "fixnum",
+ "rootUri": "../third_party/pkg/fixnum",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "front_end",
+ "rootUri": "../pkg/front_end",
+ "packageUri": "lib/",
+ "languageVersion": "2.13"
+ },
+ {
+ "name": "front_end_testcases",
+ "rootUri": "../pkg/front_end/testcases",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "frontend_server",
+ "rootUri": "../pkg/frontend_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "frontend_server_client",
+ "rootUri": "../third_party/pkg/webdev/frontend_server_client",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "glob",
+ "rootUri": "../third_party/pkg/glob",
+ "packageUri": "lib/",
+ "languageVersion": "2.15"
+ },
+ {
+ "name": "html",
+ "rootUri": "../third_party/pkg/html",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "http",
+ "rootUri": "../third_party/pkg/http",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "http_io",
+ "rootUri": "../third_party/pkg_tested/http_io",
+ "packageUri": "lib/",
+ "languageVersion": "2.5"
+ },
+ {
+ "name": "http_multi_server",
+ "rootUri": "../third_party/pkg/http_multi_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "http_parser",
+ "rootUri": "../third_party/pkg/http_parser",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "intl",
+ "rootUri": "../third_party/pkg/intl",
+ "packageUri": "lib/",
+ "languageVersion": "2.11"
+ },
+ {
+ "name": "js",
+ "rootUri": "../pkg/js",
+ "packageUri": "lib/",
+ "languageVersion": "2.16"
+ },
+ {
+ "name": "js_ast",
+ "rootUri": "../pkg/js_ast",
+ "packageUri": "lib/",
+ "languageVersion": "2.10"
+ },
+ {
+ "name": "js_runtime",
+ "rootUri": "../pkg/js_runtime",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "json_rpc_2",
+ "rootUri": "../third_party/pkg/json_rpc_2",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "kernel",
+ "rootUri": "../pkg/kernel",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "language_versioning_2.7_test",
+ "rootUri": "../pkg/language_versioning_2.7_test",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "linter",
+ "rootUri": "../third_party/pkg/linter",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "lints",
+ "rootUri": "../third_party/pkg/lints",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "logging",
+ "rootUri": "../third_party/pkg/logging",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "markdown",
+ "rootUri": "../third_party/pkg/markdown",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "matcher",
+ "rootUri": "../third_party/pkg/matcher",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "meta",
+ "rootUri": "../pkg/meta",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "mime",
+ "rootUri": "../third_party/pkg/mime",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "mockito",
+ "rootUri": "../third_party/pkg/mockito",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "modular_test",
+ "rootUri": "../pkg/modular_test",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "native_stack_traces",
+ "rootUri": "../pkg/native_stack_traces",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "nnbd_migration",
+ "rootUri": "../pkg/nnbd_migration",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "oauth2",
+ "rootUri": "../third_party/pkg/oauth2",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "observatory",
+ "rootUri": "../runtime/observatory",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "observatory_2",
+ "rootUri": "../runtime/observatory_2",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "observatory_test_package",
+ "rootUri": "../runtime/observatory/tests/service/observatory_test_package",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "observatory_test_package_2",
+ "rootUri": "../runtime/observatory_2/tests/service_2/observatory_test_package_2",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "package_config",
+ "rootUri": "../third_party/pkg_tested/package_config",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "package_deps",
+ "rootUri": "../tools/package_deps",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "path",
+ "rootUri": "../third_party/pkg/path",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "pedantic",
+ "rootUri": "../third_party/pkg/pedantic",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "platform",
+ "rootUri": "../third_party/pkg/platform",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "pool",
+ "rootUri": "../third_party/pkg/pool",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "process",
+ "rootUri": "../third_party/pkg/process",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "protobuf",
+ "rootUri": "../third_party/pkg/protobuf/protobuf",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "pub",
+ "rootUri": "../third_party/pkg/pub",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "pub_semver",
+ "rootUri": "../third_party/pkg/pub_semver",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "scrape",
+ "rootUri": "../pkg/scrape",
+ "packageUri": "lib/",
+ "languageVersion": "2.13"
+ },
+ {
+ "name": "sdk_library_metadata",
+ "rootUri": "../sdk/lib/_internal/sdk_library_metadata",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "shelf",
+ "rootUri": "../third_party/pkg/shelf",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "shelf_packages_handler",
+ "rootUri": "../third_party/pkg/shelf_packages_handler",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "shelf_proxy",
+ "rootUri": "../third_party/pkg/shelf_proxy",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "shelf_static",
+ "rootUri": "../third_party/pkg/shelf_static",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "shelf_web_socket",
+ "rootUri": "../third_party/pkg/shelf_web_socket",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "smith",
+ "rootUri": "../pkg/smith",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "source_map_stack_trace",
+ "rootUri": "../third_party/pkg/source_map_stack_trace",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "source_maps",
+ "rootUri": "../third_party/pkg/source_maps",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "source_span",
+ "rootUri": "../third_party/pkg/source_span",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "sourcemap_testing",
+ "rootUri": "../pkg/sourcemap_testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "sse",
+ "rootUri": "../third_party/pkg/sse",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "stack_trace",
+ "rootUri": "../third_party/pkg/stack_trace",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "status_file",
+ "rootUri": "../pkg/status_file",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "stream_channel",
+ "rootUri": "../third_party/pkg/stream_channel",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "string_scanner",
+ "rootUri": "../third_party/pkg/string_scanner",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "sync_http",
+ "rootUri": "../third_party/pkg/sync_http",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "telemetry",
+ "rootUri": "../pkg/telemetry",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "term_glyph",
+ "rootUri": "../third_party/pkg/term_glyph",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test",
+ "rootUri": "../third_party/pkg/test/pkgs/test",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_api",
+ "rootUri": "../third_party/pkg/test/pkgs/test_api",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_core",
+ "rootUri": "../third_party/pkg/test/pkgs/test_core",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_descriptor",
+ "rootUri": "../third_party/pkg/test_descriptor",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_package",
+ "rootUri": "../pkg/vm_service/test/test_package",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_process",
+ "rootUri": "../third_party/pkg/test_process",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_reflective_loader",
+ "rootUri": "../third_party/pkg/test_reflective_loader",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "test_runner",
+ "rootUri": "../pkg/test_runner",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "testing",
+ "rootUri": "../pkg/testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "typed_data",
+ "rootUri": "../third_party/pkg/typed_data",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "usage",
+ "rootUri": "../third_party/pkg/usage",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "vector_math",
+ "rootUri": "../third_party/pkg/vector_math",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "vm",
+ "rootUri": "../pkg/vm",
+ "packageUri": "lib/",
+ "languageVersion": "2.15"
+ },
+ {
+ "name": "vm_service",
+ "rootUri": "../pkg/vm_service",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "vm_snapshot_analysis",
+ "rootUri": "../pkg/vm_snapshot_analysis",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "wasm_builder",
+ "rootUri": "../pkg/wasm_builder",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "watcher",
+ "rootUri": "../third_party/pkg/watcher",
+ "packageUri": "lib/",
+ "languageVersion": "2.14"
+ },
+ {
+ "name": "web_components",
+ "rootUri": "../third_party/pkg/web_components",
+ "packageUri": "lib/",
+ "languageVersion": "1.9"
+ },
+ {
+ "name": "web_socket_channel",
+ "rootUri": "../third_party/pkg/web_socket_channel",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "webdriver",
+ "rootUri": "../third_party/pkg/webdriver",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "webkit_inspection_protocol",
+ "rootUri": "../third_party/pkg/webkit_inspection_protocol",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "yaml",
+ "rootUri": "../third_party/pkg/yaml",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "yaml_edit",
+ "rootUri": "../third_party/pkg/yaml_edit",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ }
+ ]
+}
diff --git a/.gitignore b/.gitignore
index 9c674bd..1f4ccc7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,10 +75,6 @@
packages
pubspec.lock
-# The top level package files (these are auto-generated per checkout)
-/.dart_tool/package_config.json
-/.packages
-
# Local pub storage
.pub
diff --git a/.packages b/.packages
new file mode 100644
index 0000000..646a631
--- /dev/null
+++ b/.packages
@@ -0,0 +1,130 @@
+# 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'.
+
+_fe_analyzer_shared:pkg/_fe_analyzer_shared/lib
+_js_interop_checks:pkg/_js_interop_checks/lib
+analysis_server:pkg/analysis_server/lib
+analysis_server_client:pkg/analysis_server_client/lib
+analyzer:pkg/analyzer/lib
+analyzer_cli:pkg/analyzer_cli/lib
+analyzer_plugin:pkg/analyzer_plugin/lib
+analyzer_utilities:pkg/analyzer_utilities/lib
+args:third_party/pkg/args/lib
+async:third_party/pkg/async/lib
+async_helper:pkg/async_helper/lib
+bazel_worker:third_party/pkg/bazel_worker/lib
+benchmark_harness:third_party/pkg/benchmark_harness/lib
+boolean_selector:third_party/pkg/boolean_selector/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
+crypto:third_party/pkg/crypto/lib
+csslib:third_party/pkg/csslib/lib
+dart2js_info:pkg/dart2js_info/lib
+dart2js_runtime_metrics:pkg/dart2js_runtime_metrics/lib
+dart2js_tools:pkg/dart2js_tools/lib
+dart2native:pkg/dart2native/lib
+dart2wasm:pkg/dart2wasm/lib
+dart_internal:pkg/dart_internal/lib
+dart_style:third_party/pkg_tested/dart_style/lib
+dartdev:pkg/dartdev/lib
+dartdoc:third_party/pkg/dartdoc/lib
+dds:pkg/dds/lib
+dds_service_extensions:pkg/dds_service_extensions/lib
+dev_compiler:pkg/dev_compiler/lib
+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
+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
+http_io:third_party/pkg_tested/http_io/lib
+http_multi_server:third_party/pkg/http_multi_server/lib
+http_parser:third_party/pkg/http_parser/lib
+intl:third_party/pkg/intl/lib
+js:pkg/js/lib
+js_ast:pkg/js_ast/lib
+js_runtime:pkg/js_runtime/lib
+json_rpc_2:third_party/pkg/json_rpc_2/lib
+kernel:pkg/kernel/lib
+linter:third_party/pkg/linter/lib
+lints:third_party/pkg/lints/lib
+logging:third_party/pkg/logging/lib
+markdown:third_party/pkg/markdown/lib
+matcher:third_party/pkg/matcher/lib
+meta:pkg/meta/lib
+mime:third_party/pkg/mime/lib
+mockito:third_party/pkg/mockito/lib
+modular_test:pkg/modular_test/lib
+native_stack_traces:pkg/native_stack_traces/lib
+nnbd_migration:pkg/nnbd_migration/lib
+oauth2:third_party/pkg/oauth2/lib
+observatory:runtime/observatory/lib
+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
+platform:third_party/pkg/platform/lib
+pool:third_party/pkg/pool/lib
+process:third_party/pkg/process/lib
+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
+shelf_proxy:third_party/pkg/shelf_proxy/lib
+shelf_static:third_party/pkg/shelf_static/lib
+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
+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
+stream_channel:third_party/pkg/stream_channel/lib
+string_scanner:third_party/pkg/string_scanner/lib
+sync_http:third_party/pkg/sync_http/lib
+telemetry:pkg/telemetry/lib
+term_glyph:third_party/pkg/term_glyph/lib
+test:third_party/pkg/test/pkgs/test/lib
+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_process:third_party/pkg/test_process/lib
+test_reflective_loader:third_party/pkg/test_reflective_loader/lib
+test_runner:pkg/test_runner/lib
+testing:pkg/testing/lib
+typed_data:third_party/pkg/typed_data/lib
+usage:third_party/pkg/usage/lib
+vector_math:third_party/pkg/vector_math/lib
+vm:pkg/vm/lib
+vm_service:pkg/vm_service/lib
+vm_snapshot_analysis:pkg/vm_snapshot_analysis/lib
+wasm_builder:pkg/wasm_builder/lib
+watcher:third_party/pkg/watcher/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/DEPS b/DEPS
index 783aa7b..276e2bd 100644
--- a/DEPS
+++ b/DEPS
@@ -698,12 +698,6 @@
hooks = [
{
- # Generate the .dart_tool/package_confg.json file.
- 'name': 'Generate .dart_tool/package_confg.json',
- 'pattern': '.',
- 'action': ['python3', 'sdk/tools/generate_package_config.py'],
- },
- {
# Pull Debian sysroot for i386 Linux
'name': 'sysroot_i386',
'pattern': '.',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 6a47593..fc93703 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -237,6 +237,31 @@
return []
+def _CheckPackageConfigUpToDate(input_api, output_api):
+ """Checks that .dart_tool/package_config.json is up to date."""
+ # Run only if DEPS file or package_config.json have been modified.
+ if not any(p == 'DEPS' or p == '.dart_tool/package_config.json' or
+ p.endswith('pubspec.yaml') for p in input_api.LocalPaths()):
+ return []
+ local_root = input_api.change.RepositoryRoot()
+ utils = imp.load_source('utils',
+ os.path.join(local_root, 'tools', 'utils.py'))
+
+ dart = utils.CheckedInSdkExecutable()
+ generate = os.path.join(local_root, 'tools', 'generate_package_config.dart')
+ cmd = [dart, generate, '--check']
+ result = subprocess.run(cmd, shell=utils.IsWindows())
+ if result.returncode != 0:
+ return [
+ output_api.PresubmitError(
+ 'File .dart_tool/package_config.json is out of date.\n'
+ 'Fix these issues with:\n'
+ 'gclient sync -D && %s tools/generate_package_config.dart' %
+ (dart))
+ ]
+ return []
+
+
def _CheckValidHostsInDEPS(input_api, output_api):
"""Checks that DEPS file deps are from allowed_hosts."""
# Run only if DEPS file has been modified to annoy fewer bystanders.
@@ -357,6 +382,7 @@
results.extend(_CheckLayering(input_api, output_api))
results.extend(_CheckClangTidy(input_api, output_api))
results.extend(_CheckTestMatrixValid(input_api, output_api))
+ results.extend(_CheckPackageConfigUpToDate(input_api, output_api))
results.extend(
input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
return results
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 8845d5c..b35e47a 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -3560,6 +3560,14 @@
]
},
{
+ "name": "validate .dart_tool/package_config.json",
+ "script": "tools/sdks/dart-sdk/bin/dart",
+ "arguments": [
+ "tools/generate_package_config.dart",
+ "--check"
+ ]
+ },
+ {
"name": "build dart",
"script": "tools/build.py",
"arguments": [
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 417b548..b4ba277 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -1,80 +1,136 @@
-// Copyright (c) 2020, 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.
+#!/usr/bin/env dart
/// Generates the repo's ".dart_tool/package_config.json" file.
import 'dart:convert';
import 'dart:io';
-// Important! Do not add package: imports to this file.
-// Do not add relative deps for libraries that themselves use package deps.
-// This tool runs before the .dart_tool/package_config.json file is created, so
-// can not itself use package references.
+import 'package:args/args.dart';
+import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
+import 'package:yaml/yaml.dart';
-final repoRoot = dirname(dirname(fromUri(Platform.script)));
+bool _parseOptions(List<String> args) {
+ const usage = "Usage: dart generate_package_config.dart [flags...]";
+
+ var parser = ArgParser();
+
+ parser.addFlag("help", abbr: "h");
+
+ parser.addFlag("check",
+ abbr: "c",
+ help: "Return with a non-zero exit code if not up-to-date",
+ negatable: false);
+
+ var results = parser.parse(args);
+
+ if (results["help"] as bool) {
+ print("Regenerate the .dart_tool/package_config.json file.");
+ print("");
+ print(usage);
+ print("");
+ print(parser.usage);
+ exit(0);
+ }
+
+ return results["check"] as bool;
+}
+
+final repoRoot = p.dirname(p.dirname(p.fromUri(Platform.script)));
+final configFilePath = p.join(repoRoot, '.dart_tool/package_config.json');
void main(List<String> args) {
+ bool checkOnly = _parseOptions(args);
+
var packageDirs = [
- ...listSubdirectories(platform('pkg')),
- ...listSubdirectories(platform('third_party/pkg_tested')),
- ...listSubdirectories(platform('third_party/pkg')),
- ...listSubdirectories(platform('third_party/pkg/file/packages')),
- ...listSubdirectories(platform('third_party/pkg/test/pkgs')),
- platform('pkg/vm_service/test/test_package'),
- platform('runtime/observatory_2'),
- platform(
+ ...listSubdirectories('pkg'),
+ ...listSubdirectories('third_party/pkg'),
+ ...listSubdirectories('third_party/pkg_tested'),
+ ...listSubdirectories('third_party/pkg/file/packages'),
+ ...listSubdirectories('third_party/pkg/test/pkgs'),
+ packageDirectory('runtime/observatory'),
+ packageDirectory(
+ 'runtime/observatory/tests/service/observatory_test_package'),
+ packageDirectory('runtime/observatory_2'),
+ packageDirectory(
'runtime/observatory_2/tests/service_2/observatory_test_package_2'),
- platform('runtime/observatory'),
- platform('runtime/observatory/tests/service/observatory_test_package'),
- platform('sdk/lib/_internal/sdk_library_metadata'),
- platform('third_party/devtools/devtools_shared'),
- platform('third_party/pkg/protobuf/protobuf'),
- platform('third_party/pkg/webdev/frontend_server_client'),
- platform('tools/package_deps'),
+ packageDirectory('pkg/vm_service/test/test_package'),
+ packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
+ packageDirectory('third_party/devtools/devtools_shared'),
+ packageDirectory('third_party/pkg/protobuf/protobuf'),
+ packageDirectory('third_party/pkg/webdev/frontend_server_client'),
+ packageDirectory('tools/package_deps'),
];
var cfePackageDirs = [
- platform('pkg/front_end/testcases'),
+ packageDirectory('pkg/front_end/testcases/'),
];
var feAnalyzerSharedPackageDirs = [
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables'),
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment'),
- platform(
- 'pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment'),
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/nullability'),
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/reachability'),
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion'),
- platform('pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted'),
- platform('pkg/_fe_analyzer_shared/test/inheritance'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment/'),
+ packageDirectory('pkg/_fe_analyzer_shared/test/flow_analysis/nullability/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/reachability/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted//'),
+ packageDirectory('pkg/_fe_analyzer_shared/test/inheritance/'),
];
- var packages = <Package>[
+ var packages = [
...makePackageConfigs(packageDirs),
...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(join(repoRoot, '.dart_tool', 'package_config.json'));
- var packageConfig = PackageConfig(
- packages,
- extraData: {
- 'copyright': [
- 'Copyright (c) 2020, 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.',
- ],
- 'comment': [
- 'Package configuration for all packages in pkg/, third_party/pkg/, and',
- 'third_party/pkg_tested/',
- ],
- },
- );
- writeIfDifferent(configFile, packageConfig.generateJson('..'));
+ var configFile = File(p.join(repoRoot, '.dart_tool', 'package_config.json'));
+ var json = jsonDecode(configFile.readAsStringSync()) as Map<dynamic, dynamic>;
+ var oldPackages = json['packages'] as List<dynamic>;
- // Also generate the repo's .packages file.
- var packagesFile = File(join(repoRoot, '.packages'));
+ 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;
+ var config = <String, dynamic>{
+ 'copyright': [
+ 'Copyright (c) $year, 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.'
+ ],
+ 'comment': [
+ 'Package configuration for all packages in /pkg, and checked out by DEPS',
+ 'into /third_party/pkg and /third_party/pkg_tested.',
+ 'If you add a package to DEPS or /pkg or change a package\'s SDK',
+ 'constraint, update this by running tools/generate_package_config.dart.'
+ ],
+ 'configVersion': 2,
+ 'generator': 'tools/generate_package_config.dart',
+ 'packages': packages,
+ };
+
+ // TODO(rnystrom): Consider using package_config_v2 to generate this instead.
+ var jsonString = JsonEncoder.withIndent(' ').convert(config);
+ configFile.writeAsStringSync('$jsonString\n');
+
+ // 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
@@ -85,190 +141,114 @@
''');
for (var package in packages) {
- final name = package.name;
- final rootUri = package.rootUri;
- final packageUri = package.packageUri;
-
+ 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:${posix(rootUri)}/${posix(packageUri)}');
+ buffer.writeln('$name:$path/$packageUri');
}
}
- writeIfDifferent(packagesFile, buffer.toString());
-}
-
-/// Writes the given [contents] string to [file] if the contents are different
-/// than what's currently in the file.
-///
-/// This updates the file to the given contents, while preserving the file
-/// timestamp if there are no changes.
-void writeIfDifferent(File file, String contents) {
- if (!file.existsSync() || file.readAsStringSync() != contents) {
- file.writeAsStringSync(contents);
- }
+ packagesFile.writeAsStringSync(buffer.toString());
}
/// Generates package configurations for each package in [packageDirs].
-Iterable<Package> makePackageConfigs(List<String> packageDirs) sync* {
+Iterable<Map<String, String>> makePackageConfigs(
+ List<String> packageDirs) sync* {
for (var packageDir in packageDirs) {
var version = pubspecLanguageVersion(packageDir);
- var hasLibDirectory =
- Directory(join(repoRoot, packageDir, 'lib')).existsSync();
+ var hasLibDirectory = Directory(p.join(packageDir, 'lib')).existsSync();
- yield Package(
- name: basename(packageDir),
- rootUri: packageDir,
- packageUri: hasLibDirectory ? 'lib/' : null,
- languageVersion: version,
- );
- }
-}
-
-/// Generates package configurations for the special pseudo-packages used by the
-/// CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`).
-Iterable<Package> makeCfePackageConfigs(List<String> packageDirs) sync* {
- // TODO: Remove the use of '.nonexisting/'.
- for (var packageDir in packageDirs) {
- yield Package(
- name: 'front_end_${basename(packageDir)}',
- rootUri: packageDir,
- packageUri: '.nonexisting/',
- );
- }
-}
-
-/// Generates package configurations for the special pseudo-packages used by the
-/// _fe_analyzer_shared id tests.
-Iterable<Package> makeFeAnalyzerSharedPackageConfigs(
- List<String> packageDirs) sync* {
- // TODO: Remove the use of '.nonexisting/'.
- for (var packageDir in packageDirs) {
- yield Package(
- name: '_fe_analyzer_shared_${basename(packageDir)}',
- rootUri: packageDir,
- packageUri: '.nonexisting/',
- );
- }
-}
-
-/// Finds the paths of the immediate subdirectories of [dir] that
-/// contain pubspecs.
-Iterable<String> listSubdirectories(String dir) sync* {
- for (var entry in Directory(join(repoRoot, dir)).listSync()) {
- if (entry is! Directory) continue;
- if (!File(join(entry.path, 'pubspec.yaml')).existsSync()) continue;
- yield join(dir, basename(entry.path));
- }
-}
-
-final versionRE = RegExp(r"(?:\^|>=)(\d+\.\d+)");
-
-/// Infers the language version from the SDK constraint in the pubspec for
-/// [packageDir].
-///
-/// The version is returned in the form `major.minor`.
-String? pubspecLanguageVersion(String packageDir) {
- var pubspecFile = File(join(repoRoot, packageDir, 'pubspec.yaml'));
-
- if (!pubspecFile.existsSync()) {
- print("Error: Missing pubspec for $packageDir.");
- exit(1);
- }
-
- var contents = pubspecFile.readAsLinesSync();
- if (!contents.any((line) => line.contains('sdk: '))) {
- print("Error: Pubspec for $packageDir has no SDK constraint.");
- exit(1);
- }
-
- // Handle either "sdk: >=2.14.0 <3.0.0" or "sdk: ^2.3.0".
- var sdkConstraint = contents.firstWhere((line) => line.contains('sdk: '));
- sdkConstraint = sdkConstraint.trim().substring('sdk:'.length).trim();
- if (sdkConstraint.startsWith('"') || sdkConstraint.startsWith("'")) {
- sdkConstraint = sdkConstraint.substring(1, sdkConstraint.length - 2);
- }
-
- var match = versionRE.firstMatch(sdkConstraint);
- if (match == null) {
- print("Error: unknown version range for $packageDir: '$sdkConstraint'.");
- exit(1);
- }
- return match[1]!;
-}
-
-class Package {
- final String name;
- final String rootUri;
- final String? packageUri;
- final String? languageVersion;
-
- Package({
- required this.name,
- required this.rootUri,
- this.packageUri,
- this.languageVersion,
- });
-
- Map<String, Object?> toMap(String relativeTo) {
- return {
- 'name': name,
- 'rootUri': posix(join(relativeTo, rootUri)),
- if (packageUri != null) 'packageUri': posix(packageUri!),
- if (languageVersion != null) 'languageVersion': languageVersion,
+ yield {
+ 'name': p.basename(packageDir),
+ 'rootUri': p
+ .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
+ .toString(),
+ if (hasLibDirectory) 'packageUri': 'lib/',
+ 'languageVersion': '${version.major}.${version.minor}'
};
}
}
-class PackageConfig {
- final List<Package> packages;
- final Map<String, Object?>? extraData;
-
- PackageConfig(this.packages, {this.extraData});
-
- String generateJson(String relativeTo) {
- var config = <String, Object?>{};
- if (extraData != null) {
- for (var key in extraData!.keys) {
- config[key] = extraData![key];
- }
- }
- config['configVersion'] = 2;
- config['generator'] = 'tools/generate_package_config.dart';
- config['packages'] =
- packages.map((package) => package.toMap(relativeTo)).toList();
- var jsonString = JsonEncoder.withIndent(' ').convert(config);
- return '$jsonString\n';
+/// Generates package configurations for the special pseudo-packages used by
+/// the CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`).
+Iterable<Map<String, String>> makeCfePackageConfigs(
+ List<String> packageDirs) sync* {
+ for (var packageDir in packageDirs) {
+ yield {
+ 'name': 'front_end_${p.basename(packageDir)}',
+ 'rootUri': p
+ .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
+ .toString(),
+ 'packageUri': '.nonexisting/',
+ };
}
}
-// Below are some (very simplified) versions of the package:path functions.
-
-final String _separator = Platform.pathSeparator;
-
-String dirname(String s) {
- return s.substring(0, s.lastIndexOf(_separator));
-}
-
-String join(String s1, String s2, [String? s3]) {
- if (s3 != null) {
- return join(join(s1, s2), s3);
- } else {
- return s1.endsWith(_separator) ? '$s1$s2' : '$s1$_separator$s2';
+/// Generates package configurations for the special pseudo-packages used by
+/// the _fe_analyzer_shared id tests.
+Iterable<Map<String, String>> makeFeAnalyzerSharedPackageConfigs(
+ List<String> packageDirs) sync* {
+ for (var packageDir in packageDirs) {
+ yield {
+ 'name': '_fe_analyzer_shared_${p.basename(packageDir)}',
+ 'rootUri': p
+ .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
+ .toString(),
+ 'packageUri': '.nonexisting/',
+ };
}
}
-String basename(String s) {
- while (s.endsWith(_separator)) {
- s = s.substring(0, s.length - 1);
+/// Generates a path to [relativePath] within the repo.
+String packageDirectory(String relativePath) => p.join(repoRoot, relativePath);
+
+/// Finds the paths of the immediate subdirectories of [packagesDir] that
+/// contain pubspecs.
+Iterable<String> listSubdirectories(String packagesDir) sync* {
+ for (var entry in Directory(p.join(repoRoot, packagesDir)).listSync()) {
+ if (entry is! Directory) continue;
+ if (!File(p.join(entry.path, 'pubspec.yaml')).existsSync()) continue;
+ yield entry.path;
}
- return s.substring(s.lastIndexOf(_separator) + 1);
}
-String fromUri(Uri uri) => uri.toFilePath();
+/// Infers the language version from the SDK constraint in the pubspec for
+/// [packageDir].
+Version pubspecLanguageVersion(String packageDir) {
+ final dartVersion2 = Version.parse('2.0.0');
-/// Given a platform path, return a posix one.
-String posix(String s) =>
- Platform.isWindows ? s.replaceAll(_separator, '/') : s;
+ var pubspecFile = File(p.join(packageDir, 'pubspec.yaml'));
+ var relative = p.relative(packageDir, from: repoRoot);
-/// Given a posix path, return a platform one.
-String platform(String s) =>
- Platform.isWindows ? s.replaceAll('/', _separator) : s;
+ if (!pubspecFile.existsSync()) {
+ print("Error: Missing pubspec for $relative.");
+ exit(1);
+ }
+
+ var pubspec =
+ loadYaml(pubspecFile.readAsStringSync()) as Map<dynamic, dynamic>;
+ if (!pubspec.containsKey('environment')) {
+ print("Error: Pubspec for $relative has no SDK constraint.");
+ exit(1);
+ }
+
+ var environment = pubspec['environment'] as Map<dynamic, dynamic>;
+ if (!environment.containsKey('sdk')) {
+ print("Error: Pubspec for $relative has no SDK constraint.");
+ exit(1);
+ }
+
+ var sdkConstraint = VersionConstraint.parse(environment['sdk'] as String);
+ if (sdkConstraint is VersionRange) {
+ return sdkConstraint.min ?? dartVersion2;
+ }
+
+ print("Error: SDK constraint $relative is not a version range.");
+ exit(1);
+}
diff --git a/tools/generate_package_config.py b/tools/generate_package_config.py
deleted file mode 100644
index b763b3d..0000000
--- a/tools/generate_package_config.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2022, 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.
-
-# Invoke the `tools/generate_package_config.dart` script.
-
-import os
-import os.path
-import platform
-import subprocess
-import sys
-
-USE_PYTHON3 = True
-
-
-def is_windows():
- os_id = platform.system()
- return os_id == 'Windows'
-
-
-def checked_in_sdk_path():
- tools_dir = os.path.dirname(os.path.realpath(__file__))
- return os.path.join(tools_dir, 'sdks', 'dart-sdk')
-
-
-def checked_in_sdk_executable():
- name = 'dart'
- if is_windows():
- name = 'dart.exe'
- return os.path.join(checked_in_sdk_path(), 'bin', name)
-
-
-def generate_package_config():
- tools_dir = os.path.dirname(os.path.realpath(__file__))
- process = subprocess.run([
- checked_in_sdk_executable(),
- os.path.join(tools_dir, 'generate_package_config.dart')
- ])
- return process.returncode
-
-
-def Main():
- sys.exit(generate_package_config())
-
-
-if __name__ == '__main__':
- Main()