Skip to content

Commit

Permalink
Pub workspace-ify most of testing/ and parts of tools/ (flutter#5…
Browse files Browse the repository at this point in the history
…4124)

Replaces and closes flutter#53997.

This PR migrates the following packages to the pub workspace:
  - testing/benchmark
  - testing/dart
  - testing/litetest
  - testing/pkg_test_demo
  - testing/scenario_app
  - testing/skia_gold_client
  - testing/symbols
  - tools/golden_tests_harvester
  - tools/pkg/process_fakes

It also makes minor changes to the Dart build rules in order to resolve the root package_config, instead of per-package.

I am _not_ totally confident of the `_embedder.yaml` change, but I also can't explain what is needed to continue analyzing `lib/ui` without analysis failures that all of the symbols in `dart:nativewrappers` are missing.
  • Loading branch information
matanlurey authored Jul 26, 2024
1 parent e28f875 commit 5864897
Show file tree
Hide file tree
Showing 16 changed files with 201 additions and 405 deletions.
40 changes: 27 additions & 13 deletions build/dart/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ template("flutter_frontend_server") {
}

packages_args = []
package_config = ""
if (defined(invoker.package_config)) {
packages_args += [
"--packages",
rebase_path(invoker.package_config, root_build_dir),
]
package_config = rebase_path(invoker.package_config, root_build_dir)
} else {
# Use the root engine package config by default.
# As we move towards a single pub workspace for the engine, this will be
# the correct package config to use, as we will no longer have a per-package
# .dart_tool/package_config.json.
package_config = rebase_path("//flutter/.dart_tool/package_config.json")
}

packages_args += [
"--packages",
package_config,
]
snapshot_depfile = "$kernel_output.d"

