From 6c4de1ab7e7635363fa67f86f17c6bbb35d52538 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Fri, 14 Mar 2025 09:08:20 -0700 Subject: [PATCH] Revert "Migrate to use pub workspace" This reverts commit b9b77058a9fa6430603b81b601fdc0c031cb9f63. Revert "Add missing sample pubspec to workspace" This reverts commit 892ea15ac73f0a89b080135d70f9ff35b0edcfc0. These seem to break the engine. Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731 Tested: this is a revert. CoreLibraryReviewExempt: this is a revert Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582 Commit-Queue: Sigurd Meldgaard Reviewed-by: Alexander Thomas --- .gitignore | 2 +- pkg/_fe_analyzer_shared/pubspec.yaml | 6 +- pkg/_js_interop_checks/pubspec.yaml | 2 - pkg/_macros/pubspec.yaml | 4 +- pkg/analysis_server/pubspec.yaml | 126 ++++- pkg/analysis_server_client/pubspec.yaml | 2 - pkg/analysis_server_plugin/pubspec.yaml | 125 ++++- pkg/analyzer/pubspec.yaml | 15 +- pkg/analyzer_cli/pubspec.yaml | 2 - pkg/analyzer_plugin/pubspec.yaml | 10 +- pkg/analyzer_utilities/pubspec.yaml | 2 - pkg/async_helper/pubspec.yaml | 2 - pkg/bisect_dart/pubspec.yaml | 2 - pkg/build_integration/pubspec.yaml | 2 - pkg/compiler/pubspec.yaml | 2 - pkg/dart2bytecode/pubspec.yaml | 2 - pkg/dart2js_info/pubspec.yaml | 2 - pkg/dart2js_runtime_metrics/pubspec.yaml | 2 - pkg/dart2js_tools/pubspec.yaml | 2 - pkg/dart2native/pubspec.yaml | 2 - pkg/dart2wasm/pubspec.yaml | 2 - pkg/dart_internal/pubspec.yaml | 1 - pkg/dart_service_protocol_shared/pubspec.yaml | 2 - pkg/dartdev/pubspec.yaml | 4 +- pkg/dds/pubspec.yaml | 1 - pkg/dds_service_extensions/pubspec.yaml | 1 - pkg/dev_compiler/pubspec.yaml | 2 - pkg/dtd/pubspec.yaml | 2 - pkg/dtd_impl/pubspec.yaml | 2 - pkg/dynamic_modules/pubspec.yaml | 2 - pkg/expect/pubspec.yaml | 2 - pkg/front_end/pubspec.yaml | 41 +- pkg/front_end/testcases/pubspec.yaml | 6 - pkg/frontend_server/pubspec.yaml | 2 - pkg/heap_snapshot/pubspec.yaml | 5 +- pkg/js/pubspec.yaml | 2 - pkg/js_ast/pubspec.yaml | 2 - pkg/js_runtime/pubspec.yaml | 2 - pkg/js_shared/pubspec.yaml | 2 - pkg/kernel/pubspec.yaml | 2 - pkg/linter/pubspec.yaml | 2 - pkg/macros/pubspec.yaml | 2 - pkg/meta/pubspec.yaml | 2 - pkg/mmap/pubspec.yaml | 2 - pkg/modular_test/pubspec.yaml | 2 - pkg/native_stack_traces/pubspec.yaml | 2 - pkg/node_preamble/pubspec.yaml | 3 - pkg/record_use/pubspec.yaml | 2 - pkg/reload_test/pubspec.yaml | 2 - pkg/scrape/pubspec.yaml | 2 - pkg/server_plugin/pubspec.yaml | 121 ++++- pkg/smith/pubspec.yaml | 2 - pkg/sourcemap_testing/pubspec.yaml | 2 - pkg/status_file/pubspec.yaml | 2 - pkg/telemetry/pubspec.yaml | 2 - pkg/test_runner/pubspec.yaml | 2 - pkg/testing/pubspec.yaml | 2 - pkg/vm/pubspec.yaml | 2 - pkg/vm_service/pubspec.yaml | 1 - pkg/vm_service/test/test_package/pubspec.yaml | 3 +- pkg/vm_service_interface/pubspec.yaml | 1 - pkg/vm_service_protos/pubspec.yaml | 1 - pkg/vm_snapshot_analysis/pubspec.yaml | 1 - pkg/wasm_builder/pubspec.yaml | 2 - pubspec.yaml | 319 ------------- runtime/tools/heapsnapshot/pubspec.yaml | 5 + samples/ffi/http/pubspec.yaml | 4 +- sdk/lib/js_util/js_util.dart | 4 +- third_party/pkg/dap/pubspec.yaml | 4 +- .../pkg/language_server_protocol/pubspec.yaml | 4 +- tools/generate_package_config.dart | 435 +++++++++++++++--- tools/package_deps/pubspec.yaml | 2 - tools/pubspec.yaml | 2 - tools/run_offsets_extractor.dart | 17 +- 74 files changed, 818 insertions(+), 542 deletions(-) delete mode 100644 pkg/front_end/testcases/pubspec.yaml delete mode 100644 pubspec.yaml diff --git a/.gitignore b/.gitignore index 4cb1a0c3802..a29bb37f87f 100644 --- a/.gitignore +++ b/.gitignore @@ -82,7 +82,7 @@ pubspec.lock /.dart_tool/native_assets_builder/ # Files generated by pub and other dart tools. -.dart_tool/ +/.dart_tool/ # Generated by tools/generate_package_config.dart to include extra packages in # the project. diff --git a/pkg/_fe_analyzer_shared/pubspec.yaml b/pkg/_fe_analyzer_shared/pubspec.yaml index cfc6b74808c..1161dcfae37 100644 --- a/pkg/_fe_analyzer_shared/pubspec.yaml +++ b/pkg/_fe_analyzer_shared/pubspec.yaml @@ -6,7 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/_fe_analyzer_shared environment: sdk: ^3.5.0 -resolution: workspace dependencies: meta: ^1.9.0 @@ -20,3 +19,8 @@ dev_dependencies: collection: any test: any +dependency_overrides: + test: + path: ../../third_party/pkg/test/pkgs/test/ + analyzer: + path: ../analyzer diff --git a/pkg/_js_interop_checks/pubspec.yaml b/pkg/_js_interop_checks/pubspec.yaml index 183e5028727..4e299a32916 100644 --- a/pkg/_js_interop_checks/pubspec.yaml +++ b/pkg/_js_interop_checks/pubspec.yaml @@ -6,8 +6,6 @@ environment: # Use min prerelease bound to get the latest formatter changes. sdk: '^3.7.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/_macros/pubspec.yaml b/pkg/_macros/pubspec.yaml index cafd28bb11c..37e6dc52a8b 100644 --- a/pkg/_macros/pubspec.yaml +++ b/pkg/_macros/pubspec.yaml @@ -8,9 +8,7 @@ publish_to: none repository: https://github.com/dart-lang/sdk/tree/main/pkg/_macros environment: - sdk: ^3.5.0 - -resolution: workspace + sdk: ^3.4.0-256.0.dev # Note that as an SDK vendored package, pub package dependencies are only # allowed in the dev_dependencies section. diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 6b792b7062b..cea36d5cdb0 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: '^3.7.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any @@ -46,3 +44,127 @@ dev_dependencies: test_descriptor: any test_reflective_loader: any web_socket_channel: any + +dependency_overrides: + _fe_analyzer_shared: + path: ../_fe_analyzer_shared + analysis_server_plugin: + path: ../analysis_server_plugin + analyzer: + path: ../analyzer + analyzer_plugin: + path: ../analyzer_plugin + analyzer_utilities: + path: ../analyzer_utilities + args: + path: ../../third_party/pkg/args + async: + path: ../../third_party/pkg/async + boolean_selector: + path: ../../third_party/pkg/boolean_selector + cli_util: + path: ../../third_party/pkg/cli_util + clock: + path: ../../third_party/pkg/clock + collection: + path: ../../third_party/pkg/collection + convert: + path: ../../third_party/pkg/convert + crypto: + path: ../../third_party/pkg/crypto + dart_style: + path: ../../third_party/pkg/dart_style + dtd: + path: ../dtd + file: + path: ../../third_party/pkg/file/packages/file + frontend_server_client: + path: ../../third_party/pkg/webdev/frontend_server_client + glob: + path: ../../third_party/pkg/glob + http: + path: ../../third_party/pkg/http/pkgs/http + http_multi_server: + path: ../../third_party/pkg/http_multi_server + http_parser: + path: ../../third_party/pkg/http_parser + intl: + path: ../../third_party/pkg/intl + json_rpc_2: + path: ../../third_party/pkg/json_rpc_2 + js: + path: ../js + language_server_protocol: + path: ../../third_party/pkg/language_server_protocol + linter: + path: ../linter + lints: + path: ../../third_party/pkg/lints + logging: + path: ../../third_party/pkg/logging + matcher: + path: ../../third_party/pkg/matcher + memory_usage: + path: ../../third_party/pkg/leak_tracker/pkgs/memory_usage + meta: + path: ../meta + mime: + path: ../../third_party/pkg/tools/pkgs/mime + package_config: + path: ../../third_party/pkg/package_config + path: + path: ../../third_party/pkg/path + pool: + path: ../../third_party/pkg/pool + pub_semver: + path: ../../third_party/pkg/pub_semver + shelf: + path: ../../third_party/pkg/shelf/pkgs/shelf + shelf_packages_handler: + path: ../../third_party/pkg/shelf/pkgs/shelf_packages_handler + shelf_static: + path: ../../third_party/pkg/shelf/pkgs/shelf_static + shelf_web_socket: + path: ../../third_party/pkg/shelf/pkgs/shelf_web_socket + source_map_stack_trace: + path: ../../third_party/pkg/tools/pkgs/source_map_stack_trace + source_maps: + path: ../../third_party/pkg/source_maps + source_span: + path: ../../third_party/pkg/source_span + stack_trace: + path: ../../third_party/pkg/stack_trace + stream_channel: + path: ../../third_party/pkg/stream_channel + string_scanner: + path: ../../third_party/pkg/string_scanner + telemetry: + path: ../telemetry + term_glyph: + path: ../../third_party/pkg/term_glyph + test: + path: ../../third_party/pkg/test/pkgs/test + test_api: + path: ../../third_party/pkg/test/pkgs/test_api + test_core: + path: ../../third_party/pkg/test/pkgs/test_core + test_descriptor: + path: ../../third_party/pkg/test_descriptor + test_reflective_loader: + path: ../../third_party/pkg/test_reflective_loader + typed_data: + path: ../../third_party/pkg/typed_data + unified_analytics: + path: ../../third_party/pkg/tools/pkgs/unified_analytics + vm_service: + path: ../vm_service + watcher: + path: ../../third_party/pkg/watcher + web_socket_channel: + path: ../../third_party/pkg/web_socket_channel + webkit_inspection_protocol: + path: ../../third_party/pkg/webkit_inspection_protocol + yaml: + path: ../../third_party/pkg/yaml + yaml_edit: + path: ../../third_party/pkg/yaml_edit diff --git a/pkg/analysis_server_client/pubspec.yaml b/pkg/analysis_server_client/pubspec.yaml index 38755091a24..afc1a20aad2 100644 --- a/pkg/analysis_server_client/pubspec.yaml +++ b/pkg/analysis_server_client/pubspec.yaml @@ -12,8 +12,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: path: any diff --git a/pkg/analysis_server_plugin/pubspec.yaml b/pkg/analysis_server_plugin/pubspec.yaml index 1aa7a784106..50b963c31dd 100644 --- a/pkg/analysis_server_plugin/pubspec.yaml +++ b/pkg/analysis_server_plugin/pubspec.yaml @@ -6,7 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_plugi environment: sdk: ^3.5.0 -resolution: workspace dependencies: analyzer: ^7.3.0 @@ -22,3 +21,127 @@ dev_dependencies: test_reflective_loader: any test: any +# These dependency overrides are present in order to allow publishing this +# package. Otherwise, `dart pub publish` complains, even though they are dev +# dependencies. +dependency_overrides: + _fe_analyzer_shared: + path: ../_fe_analyzer_shared + analyzer: + path: ../analyzer + analyzer_plugin: + path: ../analyzer_plugin + analyzer_utilities: + path: ../analyzer_utilities + args: + path: ../../third_party/pkg/args + async: + path: ../../third_party/pkg/async + boolean_selector: + path: ../../third_party/pkg/boolean_selector + cli_util: + path: ../../third_party/pkg/cli_util + clock: + path: ../../third_party/pkg/clock + collection: + path: ../../third_party/pkg/collection + convert: + path: ../../third_party/pkg/convert + crypto: + path: ../../third_party/pkg/crypto + dart_style: + path: ../../third_party/pkg/dart_style + file: + path: ../../third_party/pkg/file/packages/file + frontend_server_client: + path: ../../third_party/pkg/webdev/frontend_server_client + glob: + path: ../../third_party/pkg/glob + http: + path: ../../third_party/pkg/http/pkgs/http + http_multi_server: + path: ../../third_party/pkg/http_multi_server + http_parser: + path: ../../third_party/pkg/http_parser + intl: + path: ../../third_party/pkg/intl + js: + path: ../js + language_server_protocol: + path: ../../third_party/pkg/language_server_protocol + linter: + path: ../linter + lints: + path: ../../third_party/pkg/lints + logging: + path: ../../third_party/pkg/logging + matcher: + path: ../../third_party/pkg/matcher + memory_usage: + path: ../../third_party/pkg/leak_tracker/pkgs/memory_usage + meta: + path: ../meta + mime: + path: ../../third_party/pkg/tools/pkgs/mime + package_config: + path: ../../third_party/pkg/package_config + path: + path: ../../third_party/pkg/path + pool: + path: ../../third_party/pkg/pool + pub_semver: + path: ../../third_party/pkg/pub_semver + server_plugin: + path: ../server_plugin + shelf: + path: ../../third_party/pkg/shelf/pkgs/shelf + shelf_packages_handler: + path: ../../third_party/pkg/shelf/pkgs/shelf_packages_handler + shelf_static: + path: ../../third_party/pkg/shelf/pkgs/shelf_static + shelf_web_socket: + path: ../../third_party/pkg/shelf/pkgs/shelf_web_socket + source_map_stack_trace: + path: ../../third_party/pkg/tools/pkgs/source_map_stack_trace + source_maps: + path: ../../third_party/pkg/source_maps + source_span: + path: ../../third_party/pkg/source_span + stack_trace: + path: ../../third_party/pkg/stack_trace + stream_channel: + path: ../../third_party/pkg/stream_channel + string_scanner: + path: ../../third_party/pkg/string_scanner + telemetry: + path: ../telemetry + term_glyph: + path: ../../third_party/pkg/term_glyph + test: + path: ../../third_party/pkg/test/pkgs/test + test_api: + path: ../../third_party/pkg/test/pkgs/test_api + test_core: + path: ../../third_party/pkg/test/pkgs/test_core + test_descriptor: + path: ../../third_party/pkg/test_descriptor + test_reflective_loader: + path: ../../third_party/pkg/test_reflective_loader + typed_data: + path: ../../third_party/pkg/typed_data + unified_analytics: + path: ../../third_party/pkg/tools/pkgs/unified_analytics + usage: + path: ../../third_party/pkg/usage + vm_service: + path: ../vm_service + watcher: + path: ../../third_party/pkg/watcher + web_socket_channel: + path: ../../third_party/pkg/web_socket_channel + webkit_inspection_protocol: + path: ../../third_party/pkg/webkit_inspection_protocol + yaml: + path: ../../third_party/pkg/yaml + yaml_edit: + path: ../../third_party/pkg/yaml_edit diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml index eaacb4dbd2c..c88e8cddc81 100644 --- a/pkg/analyzer/pubspec.yaml +++ b/pkg/analyzer/pubspec.yaml @@ -7,7 +7,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer environment: sdk: ^3.5.0 -resolution: workspace dependencies: _fe_analyzer_shared: ^80.0.0 @@ -40,3 +39,17 @@ dev_dependencies: test_reflective_loader: any vm_service: any +# These dependency overrides are present in order to allow publishing this +# package. Otherwise, `dart pub publish` complains, even though they are dev +# dependencies. +dependency_overrides: + _fe_analyzer_shared: + path: ../_fe_analyzer_shared + analyzer_utilities: + path: ../analyzer_utilities + heap_snapshot: + path: ../heap_snapshot + linter: + path: ../linter + vm_service: + path: ../vm_service diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml index 6e67306da56..0607768da6d 100644 --- a/pkg/analyzer_cli/pubspec.yaml +++ b/pkg/analyzer_cli/pubspec.yaml @@ -7,8 +7,6 @@ publish_to: none environment: sdk: ^3.7.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: analyzer: any diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml index 85c501c8cfe..0928a4268ed 100644 --- a/pkg/analyzer_plugin/pubspec.yaml +++ b/pkg/analyzer_plugin/pubspec.yaml @@ -6,7 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer_plugin environment: sdk: ^3.5.0 -resolution: workspace dependencies: analyzer: ^7.2.0 @@ -27,3 +26,12 @@ dev_dependencies: meta: any test_reflective_loader: any test: any + +# These dependency overrides are present in order to allow publishing this +# package. Otherwise, `dart pub publish` complains, even though they are dev +# dependencies. +dependency_overrides: + analyzer_utilities: + path: ../analyzer_utilities + linter: + path: ../linter diff --git a/pkg/analyzer_utilities/pubspec.yaml b/pkg/analyzer_utilities/pubspec.yaml index 10713d1d3e6..90a36b9eefb 100644 --- a/pkg/analyzer_utilities/pubspec.yaml +++ b/pkg/analyzer_utilities/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: analyzer: any diff --git a/pkg/async_helper/pubspec.yaml b/pkg/async_helper/pubspec.yaml index a7bb1e2e4a2..6fea2df39a7 100644 --- a/pkg/async_helper/pubspec.yaml +++ b/pkg/async_helper/pubspec.yaml @@ -11,8 +11,6 @@ description: >- environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: expect: any diff --git a/pkg/bisect_dart/pubspec.yaml b/pkg/bisect_dart/pubspec.yaml index 0ce1eea6b8d..fde83263b4b 100644 --- a/pkg/bisect_dart/pubspec.yaml +++ b/pkg/bisect_dart/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - dependencies: cli_config: any logging: any diff --git a/pkg/build_integration/pubspec.yaml b/pkg/build_integration/pubspec.yaml index 67ab74ad6c8..bbf5cf8c114 100644 --- a/pkg/build_integration/pubspec.yaml +++ b/pkg/build_integration/pubspec.yaml @@ -8,8 +8,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: front_end: any diff --git a/pkg/compiler/pubspec.yaml b/pkg/compiler/pubspec.yaml index f853ee6463d..e170571b5a6 100644 --- a/pkg/compiler/pubspec.yaml +++ b/pkg/compiler/pubspec.yaml @@ -7,8 +7,6 @@ publish_to: none environment: sdk: ^3.7.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/dart2bytecode/pubspec.yaml b/pkg/dart2bytecode/pubspec.yaml index 770e9d2e609..8f128ab0062 100644 --- a/pkg/dart2bytecode/pubspec.yaml +++ b/pkg/dart2bytecode/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/dart2js_info/pubspec.yaml b/pkg/dart2js_info/pubspec.yaml index bcb4f4c1036..0101ed0176d 100644 --- a/pkg/dart2js_info/pubspec.yaml +++ b/pkg/dart2js_info/pubspec.yaml @@ -8,8 +8,6 @@ description: >- environment: sdk: '^3.7.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/dart2js_runtime_metrics/pubspec.yaml b/pkg/dart2js_runtime_metrics/pubspec.yaml index 236f6ae19aa..d02f25c4a07 100644 --- a/pkg/dart2js_runtime_metrics/pubspec.yaml +++ b/pkg/dart2js_runtime_metrics/pubspec.yaml @@ -9,8 +9,6 @@ description: >- environment: sdk: "^3.7.0" -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: expect: any diff --git a/pkg/dart2js_tools/pubspec.yaml b/pkg/dart2js_tools/pubspec.yaml index 5bb9638c521..ca19fe6400e 100644 --- a/pkg/dart2js_tools/pubspec.yaml +++ b/pkg/dart2js_tools/pubspec.yaml @@ -8,8 +8,6 @@ description: > environment: sdk: '^3.7.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: path: any diff --git a/pkg/dart2native/pubspec.yaml b/pkg/dart2native/pubspec.yaml index 95986319a64..3d8c882132b 100644 --- a/pkg/dart2native/pubspec.yaml +++ b/pkg/dart2native/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Add the bin/dart2native.dart script to the scripts pub installs. executables: dart2native: diff --git a/pkg/dart2wasm/pubspec.yaml b/pkg/dart2wasm/pubspec.yaml index c065abd938f..b546c5681f0 100644 --- a/pkg/dart2wasm/pubspec.yaml +++ b/pkg/dart2wasm/pubspec.yaml @@ -4,8 +4,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/dart_internal/pubspec.yaml b/pkg/dart_internal/pubspec.yaml index 7a543cc57b5..e784e002db2 100644 --- a/pkg/dart_internal/pubspec.yaml +++ b/pkg/dart_internal/pubspec.yaml @@ -11,7 +11,6 @@ environment: # version of the SDK without it being a breaking change. sdk: '>=3.5.0 <3.9.0' -resolution: workspace # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: diff --git a/pkg/dart_service_protocol_shared/pubspec.yaml b/pkg/dart_service_protocol_shared/pubspec.yaml index 2e0122ea3d1..6713501e5ae 100644 --- a/pkg/dart_service_protocol_shared/pubspec.yaml +++ b/pkg/dart_service_protocol_shared/pubspec.yaml @@ -7,8 +7,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/dart_service_protocol environment: sdk: ^3.5.0 -resolution: workspace - dependencies: meta: ^1.11.0 diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml index 1adbb5b2857..6e77322407c 100644 --- a/pkg/dartdev/pubspec.yaml +++ b/pkg/dartdev/pubspec.yaml @@ -4,9 +4,7 @@ name: dartdev publish_to: none environment: - sdk: ^3.5.0 - -resolution: workspace + sdk: ^3.3.0 # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml index 85169f02d3d..a321f02dc3b 100644 --- a/pkg/dds/pubspec.yaml +++ b/pkg/dds/pubspec.yaml @@ -8,7 +8,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/dds environment: sdk: ^3.5.0 -resolution: workspace dependencies: args: ^2.0.0 diff --git a/pkg/dds_service_extensions/pubspec.yaml b/pkg/dds_service_extensions/pubspec.yaml index 5378711d322..ecbe5fb7ece 100644 --- a/pkg/dds_service_extensions/pubspec.yaml +++ b/pkg/dds_service_extensions/pubspec.yaml @@ -8,7 +8,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/dds_service_extension environment: sdk: ^3.5.0 -resolution: workspace dependencies: async: ^2.4.1 diff --git a/pkg/dev_compiler/pubspec.yaml b/pkg/dev_compiler/pubspec.yaml index 7b59c7afca4..89a624050ff 100644 --- a/pkg/dev_compiler/pubspec.yaml +++ b/pkg/dev_compiler/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: '>=3.6.0 <4.0.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/dtd/pubspec.yaml b/pkg/dtd/pubspec.yaml index f85312e2894..5c1775758d2 100644 --- a/pkg/dtd/pubspec.yaml +++ b/pkg/dtd/pubspec.yaml @@ -6,8 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/dtd environment: sdk: ^3.5.0 -resolution: workspace - dependencies: json_rpc_2: ^3.0.2 stream_channel: ^2.1.2 diff --git a/pkg/dtd_impl/pubspec.yaml b/pkg/dtd_impl/pubspec.yaml index 59a76e77f76..ffad53f5797 100644 --- a/pkg/dtd_impl/pubspec.yaml +++ b/pkg/dtd_impl/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/dynamic_modules/pubspec.yaml b/pkg/dynamic_modules/pubspec.yaml index 20a9ade49c1..e7cb25aab94 100644 --- a/pkg/dynamic_modules/pubspec.yaml +++ b/pkg/dynamic_modules/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: args: any diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml index 64cb321ac6c..570f3fc6407 100644 --- a/pkg/expect/pubspec.yaml +++ b/pkg/expect/pubspec.yaml @@ -12,8 +12,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: smith: any diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml index fbfa6df7d5e..a12e09d7702 100644 --- a/pkg/front_end/pubspec.yaml +++ b/pkg/front_end/pubspec.yaml @@ -8,11 +8,6 @@ publish_to: none environment: sdk: ^3.5.0 -workspace: - - testcases - -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any @@ -39,3 +34,39 @@ dev_dependencies: vm: any vm_service: any web_socket_channel: any + +dependency_overrides: + _fe_analyzer_shared: + path: ../_fe_analyzer_shared + _js_interop_checks: + path: ../_js_interop_checks + build_integration: + path: ../build_integration + compiler: + path: ../compiler + dart2js_info: + path: ../dart2js_info + dart2wasm: + path: ../dart2wasm + dev_compiler: + path: ../dev_compiler + expect: + path: ../expect + js_ast: + path: ../js_ast + js_runtime: + path: ../js_runtime + js_shared: + path: ../js_shared + kernel: + path: ../kernel + mmap: + path: ../mmap + smith: + path: ../smith + testing: + path: ../testing + vm: + path: ../vm + wasm_builder: + path: ../wasm_builder diff --git a/pkg/front_end/testcases/pubspec.yaml b/pkg/front_end/testcases/pubspec.yaml deleted file mode 100644 index 6e0649e9205..00000000000 --- a/pkg/front_end/testcases/pubspec.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: front_end_testcases -# This package is not intended for consumption on pub.dev. DO NOT publish. -publish_to: none -environment: - sdk: ^3.8.0-0 -resolution: workspace \ No newline at end of file diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml index 2117ca4b124..889783e7d51 100644 --- a/pkg/frontend_server/pubspec.yaml +++ b/pkg/frontend_server/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/heap_snapshot/pubspec.yaml b/pkg/heap_snapshot/pubspec.yaml index 82e09361858..6858d125a00 100644 --- a/pkg/heap_snapshot/pubspec.yaml +++ b/pkg/heap_snapshot/pubspec.yaml @@ -5,8 +5,9 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - dependencies: vm_service: any +dependency_overrides: + vm_service: + path: ../vm_service diff --git a/pkg/js/pubspec.yaml b/pkg/js/pubspec.yaml index c6cda0cfaf0..aea29ffb49c 100644 --- a/pkg/js/pubspec.yaml +++ b/pkg/js/pubspec.yaml @@ -9,8 +9,6 @@ topics: environment: sdk: ^3.7.0-0 -resolution: workspace - # We use 'any' version constraints here as we get our package versions from # the dart-lang/sdk repo's DEPS file. Note that this is a special case; the # best practice for packages is to specify their compatible version ranges. diff --git a/pkg/js_ast/pubspec.yaml b/pkg/js_ast/pubspec.yaml index d683ebec1b3..ae333c557d9 100644 --- a/pkg/js_ast/pubspec.yaml +++ b/pkg/js_ast/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: '^3.7.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: expect: any diff --git a/pkg/js_runtime/pubspec.yaml b/pkg/js_runtime/pubspec.yaml index e4075000faf..b529be7dd9e 100644 --- a/pkg/js_runtime/pubspec.yaml +++ b/pkg/js_runtime/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: _fe_analyzer_shared: any diff --git a/pkg/js_shared/pubspec.yaml b/pkg/js_shared/pubspec.yaml index 7af61795165..6c51a5f7085 100644 --- a/pkg/js_shared/pubspec.yaml +++ b/pkg/js_shared/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: _fe_analyzer_shared: any diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml index 8a6d9895cfa..ae32d019146 100644 --- a/pkg/kernel/pubspec.yaml +++ b/pkg/kernel/pubspec.yaml @@ -8,8 +8,6 @@ publish_to: none environment: sdk: ^3.6.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/linter/pubspec.yaml b/pkg/linter/pubspec.yaml index 37560cff8a5..6e22ddbe516 100644 --- a/pkg/linter/pubspec.yaml +++ b/pkg/linter/pubspec.yaml @@ -9,8 +9,6 @@ description: >- environment: sdk: ^3.7.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: analyzer: any diff --git a/pkg/macros/pubspec.yaml b/pkg/macros/pubspec.yaml index a72e75fce5e..d297f83c4d3 100644 --- a/pkg/macros/pubspec.yaml +++ b/pkg/macros/pubspec.yaml @@ -8,8 +8,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/macros environment: sdk: ^3.5.0 -resolution: workspace - dependencies: _macros: sdk: dart diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml index 9658f4726a0..de88d15e04b 100644 --- a/pkg/meta/pubspec.yaml +++ b/pkg/meta/pubspec.yaml @@ -13,8 +13,6 @@ topics: environment: sdk: ^3.5.0 -resolution: workspace - # We use 'any' version constraints here as we get our package versions from # the dart-lang/sdk repo's DEPS file. Note that this is a special case; the # best practice for packages is to specify their compatible version ranges. diff --git a/pkg/mmap/pubspec.yaml b/pkg/mmap/pubspec.yaml index 5ccf2c7de19..bc2e4997309 100644 --- a/pkg/mmap/pubspec.yaml +++ b/pkg/mmap/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: ffi: any diff --git a/pkg/modular_test/pubspec.yaml b/pkg/modular_test/pubspec.yaml index 3d5f8e342b7..d54ad6cb007 100644 --- a/pkg/modular_test/pubspec.yaml +++ b/pkg/modular_test/pubspec.yaml @@ -9,8 +9,6 @@ description: > environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/native_stack_traces/pubspec.yaml b/pkg/native_stack_traces/pubspec.yaml index 466fad1abf6..4c2ef7bec83 100644 --- a/pkg/native_stack_traces/pubspec.yaml +++ b/pkg/native_stack_traces/pubspec.yaml @@ -6,8 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/native_stack_traces environment: sdk: ^3.5.0 -resolution: workspace - executables: decode: diff --git a/pkg/node_preamble/pubspec.yaml b/pkg/node_preamble/pubspec.yaml index 1e16b9924a4..d013607aa47 100644 --- a/pkg/node_preamble/pubspec.yaml +++ b/pkg/node_preamble/pubspec.yaml @@ -2,7 +2,4 @@ name: node_preamble environment: sdk: ^3.7.0 - -resolution: workspace - publish_to: none diff --git a/pkg/record_use/pubspec.yaml b/pkg/record_use/pubspec.yaml index da8e87a1cb7..043bcdbc38f 100644 --- a/pkg/record_use/pubspec.yaml +++ b/pkg/record_use/pubspec.yaml @@ -7,8 +7,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/record_use environment: sdk: ^3.5.0 -resolution: workspace - dependencies: collection: ^1.18.0 pub_semver: ^2.1.4 diff --git a/pkg/reload_test/pubspec.yaml b/pkg/reload_test/pubspec.yaml index c89da30d872..6306786cdfa 100644 --- a/pkg/reload_test/pubspec.yaml +++ b/pkg/reload_test/pubspec.yaml @@ -7,8 +7,6 @@ description: > environment: sdk: '>=3.6.0 <4.0.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: dev_compiler: any diff --git a/pkg/scrape/pubspec.yaml b/pkg/scrape/pubspec.yaml index c93e7c86b3a..38364e395ae 100644 --- a/pkg/scrape/pubspec.yaml +++ b/pkg/scrape/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: analyzer: any diff --git a/pkg/server_plugin/pubspec.yaml b/pkg/server_plugin/pubspec.yaml index 1cfe4c93e3c..493848eb13f 100644 --- a/pkg/server_plugin/pubspec.yaml +++ b/pkg/server_plugin/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: @@ -14,3 +12,122 @@ dependencies: dev_dependencies: lints: any +dependency_overrides: + _fe_analyzer_shared: + path: ../_fe_analyzer_shared + analyzer: + path: ../analyzer + analyzer_plugin: + path: ../analyzer_plugin + analyzer_utilities: + path: ../analyzer_utilities + args: + path: ../../third_party/pkg/args + async: + path: ../../third_party/pkg/async + boolean_selector: + path: ../../third_party/pkg/boolean_selector + cli_util: + path: ../../third_party/pkg/cli_util + clock: + path: ../../third_party/pkg/clock + collection: + path: ../../third_party/pkg/collection + convert: + path: ../../third_party/pkg/convert + crypto: + path: ../../third_party/pkg/crypto + dart_style: + path: ../../third_party/pkg/dart_style + file: + path: ../../third_party/pkg/file/packages/file + frontend_server_client: + path: ../../third_party/pkg/webdev/frontend_server_client + glob: + path: ../../third_party/pkg/glob + http: + path: ../../third_party/pkg/http/pkgs/http + http_multi_server: + path: ../../third_party/pkg/http_multi_server + http_parser: + path: ../../third_party/pkg/http_parser + intl: + path: ../../third_party/pkg/intl + js: + path: ../js + language_server_protocol: + path: ../../third_party/pkg/language_server_protocol + linter: + path: ../linter + lints: + path: ../../third_party/pkg/lints + logging: + path: ../../third_party/pkg/logging + matcher: + path: ../../third_party/pkg/matcher + memory_usage: + path: ../../third_party/pkg/leak_tracker/pkgs/memory_usage + meta: + path: ../meta + mime: + path: ../../third_party/pkg/tools/pkgs/mime + package_config: + path: ../../third_party/pkg/package_config + path: + path: ../../third_party/pkg/path + pool: + path: ../../third_party/pkg/pool + pub_semver: + path: ../../third_party/pkg/pub_semver + shelf: + path: ../../third_party/pkg/shelf/pkgs/shelf + shelf_packages_handler: + path: ../../third_party/pkg/shelf/pkgs/shelf_packages_handler + shelf_static: + path: ../../third_party/pkg/shelf/pkgs/shelf_static + shelf_web_socket: + path: ../../third_party/pkg/shelf/pkgs/shelf_web_socket + source_map_stack_trace: + path: ../../third_party/pkg/tools/pkgs/source_map_stack_trace + source_maps: + path: ../../third_party/pkg/source_maps + source_span: + path: ../../third_party/pkg/source_span + stack_trace: + path: ../../third_party/pkg/stack_trace + stream_channel: + path: ../../third_party/pkg/stream_channel + string_scanner: + path: ../../third_party/pkg/string_scanner + telemetry: + path: ../telemetry + term_glyph: + path: ../../third_party/pkg/term_glyph + test: + path: ../../third_party/pkg/test/pkgs/test + test_api: + path: ../../third_party/pkg/test/pkgs/test_api + test_core: + path: ../../third_party/pkg/test/pkgs/test_core + test_descriptor: + path: ../../third_party/pkg/test_descriptor + test_reflective_loader: + path: ../../third_party/pkg/test_reflective_loader + typed_data: + path: ../../third_party/pkg/typed_data + unified_analytics: + path: ../../third_party/pkg/tools/pkgs/unified_analytics + usage: + path: ../../third_party/pkg/usage + vm_service: + path: ../vm_service + watcher: + path: ../../third_party/pkg/watcher + web_socket_channel: + path: ../../third_party/pkg/web_socket_channel + webkit_inspection_protocol: + path: ../../third_party/pkg/webkit_inspection_protocol + yaml: + path: ../../third_party/pkg/yaml + yaml_edit: + path: ../../third_party/pkg/yaml_edit diff --git a/pkg/smith/pubspec.yaml b/pkg/smith/pubspec.yaml index 92b76a5c714..a5d9f042a93 100644 --- a/pkg/smith/pubspec.yaml +++ b/pkg/smith/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: expect: any diff --git a/pkg/sourcemap_testing/pubspec.yaml b/pkg/sourcemap_testing/pubspec.yaml index fc9b8ff0c27..3ca32331d6d 100644 --- a/pkg/sourcemap_testing/pubspec.yaml +++ b/pkg/sourcemap_testing/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.7.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/status_file/pubspec.yaml b/pkg/status_file/pubspec.yaml index f3193fd88c8..daa7a5b6ddf 100644 --- a/pkg/status_file/pubspec.yaml +++ b/pkg/status_file/pubspec.yaml @@ -5,8 +5,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/telemetry/pubspec.yaml b/pkg/telemetry/pubspec.yaml index 691735a0927..0c0f1cf7d8f 100644 --- a/pkg/telemetry/pubspec.yaml +++ b/pkg/telemetry/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: http: any diff --git a/pkg/test_runner/pubspec.yaml b/pkg/test_runner/pubspec.yaml index 102c13e2b3f..15c40890fc7 100644 --- a/pkg/test_runner/pubspec.yaml +++ b/pkg/test_runner/pubspec.yaml @@ -9,8 +9,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any diff --git a/pkg/testing/pubspec.yaml b/pkg/testing/pubspec.yaml index 5dadc4bc21d..444246d98d1 100644 --- a/pkg/testing/pubspec.yaml +++ b/pkg/testing/pubspec.yaml @@ -7,8 +7,6 @@ publish_to: none environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependency: lints: any diff --git a/pkg/vm/pubspec.yaml b/pkg/vm/pubspec.yaml index 26858eb05a9..af00c7fe4ac 100644 --- a/pkg/vm/pubspec.yaml +++ b/pkg/vm/pubspec.yaml @@ -6,8 +6,6 @@ publish_to: none environment: sdk: '>=3.7.0 <4.0.0' -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: _fe_analyzer_shared: any diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml index 9959a12b355..fad3dd95c22 100644 --- a/pkg/vm_service/pubspec.yaml +++ b/pkg/vm_service/pubspec.yaml @@ -9,7 +9,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_service environment: sdk: ^3.5.0 -resolution: workspace # We use 'any' version constraints here as we get our package versions from # the dart-lang/sdk repo's DEPS file. Note that this is a special case; the diff --git a/pkg/vm_service/test/test_package/pubspec.yaml b/pkg/vm_service/test/test_package/pubspec.yaml index 079f93cee21..d1bfffab9eb 100644 --- a/pkg/vm_service/test/test_package/pubspec.yaml +++ b/pkg/vm_service/test/test_package/pubspec.yaml @@ -1,5 +1,4 @@ name: test_package publish_to: none environment: - sdk: ^3.5.0 -resolution: workspace + sdk: ^3.5.0 \ No newline at end of file diff --git a/pkg/vm_service_interface/pubspec.yaml b/pkg/vm_service_interface/pubspec.yaml index 1b1de825fe1..ac92a707fad 100644 --- a/pkg/vm_service_interface/pubspec.yaml +++ b/pkg/vm_service_interface/pubspec.yaml @@ -9,7 +9,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_service/packages/v environment: sdk: ^3.5.0 -resolution: workspace dependencies: vm_service: '>=14.3.0 <16.0.0' diff --git a/pkg/vm_service_protos/pubspec.yaml b/pkg/vm_service_protos/pubspec.yaml index a439959bd3a..297d13ac4b9 100644 --- a/pkg/vm_service_protos/pubspec.yaml +++ b/pkg/vm_service_protos/pubspec.yaml @@ -9,7 +9,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_service_protos environment: sdk: ^3.5.0 -resolution: workspace dependencies: fixnum: ^1.0.0 diff --git a/pkg/vm_snapshot_analysis/pubspec.yaml b/pkg/vm_snapshot_analysis/pubspec.yaml index 94e4b312991..dadf1cbd41b 100644 --- a/pkg/vm_snapshot_analysis/pubspec.yaml +++ b/pkg/vm_snapshot_analysis/pubspec.yaml @@ -6,7 +6,6 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_snapshot_analysis environment: sdk: ^3.5.0 -resolution: workspace executables: snapshot_analysis: analyse diff --git a/pkg/wasm_builder/pubspec.yaml b/pkg/wasm_builder/pubspec.yaml index 88218f71ba2..ca699a9731b 100644 --- a/pkg/wasm_builder/pubspec.yaml +++ b/pkg/wasm_builder/pubspec.yaml @@ -6,8 +6,6 @@ description: Generate binary Wasm modules environment: sdk: ^3.5.0 -resolution: workspace - # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: collection: any diff --git a/pubspec.yaml b/pubspec.yaml deleted file mode 100644 index a506bae1575..00000000000 --- a/pubspec.yaml +++ /dev/null @@ -1,319 +0,0 @@ -# Copyright (c) 2025, 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 defines pub workspace for the sdk enabling a common resolution. -name: _ -publish_to: none -environment: - # This constraint decides the langage-version for all dart code in the - # repository that doesn't have its own package. Mainly the code in `tests/`. - # - # It needs to be updated before testing language features introduced in the - # next language version. - sdk: ^3.8.0-0 - -# These are the packages that are contained in the SDK. -workspace: - - pkg/analysis_server - - pkg/analysis_server_client - - pkg/analysis_server_plugin - - pkg/analyzer - - pkg/analyzer_cli - - pkg/analyzer_plugin - - pkg/analyzer_utilities - - pkg/async_helper - - pkg/bisect_dart - - pkg/build_integration - - pkg/compiler - - pkg/dart2bytecode - - pkg/dart2js_info - - pkg/dart2js_runtime_metrics - - pkg/dart2js_tools - - pkg/dart2native - - pkg/dart2wasm - - pkg/dartdev - - pkg/dart_internal - - pkg/dart_service_protocol_shared - - pkg/dds - - pkg/dds_service_extensions - - pkg/dev_compiler - - pkg/dtd - - pkg/dtd_impl - - pkg/dynamic_modules - - pkg/expect - - pkg/_fe_analyzer_shared - - pkg/front_end - - pkg/frontend_server - - pkg/heap_snapshot - - pkg/js - - pkg/js_ast - - pkg/_js_interop_checks - - pkg/js_runtime - - pkg/js_shared - - pkg/kernel - - pkg/linter - - pkg/_macros - - pkg/macros - - pkg/meta - - pkg/mmap - - pkg/modular_test - - pkg/native_stack_traces - - pkg/node_preamble - - pkg/record_use - - pkg/reload_test - - pkg/scrape - - pkg/server_plugin - - pkg/smith - - pkg/sourcemap_testing - - pkg/status_file - - pkg/telemetry - - pkg/testing - - pkg/test_runner - - pkg/vm - - pkg/vm_service - - pkg/vm_service_interface - - pkg/vm_service_protos - - pkg/vm_snapshot_analysis - - pkg/wasm_builder - - samples/ffi/http - # dap and language_server_protocol are checked in to and - # developed in the sdk repo, though they are located in `third_party/`. - - third_party/pkg/dap - - third_party/pkg/language_server_protocol - - tools/package_deps - - tools - -# All third_party packages here are retrieved via the DEPS-file and overridden -# here. -dependency_overrides: - _experiment_sound: - path: third_party/pkg/webdev/fixtures/_experimentSound - _test_circular1_sound: - path: third_party/pkg/webdev/fixtures/_testCircular1Sound - _test_circular2_sound: - path: third_party/pkg/webdev/fixtures/_testCircular2Sound - _test_hot_restart1: - path: third_party/pkg/webdev/fixtures/_testHotRestart1Sound - _test_hot_restart2: - path: third_party/pkg/webdev/fixtures/_testHotRestart2Sound - _test_package_sound: - path: third_party/pkg/webdev/fixtures/_testPackageSound - _test_sound: - path: third_party/pkg/webdev/fixtures/_testSound - _webdev_sound_smoke: - path: third_party/pkg/webdev/fixtures/_webdevSoundSmoke - analysis_config: - path: third_party/pkg/webdev/_analysis_config - api_benchmark: - path: third_party/pkg/protobuf/api_benchmark - args: - path: third_party/pkg/core/pkgs/args - async: - path: third_party/pkg/core/pkgs/async - bazel_worker: - path: third_party/pkg/tools/pkgs/bazel_worker - benchmark_harness: - path: third_party/pkg/tools/pkgs/benchmark_harness - boolean_selector: - path: third_party/pkg/tools/pkgs/boolean_selector - browser_launcher: - path: third_party/pkg/tools/pkgs/browser_launcher - checks: - path: third_party/pkg/test/pkgs/checks - cli_config: - path: third_party/pkg/tools/pkgs/cli_config - cli_util: - path: third_party/pkg/tools/pkgs/cli_util - clock: - path: third_party/pkg/tools/pkgs/clock - collection: - path: third_party/pkg/core/pkgs/collection - convert: - path: third_party/pkg/core/pkgs/convert - corpus: - path: third_party/pkg/ecosystem/pkgs/corpus - coverage: - path: third_party/pkg/tools/pkgs/coverage - crypto: - path: third_party/pkg/core/pkgs/crypto - csslib: - path: third_party/pkg/tools/pkgs/csslib - dart_flutter_team_lints: - path: third_party/pkg/ecosystem/pkgs/dart_flutter_team_lints - dart_style: - path: third_party/pkg/dart_style - dartdoc: - path: third_party/pkg/dartdoc - extension_discovery: - path: third_party/pkg/tools/pkgs/extension_discovery - fake_async: - path: third_party/pkg/test/pkgs/fake_async - ffi: - path: third_party/pkg/native/pkgs/ffi - file: - path: third_party/pkg/tools/pkgs/file - file_testing: - path: third_party/pkg/tools/pkgs/file_testing - fixnum: - path: third_party/pkg/core/pkgs/fixnum - frontend_server_client: - path: third_party/pkg/webdev/frontend_server_client - glob: - path: third_party/pkg/tools/pkgs/glob - graphs: - path: third_party/pkg/tools/pkgs/graphs - html: - path: third_party/pkg/tools/pkgs/html - http: - path: third_party/pkg/http/pkgs/http - http2: - path: third_party/pkg/http/pkgs/http2 - http_client_conformance_tests: - path: third_party/pkg/http/pkgs/http_client_conformance_tests - http_multi_server: - path: third_party/pkg/http/pkgs/http_multi_server - http_parser: - path: third_party/pkg/http/pkgs/http_parser - http_profile: - path: third_party/pkg/http/pkgs/http_profile - intl: - path: third_party/pkg/i18n/pkgs/intl - json_rpc_2: - path: third_party/pkg/tools/pkgs/json_rpc_2 - leak_tracker: - path: third_party/pkg/leak_tracker/pkgs/leak_tracker - leak_tracker_testing: - path: third_party/pkg/leak_tracker/pkgs/leak_tracker_testing - lints: - path: third_party/pkg/core/pkgs/lints - logging: - path: third_party/pkg/core/pkgs/logging - markdown: - path: third_party/pkg/tools/pkgs/markdown - matcher: - path: third_party/pkg/test/pkgs/matcher - memory_usage: - path: third_party/pkg/leak_tracker/pkgs/memory_usage - mime: - path: third_party/pkg/tools/pkgs/mime - native_assets_builder: - path: third_party/pkg/native/pkgs/native_assets_builder - native_assets_cli: - path: third_party/pkg/native/pkgs/native_assets_cli - native_toolchain_c: - path: third_party/pkg/native/pkgs/native_toolchain_c - oauth2: - path: third_party/pkg/tools/pkgs/oauth2 - os_detect: - path: third_party/pkg/core/pkgs/os_detect - package_config: - path: third_party/pkg/tools/pkgs/package_config - path: - path: third_party/pkg/core/pkgs/path - platform: - path: third_party/pkg/core/pkgs/platform - pool: - path: third_party/pkg/tools/pkgs/pool - protobuf: - path: third_party/pkg/protobuf/protobuf - protobuf_benchmarks: - path: third_party/pkg/protobuf/benchmarks - protoc_plugin: - path: third_party/pkg/protobuf/protoc_plugin - pub: - path: third_party/pkg/pub - pub_semver: - path: third_party/pkg/tools/pkgs/pub_semver - regression_tests: - path: third_party/pkg/test/integration_tests/regression - shelf: - path: third_party/pkg/shelf/pkgs/shelf - shelf_packages_handler: - path: third_party/pkg/shelf/pkgs/shelf_packages_handler - shelf_proxy: - path: third_party/pkg/shelf/pkgs/shelf_proxy - shelf_static: - path: third_party/pkg/shelf/pkgs/shelf_static - shelf_test_handler: - path: third_party/pkg/shelf/pkgs/shelf_test_handler - shelf_web_socket: - path: third_party/pkg/shelf/pkgs/shelf_web_socket - source_map_stack_trace: - path: third_party/pkg/tools/pkgs/source_map_stack_trace - source_maps: - path: third_party/pkg/tools/pkgs/source_maps - source_span: - path: third_party/pkg/tools/pkgs/source_span - spawn_hybrid: - path: third_party/pkg/test/integration_tests/spawn_hybrid - sse: - path: third_party/pkg/tools/pkgs/sse - stack_trace: - path: third_party/pkg/tools/pkgs/stack_trace - stream_channel: - path: third_party/pkg/tools/pkgs/stream_channel - string_scanner: - path: third_party/pkg/tools/pkgs/string_scanner - swift2objc: - path: third_party/pkg/native/pkgs/swift2objc - swiftgen: - path: third_party/pkg/native/pkgs/swiftgen - sync_http: - path: third_party/pkg/sync_http - tar: - path: third_party/pkg/tar - term_glyph: - path: third_party/pkg/tools/pkgs/term_glyph - test: - path: third_party/pkg/test/pkgs/test - test_api: - path: third_party/pkg/test/pkgs/test_api - test_core: - path: third_party/pkg/test/pkgs/test_core - test_descriptor: - path: third_party/pkg/test/pkgs/test_descriptor - test_process: - path: third_party/pkg/test/pkgs/test_process - test_reflective_loader: - path: third_party/pkg/tools/pkgs/test_reflective_loader - tool: - path: third_party/pkg/webdev/tool - typed_data: - path: third_party/pkg/core/pkgs/typed_data - unified_analytics: - path: third_party/pkg/tools/pkgs/unified_analytics - vector_math: - path: third_party/pkg/vector_math - wasm_tests: - path: third_party/pkg/test/integration_tests/wasm - watcher: - path: third_party/pkg/tools/pkgs/watcher - web: - path: third_party/pkg/web/web - web_socket: - path: third_party/pkg/http/pkgs/web_socket - web_socket_channel: - path: third_party/pkg/http/pkgs/web_socket_channel - webdriver: - path: third_party/pkg/webdriver - webkit_inspection_protocol: - path: third_party/pkg/webkit_inspection_protocol - yaml: - path: third_party/pkg/tools/pkgs/yaml - yaml_edit: - path: third_party/pkg/tools/pkgs/yaml_edit - io: - path: third_party/pkg/tools/pkgs/io - devtools_shared: - path: third_party/devtools/devtools_shared - observatory_test_package: - path: runtime/observatory/tests/service/observatory_test_package - # heapsnapshot has dependencies from outside the sdk, so cannot be part of - # the workspace. https://github.com/dart-lang/sdk/issues/50061 - heapsnapshot: - path: runtime/tools/heapsnapshot - # observatory needs a migration to language version 3.6 before it can be - # included in the workspace. (If it is not deleted before) - observatory: - path: runtime/observatory diff --git a/runtime/tools/heapsnapshot/pubspec.yaml b/runtime/tools/heapsnapshot/pubspec.yaml index 7d14e653842..74c3d9c2827 100644 --- a/runtime/tools/heapsnapshot/pubspec.yaml +++ b/runtime/tools/heapsnapshot/pubspec.yaml @@ -20,3 +20,8 @@ dev_dependencies: path: ^1.8.0 test: ^1.21.6 +dependency_overrides: + heap_snapshot: + path: ../../../pkg/heap_snapshot + mmap: + path: ../../../pkg/mmap diff --git a/samples/ffi/http/pubspec.yaml b/samples/ffi/http/pubspec.yaml index 22ef1daed8f..1e4f6a3de14 100644 --- a/samples/ffi/http/pubspec.yaml +++ b/samples/ffi/http/pubspec.yaml @@ -2,10 +2,8 @@ name: http_sample version: 0.0.1 publish_to: none -resolution: workspace - environment: - sdk: ^3.5.0 + sdk: '>=3.1.0 <4.0.0' dependencies: ffi: ^2.1.0 diff --git a/sdk/lib/js_util/js_util.dart b/sdk/lib/js_util/js_util.dart index d9609389908..3d73e10fd27 100644 --- a/sdk/lib/js_util/js_util.dart +++ b/sdk/lib/js_util/js_util.dart @@ -150,10 +150,10 @@ class NullRejectionException implements Exception { /// Converts a JavaScript Promise to a Dart [Future]. /// /// ```dart -/// // ignore: deprecated_member_use_from_same_package, deprecated_member_use +/// // ignore: deprecated_member_use_from_same_package /// import 'dart:js_util'; /// -/// // ignore: deprecated_member_use_from_same_package, deprecated_member_use +/// // ignore: deprecated_member_use_from_same_package /// import 'package:js/js.dart'; /// /// @JS() diff --git a/third_party/pkg/dap/pubspec.yaml b/third_party/pkg/dap/pubspec.yaml index bf98dd91887..97b1febb2db 100644 --- a/third_party/pkg/dap/pubspec.yaml +++ b/third_party/pkg/dap/pubspec.yaml @@ -6,9 +6,7 @@ description: >- repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/dap environment: - sdk: ^3.5.0 - -resolution: workspace + sdk: ^3.0.0 # We use 'any' version constraints here as we get our package versions from # the dart-lang/sdk repo's DEPS file. Note that this is a special case; the diff --git a/third_party/pkg/language_server_protocol/pubspec.yaml b/third_party/pkg/language_server_protocol/pubspec.yaml index 3222b87c404..968040d1732 100644 --- a/third_party/pkg/language_server_protocol/pubspec.yaml +++ b/third_party/pkg/language_server_protocol/pubspec.yaml @@ -6,9 +6,7 @@ repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/language_ publish_to: none environment: - sdk: ^3.5.0 - -resolution: workspace + sdk: ^3.0.0 # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart index 9dbe707fbe0..08760d4f687 100644 --- a/tools/generate_package_config.dart +++ b/tools/generate_package_config.dart @@ -5,94 +5,381 @@ /// Generates the repo's ".dart_tool/package_config.json" file. library; -// This script should not depend on any external packages, as it is run before -// any package resolution has taken place. import 'dart:convert'; import 'dart:io'; -final repoRoot = File(Platform.script.toFilePath()).parent.parent.uri; +// 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. + +final repoRoot = dirname(dirname(fromUri(Platform.script))); void main(List args) { final fluteExists = - Directory.fromUri(repoRoot.resolve('third_party/flute')).existsSync(); - final overridesFile = File.fromUri( - repoRoot.resolve('pubspec_overrides.yaml'), - ); - if (fluteExists) { - // Make a `pubspec_overrides.yaml` file that includes all existing overrides - // and also `package:flute` and `package:characters` - final pubspec = - File.fromUri(repoRoot.resolve('pubspec.yaml')).readAsStringSync(); - final overrides = RegExp( - 'dependency_overrides:\n([\\S\\s]*?)^\$', - multiLine: true, - ).firstMatch(pubspec)![1]; - overridesFile.writeAsStringSync(''' -# Created by tools/generate_package_config.dart to support flute. + Directory(join(repoRoot, platform('third_party/flute'))).existsSync(); -dependency_overrides: - flute: - path: third_party/flute/framework - engine: - path: third_party/flute/engine - flute_script: - path: third_party/flute/script - flute_benchmarks: - path: third_party/flute/benchmarks - material_color_utilities: - path: third_party/pkg/material_color_utilities/dart - characters: - path: third_party/pkg/core/pkgs/characters/ -$overrides -'''); - } else { - // Delete the overrides file if it exists. - if (overridesFile.existsSync()) { - File.fromUri( - repoRoot.resolve('pubspec_overrides.yaml'), - ).deleteSync(recursive: true); + var packageDirs = [ + ...listSubdirectories(platform('pkg')), + ...listSubdirectories(platform('third_party/pkg')), + if (fluteExists) ...listSubdirectories(platform('third_party/flute')), + platform('pkg/vm_service/test/test_package'), + platform('runtime/observatory'), + platform('runtime/observatory/tests/service/observatory_test_package'), + platform('runtime/tools/heapsnapshot'), + platform('sdk/lib/_internal/sdk_library_metadata'), + platform('third_party/devtools/devtools_shared'), + platform('tools/package_deps'), + ]; + + var cfePackageDirs = [platform('pkg/front_end/testcases')]; + + var feAnalyzerSharedPackageDirs = [ + platform('pkg/_fe_analyzer_shared/test/exhaustiveness/data'), + 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'), + ]; + + var frontendServerPackageDirs = [ + platform('pkg/frontend_server/test/fixtures'), + ]; + + var pkgVmPackageDirs = [platform('pkg/vm/testcases')]; + + var sampleDirs = listSubdirectories(platform('samples')).toList(); + + // Validate that all the given directories exist. + var hasMissingDirectories = false; + for (var path in [ + ...packageDirs, + ...cfePackageDirs, + ...feAnalyzerSharedPackageDirs, + ...pkgVmPackageDirs, + ...sampleDirs, + ]) { + if (!Directory(join(repoRoot, path)).existsSync()) { + stderr.writeln("Unable to locate directory: '$path'."); + hasMissingDirectories = true; } } - // Invoke `dart pub get` to create a .dart_tool/package_config.json file. - final result = Process.runSync( - Platform.resolvedExecutable, - ['pub', 'get'], - workingDirectory: repoRoot.toFilePath(), - environment: {}, // Prevent overriding eg. PUB_CACHE - ); - if (result.exitCode != 0) { - print('`pub get` failed'); - print(result.stderr); - print(result.stdout); - exit(-1); + if (hasMissingDirectories) { + exit(1); } - final packageConfig = jsonDecode( - File.fromUri( - repoRoot.resolve('.dart_tool/package_config.json'), - ).readAsStringSync(), - ); - if (!fluteExists) { - for (final package in packageConfig['packages']) { - final rootUri = package['rootUri']; - if (!(rootUri.startsWith('../third_party/') || // Third-party package - rootUri.startsWith('../pkg/') || // SDK package - rootUri.startsWith('../samples/') || // sample package - rootUri.startsWith('../runtime/') || // VM package - rootUri.startsWith( - '../tools', - ) || // A tool package for developing the sdk. - rootUri == '../' // The main workspace package - )) { - print('Package ${package['name']} is imported from outside the sdk.'); - print('It has rootUri $rootUri.'); - print( - 'See https://github.com/dart-lang/sdk/blob/main/docs/Adding-and-Updating-Dependencies.md', - ); + var packages = [ + ...makePackageConfigs(packageDirs), + ...makeCfePackageConfigs(cfePackageDirs), + ...makeFeAnalyzerSharedPackageConfigs(feAnalyzerSharedPackageDirs), + ...makeFrontendServerPackageConfigs(frontendServerPackageDirs), + ...makePkgVmPackageConfigs(pkgVmPackageDirs), + ...makePackageConfigs(sampleDirs), + ]; + packages.sort((a, b) => a.name.compareTo(b.name)); - exit(-1); + // Remove specific packages. + final packagesToRemove = { + // If we're not using flute (i.e., this is a standard checkout), do not + // include package:characters in the generated package config file. Contact + // athom@ or ensure that license requirements are met before using this + // dependency in other parts of the Dart SDK. + if (!fluteExists) 'characters', + }; + + packages.removeWhere((p) { + return packagesToRemove.contains(p.name); + }); + + // 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 = packages.where((p) => p.name == name).toList(); + if (matches.length > 1) { + final inMonorepos = matches.where((p) => p.inMonorepo).toList(); + + 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; } } } + + if (hasDuplicatePackages) { + exit(1); + } + + 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/ and third_party/pkg/', + ], + }, + ); + writeIfDifferent(configFile, packageConfig.generateJson('..')); } + +/// 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); + } +} + +/// Generates package configurations for each package in [packageDirs]. +Iterable makePackageConfigs(List packageDirs) sync* { + for (var packageDir in packageDirs) { + var name = pubspecName(packageDir); + var version = pubspecLanguageVersion(packageDir); + var hasLibDirectory = + Directory(join(repoRoot, packageDir, 'lib')).existsSync(); + + yield Package( + name: name, + rootUri: packageDir, + packageUri: hasLibDirectory ? 'lib/' : null, + languageVersion: version, + ); + } +} + +/// Generates package configurations for the special pseudo-packages. +Iterable makeSpecialPackageConfigs( + String packageNamePrefix, + List packageDirs, +) sync* { + // TODO: Remove the use of '.nonexisting/'. + for (var packageDir in packageDirs) { + yield Package( + name: '${packageNamePrefix}_${basename(packageDir)}', + rootUri: packageDir, + packageUri: '.nonexisting/', + ); + } +} + +/// Generates package configurations for the special pseudo-packages used by the +/// CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`). +Iterable makeCfePackageConfigs(List packageDirs) => + makeSpecialPackageConfigs('front_end', packageDirs); + +/// Generates package configurations for the special pseudo-packages used by the +/// _fe_analyzer_shared id tests. +Iterable makeFeAnalyzerSharedPackageConfigs( + List packageDirs, +) => makeSpecialPackageConfigs('_fe_analyzer_shared', packageDirs); + +/// Generates package configurations for the special pseudo-packages used by the +/// frontend_server tests. +Iterable makeFrontendServerPackageConfigs(List packageDirs) => + makeSpecialPackageConfigs('frontend_server', packageDirs); + +/// Generates package configurations for the special pseudo-packages used by the +/// pkg/vm unit tests (`pkg/vm/test`). +Iterable makePkgVmPackageConfigs(List packageDirs) => + makeSpecialPackageConfigs('pkg_vm', packageDirs); + +/// Finds the paths of the subdirectories of [parentPath] that contain pubspecs. +/// +/// This method recurses until it finds a pubspec.yaml file. +Iterable listSubdirectories(String parentPath) sync* { + final parent = Directory(join(repoRoot, parentPath)); + + for (var child in parent.listSync().whereType()) { + var name = basename(child.path); + + // Don't recurse into dot directories. + if (name.startsWith('.')) continue; + + final pubspecFile = File(join(child.path, 'pubspec.yaml')); + if (pubspecFile.existsSync() && !isWorkspacePubspec(pubspecFile)) { + // Stop recursing when we find a pubspec file (and that pubspec does not + // define a pub workspace). + yield join(parentPath, name); + } else { + yield* listSubdirectories(join(parentPath, name)); + } + } +} + +final versionRE = RegExp(r"(?:\^|>=)(\d+\.\d+)"); + +/// Parses the package name in the pubspec for [packageDir]. +String pubspecName(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('name: '))) { + print('Error: Pubspec for $packageDir has no name.'); + exit(1); + } + + var name = contents.firstWhere((line) => line.contains('name: ')); + return name.trim().substring('name:'.length).trim(); +} + +/// Returns whether the given pubspec defines a workspace. +bool isWorkspacePubspec(File pubspecFile) { + if (!pubspecFile.existsSync()) { + print('Error: Missing pubspec for ${pubspecFile.path}'); + exit(1); + } + + var contents = pubspecFile.readAsLinesSync(); + return contents.any((line) => line.startsWith('workspace:')); +} + +/// 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, + }); + + /// 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 toMap(String relativeTo) { + return { + 'name': name, + 'rootUri': posix(join(relativeTo, rootUri)), + if (packageUri != null) 'packageUri': posix(packageUri!), + if (languageVersion != null) 'languageVersion': languageVersion, + }; + } +} + +class PackageConfig { + final List packages; + final Map? extraData; + + PackageConfig(this.packages, {this.extraData}); + + String generateJson(String relativeTo) { + var config = {}; + 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'; + } +} + +// 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'; + } +} + +String basename(String s) { + while (s.endsWith(_separator)) { + s = s.substring(0, s.length - 1); + } + return s.substring(s.lastIndexOf(_separator) + 1); +} + +String fromUri(Uri uri) => uri.toFilePath(); + +/// Given a platform path, return a posix one. +String posix(String s) => + Platform.isWindows ? s.replaceAll(_separator, '/') : s; + +/// Given a posix path, return a platform one. +String platform(String s) => + Platform.isWindows ? s.replaceAll('/', _separator) : s; diff --git a/tools/package_deps/pubspec.yaml b/tools/package_deps/pubspec.yaml index cfe1ec8081b..d1e2a1b3c3c 100644 --- a/tools/package_deps/pubspec.yaml +++ b/tools/package_deps/pubspec.yaml @@ -7,8 +7,6 @@ publish_to: none environment: sdk: '^3.5.0' -resolution: workspace - dependencies: cli_util: any collection: any diff --git a/tools/pubspec.yaml b/tools/pubspec.yaml index 593a58b1879..88ca1989f33 100644 --- a/tools/pubspec.yaml +++ b/tools/pubspec.yaml @@ -4,8 +4,6 @@ description: Internal tools for building and working on the sdk. environment: sdk: ^3.5.0 -resolution: workspace - # This package is not intended for consumption on pub.dev. DO NOT publish. publish_to: none diff --git a/tools/run_offsets_extractor.dart b/tools/run_offsets_extractor.dart index 375d29d1f28..9bf9d14e2e2 100755 --- a/tools/run_offsets_extractor.dart +++ b/tools/run_offsets_extractor.dart @@ -39,14 +39,15 @@ void main(List args) async { print('Building $buildDir - done'); }); - final (jit, aot) = await ( - forAllConfigurationsMode((String buildDir, _, __) async { - return await run(['$buildDir/offsets_extractor']); - }).then((lines) => lines.join('\n')), - forAllConfigurationsMode((String buildDir, _, __) async { - return await run(['$buildDir/offsets_extractor_aotruntime']); - }).then((lines) => lines.join('\n')), - ).wait; + final (jit, aot) = + await ( + forAllConfigurationsMode((String buildDir, _, _) async { + return await run(['$buildDir/offsets_extractor']); + }).then((lines) => lines.join('\n')), + forAllConfigurationsMode((String buildDir, _, _) async { + return await run(['$buildDir/offsets_extractor_aotruntime']); + }).then((lines) => lines.join('\n')), + ).wait; if (exitCode == 0) { final output = StringBuffer();