Migrate to use pub workspace

Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This commit is contained in:
Sigurd Meldgaard
2025-03-14 05:21:40 -07:00
committed by Commit Queue
parent 424cf1bd53
commit b9b77058a9
73 changed files with 536 additions and 816 deletions
+1 -1
View File
@@ -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.
+1 -5
View File
@@ -6,6 +6,7 @@ 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
@@ -19,8 +20,3 @@ dev_dependencies:
collection: any
test: any
dependency_overrides:
test:
path: ../../third_party/pkg/test/pkgs/test/
analyzer:
path: ../analyzer
+2
View File
@@ -6,6 +6,8 @@ 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
+3 -1
View File
@@ -8,7 +8,9 @@ publish_to: none
repository: https://github.com/dart-lang/sdk/tree/main/pkg/_macros
environment:
sdk: ^3.4.0-256.0.dev
sdk: ^3.5.0
resolution: workspace
# Note that as an SDK vendored package, pub package dependencies are only
# allowed in the dev_dependencies section.
+2 -124
View File
@@ -5,6 +5,8 @@ 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
@@ -44,127 +46,3 @@ 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
+2
View File
@@ -12,6 +12,8 @@ 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
+1 -124
View File
@@ -6,6 +6,7 @@ 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
@@ -21,127 +22,3 @@ 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
+1 -14
View File
@@ -7,6 +7,7 @@ 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
@@ -39,17 +40,3 @@ 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
+2
View File
@@ -7,6 +7,8 @@ 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
+1 -9
View File
@@ -6,6 +6,7 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer_plugin
environment:
sdk: ^3.5.0
resolution: workspace
dependencies:
analyzer: ^7.2.0
@@ -26,12 +27,3 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -11,6 +11,8 @@ description: >-
environment:
sdk: ^3.5.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
expect: any
+2
View File
@@ -5,6 +5,8 @@ publish_to: none
environment:
sdk: ^3.5.0
resolution: workspace
dependencies:
cli_config: any
logging: any
+2
View File
@@ -8,6 +8,8 @@ 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
+2
View File
@@ -7,6 +7,8 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -8,6 +8,8 @@ description: >-
environment:
sdk: '^3.7.0'
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
+2
View File
@@ -9,6 +9,8 @@ description: >-
environment:
sdk: "^3.7.0"
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
+2
View File
@@ -8,6 +8,8 @@ description: >
environment:
sdk: '^3.7.0'
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
path: any
+2
View File
@@ -5,6 +5,8 @@ publish_to: none
environment:
sdk: ^3.5.0
resolution: workspace
# Add the bin/dart2native.dart script to the scripts pub installs.
executables:
dart2native:
+2
View File
@@ -4,6 +4,8 @@ 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
+1
View File
@@ -11,6 +11,7 @@ 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:
@@ -7,6 +7,8 @@ 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
+3 -1
View File
@@ -4,7 +4,9 @@ name: dartdev
publish_to: none
environment:
sdk: ^3.3.0
sdk: ^3.5.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
+1
View File
@@ -8,6 +8,7 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/dds
environment:
sdk: ^3.5.0
resolution: workspace
dependencies:
args: ^2.0.0
+1
View File
@@ -8,6 +8,7 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -12,6 +12,8 @@ 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
+5 -36
View File
@@ -8,6 +8,11 @@ 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
@@ -34,39 +39,3 @@ 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
+6
View File
@@ -0,0 +1,6 @@
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
+2
View File
@@ -6,6 +6,8 @@ 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
+2 -3
View File
@@ -5,9 +5,8 @@ publish_to: none
environment:
sdk: ^3.5.0
resolution: workspace
dependencies:
vm_service: any
dependency_overrides:
vm_service:
path: ../vm_service
+2
View File
@@ -9,6 +9,8 @@ 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.
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -8,6 +8,8 @@ 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
+2
View File
@@ -9,6 +9,8 @@ description: >-
environment:
sdk: ^3.7.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
analyzer: any
+2
View File
@@ -8,6 +8,8 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/macros
environment:
sdk: ^3.5.0
resolution: workspace
dependencies:
_macros:
sdk: dart
+2
View File
@@ -13,6 +13,8 @@ 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.
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -9,6 +9,8 @@ description: >
environment:
sdk: ^3.5.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
+2
View File
@@ -6,6 +6,8 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/native_stack_traces
environment:
sdk: ^3.5.0
resolution: workspace
executables:
decode:
+3
View File
@@ -2,4 +2,7 @@
name: node_preamble
environment:
sdk: ^3.7.0
resolution: workspace
publish_to: none
+2
View File
@@ -7,6 +7,8 @@ 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
+2
View File
@@ -7,6 +7,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2 -119
View File
@@ -5,6 +5,8 @@ publish_to: none
environment:
sdk: ^3.5.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
@@ -12,122 +14,3 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -5,6 +5,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+2
View File
@@ -9,6 +9,8 @@ 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
+2
View File
@@ -7,6 +7,8 @@ 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
+2
View File
@@ -6,6 +6,8 @@ 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
+1
View File
@@ -9,6 +9,7 @@ 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
@@ -1,4 +1,5 @@
name: test_package
publish_to: none
environment:
sdk: ^3.5.0
sdk: ^3.5.0
resolution: workspace
+1
View File
@@ -9,6 +9,7 @@ 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'
+1
View File
@@ -9,6 +9,7 @@ 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
+1
View File
@@ -6,6 +6,7 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_snapshot_analysis
environment:
sdk: ^3.5.0
resolution: workspace
executables:
snapshot_analysis: analyse
+2
View File
@@ -6,6 +6,8 @@ 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
+318
View File
@@ -0,0 +1,318 @@
# 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
# 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
-5
View File
@@ -20,8 +20,3 @@ dev_dependencies:
path: ^1.8.0
test: ^1.21.6
dependency_overrides:
heap_snapshot:
path: ../../../pkg/heap_snapshot
mmap:
path: ../../../pkg/mmap
+2 -2
View File
@@ -150,10 +150,10 @@ class NullRejectionException implements Exception {
/// Converts a JavaScript Promise to a Dart [Future].
///
/// ```dart
/// // ignore: deprecated_member_use_from_same_package
/// // ignore: deprecated_member_use_from_same_package, deprecated_member_use
/// import 'dart:js_util';
///
/// // ignore: deprecated_member_use_from_same_package
/// // ignore: deprecated_member_use_from_same_package, deprecated_member_use
/// import 'package:js/js.dart';
///
/// @JS()
+3 -1
View File
@@ -6,7 +6,9 @@ description: >-
repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/dap
environment:
sdk: ^3.0.0
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
+3 -1
View File
@@ -6,7 +6,9 @@ repository: https://github.com/dart-lang/sdk/tree/main/third_party/pkg/language_
publish_to: none
environment:
sdk: ^3.0.0
sdk: ^3.5.0
resolution: workspace
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
+72 -360
View File
@@ -5,381 +5,93 @@
/// 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';
// 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)));
final repoRoot = File(Platform.script.toFilePath()).parent.parent.uri;
void main(List<String> args) {
final fluteExists =
Directory(join(repoRoot, platform('third_party/flute'))).existsSync();
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;
}
}
if (hasMissingDirectories) {
exit(1);
}
var packages = <Package>[
...makePackageConfigs(packageDirs),
...makeCfePackageConfigs(cfePackageDirs),
...makeFeAnalyzerSharedPackageConfigs(feAnalyzerSharedPackageDirs),
...makeFrontendServerPackageConfigs(frontendServerPackageDirs),
...makePkgVmPackageConfigs(pkgVmPackageDirs),
...makePackageConfigs(sampleDirs),
];
packages.sort((a, b) => a.name.compareTo(b.name));
// 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/',
],
},
Directory.fromUri(repoRoot.resolve('third_party/flute')).existsSync();
final overridesFile = File.fromUri(
repoRoot.resolve('pubspec_overrides.yaml'),
);
writeIfDifferent(configFile, packageConfig.generateJson('..'));
}
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.
/// 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<Package> makePackageConfigs(List<String> 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<Package> makeSpecialPackageConfigs(
String packageNamePrefix,
List<String> 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<Package> makeCfePackageConfigs(List<String> packageDirs) =>
makeSpecialPackageConfigs('front_end', packageDirs);
/// Generates package configurations for the special pseudo-packages used by the
/// _fe_analyzer_shared id tests.
Iterable<Package> makeFeAnalyzerSharedPackageConfigs(
List<String> packageDirs,
) => makeSpecialPackageConfigs('_fe_analyzer_shared', packageDirs);
/// Generates package configurations for the special pseudo-packages used by the
/// frontend_server tests.
Iterable<Package> makeFrontendServerPackageConfigs(List<String> packageDirs) =>
makeSpecialPackageConfigs('frontend_server', packageDirs);
/// Generates package configurations for the special pseudo-packages used by the
/// pkg/vm unit tests (`pkg/vm/test`).
Iterable<Package> makePkgVmPackageConfigs(List<String> 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<String> listSubdirectories(String parentPath) sync* {
final parent = Directory(join(repoRoot, parentPath));
for (var child in parent.listSync().whereType<Directory>()) {
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));
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);
}
}
}
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);
// 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);
}
final packageConfig = jsonDecode(
File.fromUri(
repoRoot.resolve('.dart_tool/package_config.json'),
).readAsStringSync(),
);
var contents = pubspecFile.readAsLinesSync();
if (!contents.any((line) => line.contains('name: '))) {
print('Error: Pubspec for $packageDir has no name.');
exit(1);
}
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('../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 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<String, Object?> 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<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];
exit(-1);
}
}
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;
+2
View File
@@ -7,6 +7,8 @@ publish_to: none
environment:
sdk: '^3.5.0'
resolution: workspace
dependencies:
cli_util: any
collection: any
+2
View File
@@ -4,6 +4,8 @@ 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
+8 -9
View File
@@ -39,15 +39,14 @@ void main(List<String> args) async {
print('Building $buildDir - done');
});
final (jit, aot) =
await (
forAllConfigurationsMode((String buildDir, _, _) async {
return await run(['$buildDir/offsets_extractor']);
}).then<String>((lines) => lines.join('\n')),
forAllConfigurationsMode((String buildDir, _, _) async {
return await run(['$buildDir/offsets_extractor_aotruntime']);
}).then<String>((lines) => lines.join('\n')),
).wait;
final (jit, aot) = await (
forAllConfigurationsMode((String buildDir, _, __) async {
return await run(['$buildDir/offsets_extractor']);
}).then<String>((lines) => lines.join('\n')),
forAllConfigurationsMode((String buildDir, _, __) async {
return await run(['$buildDir/offsets_extractor_aotruntime']);
}).then<String>((lines) => lines.join('\n')),
).wait;
if (exitCode == 0) {
final output = StringBuffer();