common_vm_args = [ "--disable-dart-dev" ]
Expand Down Expand Up @@ -125,16 +132,15 @@ template("flutter_frontend_server") {
# as the app-jit, aot-elf, or aot-assembly snapshot for targeting Flutter on
# Android or iOS.
#
# Invoker must supply dart_main and package_config. Invoker may optionally
# Invoker must supply dart_main. Invoker may optionally supply package_config,
# which otherwise defaults to the repo-wide pacakge_config, and optionally
# supply aot as a boolean and product as a boolean.
#
# On Android, the invoker may provide output_aot_lib as a string to override
# the default filename for the aot-elf snapshot.
template("flutter_snapshot") {
assert(!is_fuchsia)
assert(defined(invoker.main_dart), "main_dart is a required parameter.")
assert(defined(invoker.package_config),
"package_config is a required parameter.")

kernel_target = "_${target_name}_kernel"
snapshot_target = "_${target_name}_snapshot"
Expand Down Expand Up @@ -170,11 +176,19 @@ template("flutter_snapshot") {
}
}

flutter_frontend_server(kernel_target) {
main_dart = invoker.main_dart
package_config = invoker.package_config
kernel_output = kernel_output
extra_args = extra_frontend_server_args
if (defined(invoker.package_config)) {
flutter_frontend_server(kernel_target) {
main_dart = invoker.main_dart
package_config = invoker.package_config
kernel_output = kernel_output
extra_args = extra_frontend_server_args
}
} else {
flutter_frontend_server(kernel_target) {
main_dart = invoker.main_dart
kernel_output = kernel_output
extra_args = extra_frontend_server_args
}
}

compiled_action(snapshot_target) {
Expand Down
4 changes: 4 additions & 0 deletions lib/web_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ dev_dependencies:
dependency_overrides:
engine_repo_tools:
path: ../../tools/pkg/engine_repo_tools
git_repo_tools:
path: ../../tools/pkg/git_repo_tools
skia_gold_client:
path: ../../testing/skia_gold_client
122 changes: 120 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,16 @@ environment:

# Declare all packages that are part of the workspace.
workspace:
- testing/benchmark
- testing/dart
- testing/litetest
- testing/pkg_test_demo
- testing/scenario_app
- testing/skia_gold_client
- testing/symbols
- tools/engine_tool
- tools/golden_tests_harvester
- tools/pkg/process_fakes

# Declare all dependencies that are used by one or more packages.
#
Expand Down Expand Up @@ -109,6 +117,14 @@ dependencies:
process_runner: any
smith: any

dev_dependencies:
litetest:
path: ./testing/litetest
process_fakes:
path: ./tools/pkg/process_fakes
skia_gold_client:
path: ./testing/skia_gold_client

# Instructs pub on how to resolve the dependencies that are part of "DEPS".
#
# For historic reasons, there are ~3 or so places packages might be located:
Expand All @@ -130,43 +146,145 @@ dependencies:
# of available packages here:
# <https://github.com/dart-lang/sdk/blob/main/DEPS>.
dependency_overrides:
_discoveryapis_commons:
path: ./third_party/pkg/googleapis/discoveryapis_commons
_fe_analyzer_shared:
path: ./third_party/dart/pkg/_fe_analyzer_shared
_macros:
path: ./third_party/dart/pkg/_macros
analyzer:
path: ./third_party/dart/pkg/analyzer
args:
path: ./third_party/dart/third_party/pkg/args
async:
path: ./third_party/dart/third_party/pkg/async
async_helper:
path: ./third_party/dart/pkg/async_helper
boolean_selector:
path: ./third_party/dart/third_party/pkg/boolean_selector
collection:
path: ./third_party/dart/third_party/pkg/collection
convert:
path: ./third_party/dart/third_party/pkg/convert
coverage:
path: ./third_party/pkg/coverage
crypto:
path: ./third_party/dart/third_party/pkg/crypto
dir_contents_diff:
path: ./tools/dir_contents_diff
engine_build_configs:
path: ./tools/pkg/engine_build_configs
engine_repo_tools:
path: ./tools/pkg/engine_repo_tools
equatable:
path: ./third_party/pkg/equatable
expect:
path: ./third_party/dart/pkg/expect
file:
path: ./third_party/dart/third_party/pkg/file/packages/file
ffi:
path: ./third_party/dart/third_party/pkg/native/pkgs/ffi
fixnum:
path: ./third_party/dart/third_party/pkg/fixnum
frontend_server_client:
path: ./third_party/dart/third_party/pkg/webdev/frontend_server_client
gcloud:
path: ./third_party/pkg/gcloud
git_repo_tools:
path: ./tools/pkg/git_repo_tools
glob:
path: ./third_party/dart/third_party/pkg/glob
googleapis:
path: ./third_party/pkg/googleapis/generated/googleapis
googleapis_auth:
path: ./third_party/pkg/googleapis/googleapis_auth
http:
path: ./third_party/dart/third_party/pkg/http/pkgs/http
http_multi_server:
path: ./third_party/dart/third_party/pkg/http_multi_server
http_parser:
path: ./third_party/dart/third_party/pkg/http_parser
io:
path: ./third_party/pkg/io
js:
path: ./third_party/dart/pkg/js
logging:
path: ./third_party/dart/third_party/pkg/logging
macros:
path: ./third_party/dart/pkg/macros
matcher:
path: ./third_party/dart/third_party/pkg/matcher
meta:
path: ./third_party/dart/pkg/meta
metrics_center:
path: ./third_party/pkg/flutter_packages/packages/metrics_center
mime:
path: ./third_party/dart/third_party/pkg/mime
node_preamble:
path: ./third_party/pkg/node_preamble
package_config:
path: ./third_party/dart/third_party/pkg/package_config
path:
path: ./third_party/dart/third_party/pkg/path
platform:
path: ./third_party/pkg/platform
pool:
path: ./third_party/dart/third_party/pkg/pool
process:
path: ./third_party/pkg/process
process_fakes:
path: ./tools/pkg/process_fakes
process_runner:
path: ./third_party/pkg/process_runner
protobuf:
path: ./third_party/dart/third_party/pkg/protobuf/protobuf
pub_semver:
path: ./third_party/dart/third_party/pkg/pub_semver
shelf:
path: ./third_party/dart/third_party/pkg/shelf/pkgs/shelf
shelf_packages_handler:
path: ./third_party/dart/third_party/pkg/shelf/pkgs/shelf_packages_handler
shelf_static:
path: ./third_party/dart/third_party/pkg/shelf/pkgs/shelf_static
shelf_web_socket:
path: ./third_party/dart/third_party/pkg/shelf/pkgs/shelf_web_socket
smith:
path: ./third_party/dart/pkg/smith
source_map_stack_trace:
path: ./third_party/dart/third_party/pkg/source_map_stack_trace
source_maps:
path: ./third_party/dart/third_party/pkg/source_maps
source_span:
path: ./third_party/dart/third_party/pkg/source_span
stack_trace:
path: ./third_party/dart/third_party/pkg/stack_trace
stream_channel:
path: ./third_party/dart/third_party/pkg/stream_channel
string_scanner:
path: ./third_party/dart/third_party/pkg/string_scanner
term_glyph:
path: ./third_party/dart/third_party/pkg/term_glyph
test:
path: ./third_party/dart/third_party/pkg/test/pkgs/test
test_api:
path: ./third_party/dart/third_party/pkg/test/pkgs/test_api
test_core:
path: ./third_party/dart/third_party/pkg/test/pkgs/test_core
typed_data:
path: ./third_party/dart/third_party/pkg/typed_data
vector_math:
path: ./third_party/pkg/vector_math
vm_service:
path: ./third_party/dart/pkg/vm_service
vm_service_protos:
path: ./third_party/dart/pkg/vm_service_protos
watcher:
path: ./third_party/dart/third_party/pkg/watcher
web:
path: ./third_party/dart/third_party/pkg/web
web_socket:
path: ./third_party/dart/third_party/pkg/http/pkgs/web_socket
web_socket_channel:
path: ./third_party/dart/third_party/pkg/web_socket_channel
webkit_inspection_protocol:
path: ./third_party/dart/third_party/pkg/webkit_inspection_protocol
yaml:
path: ./third_party/dart/third_party/pkg/yaml
2 changes: 1 addition & 1 deletion sky/packages/sky_engine/lib/_embedder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ embedded_libs:
"dart:_js_annotations": "../../../../third_party/dart/sdk/lib/js/_js_annotations.dart"
# The _js_types library is also needed for the same reasons as _internal.
"dart:_js_types": "../../../../third_party/dart/sdk/lib/_internal/js_shared/lib/js_types.dart"
"dart:nativewrappers": "_empty.dart"
"dart:nativewrappers": "../../../../third_party/dart/sdk/lib/html/dartium/nativewrappers.dart"
66 changes: 5 additions & 61 deletions testing/benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@

name: flutter_engine_benchmark
publish_to: none
environment:
sdk: '>=3.2.0-0 <4.0.0'

# Do not add any dependencies that require more than what is provided in
# //third_party/pkg, //third_party/dart/pkg, or
# //third_party/dart/third_party/pkg. In particular, package:test is not usable
# here.
# Required for workspace support.
environment:
sdk: ^3.5.0-294.0.dev

# If you do add packages here, make sure you can run `pub get --offline`, and
# check the .packages and .package_config to make sure all the paths are
# relative to this directory into //third_party/dart
# This package is managed as part of the engine workspace.
resolution: workspace

dependencies:
args: any
Expand All @@ -23,55 +19,3 @@ dependencies:

dev_dependencies:
litetest: any

dependency_overrides:
_discoveryapis_commons:
path: ../../third_party/pkg/googleapis/discoveryapis_commons
args:
path: ../../third_party/dart/third_party/pkg/args
async_helper:
path: ../../third_party/dart/pkg/async_helper
async:
path: ../../third_party/dart/third_party/pkg/async
collection:
path: ../../third_party/dart/third_party/pkg/collection
convert:
path: ../../third_party/dart/third_party/pkg/convert
crypto :
path: ../../third_party/dart/third_party/pkg/crypto
equatable:
path: ../../third_party/pkg/equatable
expect:
path: ../../third_party/dart/pkg/expect
gcloud:
path: ../../third_party/pkg/gcloud
googleapis:
path: ../../third_party/pkg/googleapis/generated/googleapis
googleapis_auth:
path: ../../third_party/pkg/googleapis/googleapis_auth
http:
path: ../../third_party/dart/third_party/pkg/http/pkgs/http
http_parser:
path: ../../third_party/dart/third_party/pkg/http_parser
js:
path: ../../third_party/dart/pkg/js
litetest:
path: ../litetest
meta:
path: ../../third_party/dart/pkg/meta
metrics_center:
path: ../../third_party/pkg/flutter_packages/packages/metrics_center
path:
path: ../../third_party/dart/third_party/pkg/path
smith:
path: ../../third_party/dart/pkg/smith
source_span:
path: ../../third_party/dart/third_party/pkg/source_span
string_scanner:
path: ../../third_party/dart/third_party/pkg/string_scanner
term_glyph:
path: ../../third_party/dart/third_party/pkg/term_glyph
typed_data:
path: ../../third_party/dart/third_party/pkg/typed_data
web:
path: ../../third_party/dart/third_party/pkg/web
1 change: 0 additions & 1 deletion testing/dart/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ foreach(test, tests) {
"-DkFlutterBuildDirectory=$flutter_build_dir",
"-DkSkiaGoldWorkDirectory=$skia_gold_work_dir",
]
package_config = ".dart_tool/package_config.json"
deps = [ "//flutter/third_party/txt:txt_fixtures" ]
testonly = true
}
Expand Down
1 change: 0 additions & 1 deletion testing/dart/observatory/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ foreach(test, tests) {
flutter_frontend_server("compile_$test") {
main_dart = test
kernel_output = "$root_gen_dir/$test.dill"
package_config = "../.dart_tool/package_config.json"
}
}

Expand Down
Loading

0 comments on commit 5864897

Please sign in to comment.