From 8e3bd8c0049afbfb66c0b20c009110d2d57d4ffa Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 28 Mar 2024 17:30:29 -0700 Subject: [PATCH 1/3] Experiment with a root package_config.json again. --- .gitignore | 12 +++-- analysis_options.yaml | 11 +++++ pubspec.yaml | 86 ++++++++++++++++++++++++++++++++++ tools/engine_tool/pubspec.yaml | 76 ------------------------------ 4 files changed, 106 insertions(+), 79 deletions(-) create mode 100644 pubspec.yaml delete mode 100644 tools/engine_tool/pubspec.yaml diff --git a/.gitignore b/.gitignore index 10440a5444ad9..43d25c9df269b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# commonly generated files +# Commonly generated files *.pyc *~ .*.sw? @@ -8,7 +8,6 @@ .classpath .clangd/ .cproject -.dart_tool .gdb_history .checkstyle .gdbinit @@ -28,6 +27,14 @@ pubspec.lock docs/doxygen/ xcuserdata +# Typical projects would hide all of .dart_tool, but we're treating it as a +# mono repository to resolve packages across the entire repository, so hide +# .dart_tool but allow the .dart_tool/package_config.json file. +.dart_tool/** +!.dart_tool/package_config.json +# But ignore the .dart_tool directory in any subdirectories. +**/.dart_tool/ + # Miscellaneous *.class *.lock @@ -56,7 +63,6 @@ xcuserdata # Flutter/Dart/Pub related **/doc/api/ -.dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages diff --git a/analysis_options.yaml b/analysis_options.yaml index d7c1e8b4dd9d5..30a9edf5707c9 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -16,6 +16,17 @@ analyzer: deprecated_member_use: ignore deprecated_member_use_from_same_package: ignore exclude: # DIFFERENT FROM FLUTTER/FLUTTER + # Directories that might have Dart code, but aren't part of the engine, i.e. + # vended directories or code that is copied by tooling. + - prebuilts/ + - third_party/ + # Directories that have Dart code, but the Dart code isn't resolvable by the + # analyzer, i.e. it uses custom embedding or other tooling that the analyzer + # can't be aware of. + - examples/ + - impeller/ + - runtime/ + - shell/ # Fixture depends on dart:ui and raises false positives. - flutter_frontend_server/test/fixtures/lib/main.dart diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000000000..4aa7dc39ff1fc --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,86 @@ +# A mock package that serves as the root of the repository. +name: _engine +publish_to: none + +# This needs to be set high enough to use newer language features, but does not +# need to be revved everytime a new SDK is pushed. In other words, manually +# update this as needed. +environment: + sdk: ^3.3.0 + +# Packages that are hosted in the engine, i.e. the package is defined here. +# +# Nothing here should have the words "third_party" in the path. +dev_dependencies: + engine_build_configs: + path: tools/pkg/engine_build_configs + engine_repo_tools: + path: tools/pkg/engine_repo_tools + engine_tool: + path: tools/engine_tool + process_fakes: + path: tools/pkg/process_fakes + +# Dependencies that are not hosted in the engine, i.e. brought in via DEPS. +# The version should be "any", as we override the path to point to the local +# copy below. +dependencies: + args: any + async: any + async_helper: any + collection: any + expect: any + file: any + litetest: any + logging: any + meta: any + path: any + platform: any + process: any + process_runner: any + smith: any + source_span: any + string_scanner: any + term_glyph: any + yaml: any + +# Every dependency must resolve to a local directory, either because it is a +# local package (i.e. in tools/pkg or similar), or because it is vended to a +# third_party directly (i.e. through DEPS). Nothing should resolve to pub.dev. +dependency_overrides: + 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 + collection: + path: ../third_party/dart/third_party/pkg/collection + expect: + path: ../third_party/dart/pkg/expect + file: + path: ../third_party/dart/third_party/pkg/file/packages/file + litetest: + path: testing/litetest + logging: + path: ../third_party/dart/third_party/pkg/logging + meta: + path: ../third_party/dart/pkg/meta + path: + path: ../third_party/dart/third_party/pkg/path + platform: + path: third_party/pkg/platform + process: + path: third_party/pkg/process + process_runner: + path: third_party/pkg/process_runner + 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 + yaml: + path: ../third_party/dart/third_party/pkg/yaml diff --git a/tools/engine_tool/pubspec.yaml b/tools/engine_tool/pubspec.yaml deleted file mode 100644 index 1fc8f9fb25552..0000000000000 --- a/tools/engine_tool/pubspec.yaml +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -name: engine_tool -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. - -# 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 - -dependencies: - args: any - engine_build_configs: - path: ../pkg/engine_build_configs - engine_repo_tools: - path: ../pkg/engine_repo_tools - file: any - logging: any - meta: any - path: any - platform: any - process_runner: any - -dev_dependencies: - async_helper: any - expect: any - litetest: any - process_fakes: - path: ../pkg/process_fakes - smith: any - -dependency_overrides: - 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 - collection: - path: ../../../third_party/dart/third_party/pkg/collection - expect: - path: ../../../third_party/dart/pkg/expect - file: - path: ../../../third_party/dart/third_party/pkg/file/packages/file - litetest: - path: ../../testing/litetest - logging: - path: ../../../third_party/dart/third_party/pkg/logging - meta: - path: ../../../third_party/dart/pkg/meta - path: - path: ../../../third_party/dart/third_party/pkg/path - platform: - path: ../../third_party/pkg/platform - process: - path: ../../third_party/pkg/process - process_runner: - path: ../../third_party/pkg/process_runner - 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 - yaml: - path: ../../../third_party/dart/third_party/pkg/yaml From 289c1d5fd383691a83adff1733f6da67d77d3546 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Fri, 29 Mar 2024 11:54:47 -0700 Subject: [PATCH 2/3] Try a root package_config, again. --- .dart_tool/package_config.json | 143 +++++++++++++++++++++++++++++++++ .gitignore | 2 +- pubspec.yaml | 86 -------------------- 3 files changed, 144 insertions(+), 87 deletions(-) create mode 100644 .dart_tool/package_config.json delete mode 100644 pubspec.yaml diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json new file mode 100644 index 0000000000000..9f37f40f699fd --- /dev/null +++ b/.dart_tool/package_config.json @@ -0,0 +1,143 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "args", + "rootUri": "../../third_party/dart/third_party/pkg/args", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "async", + "rootUri": "../../third_party/dart/third_party/pkg/async", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "async_helper", + "rootUri": "../../third_party/dart/pkg/async_helper", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "collection", + "rootUri": "../../third_party/dart/third_party/pkg/collection", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "engine_build_configs", + "rootUri": "../tools/pkg/engine_build_configs", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "engine_repo_tools", + "rootUri": "../tools/pkg/engine_repo_tools", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "engine_tool", + "rootUri": "../tools/engine_tool", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "expect", + "rootUri": "../../third_party/dart/pkg/expect", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "file", + "rootUri": "../../third_party/dart/third_party/pkg/file/packages/file", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "litetest", + "rootUri": "../testing/litetest", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "logging", + "rootUri": "../../third_party/dart/third_party/pkg/logging", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "meta", + "rootUri": "../../third_party/dart/pkg/meta", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "path", + "rootUri": "../../third_party/dart/third_party/pkg/path", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "platform", + "rootUri": "../third_party/pkg/platform", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "process", + "rootUri": "../third_party/pkg/process", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "process_fakes", + "rootUri": "../tools/pkg/process_fakes", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "process_runner", + "rootUri": "../third_party/pkg/process_runner", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "smith", + "rootUri": "../../third_party/dart/pkg/smith", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "source_span", + "rootUri": "../../third_party/dart/third_party/pkg/source_span", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "string_scanner", + "rootUri": "../../third_party/dart/third_party/pkg/string_scanner", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "term_glyph", + "rootUri": "../../third_party/dart/third_party/pkg/term_glyph", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "yaml", + "rootUri": "../../third_party/dart/third_party/pkg/yaml", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "_engine", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "3.3" + } + ] +} diff --git a/.gitignore b/.gitignore index 43d25c9df269b..abd84698f229f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ xcuserdata .dart_tool/** !.dart_tool/package_config.json # But ignore the .dart_tool directory in any subdirectories. -**/.dart_tool/ +*/**/.dart_tool/ # Miscellaneous *.class diff --git a/pubspec.yaml b/pubspec.yaml deleted file mode 100644 index 4aa7dc39ff1fc..0000000000000 --- a/pubspec.yaml +++ /dev/null @@ -1,86 +0,0 @@ -# A mock package that serves as the root of the repository. -name: _engine -publish_to: none - -# This needs to be set high enough to use newer language features, but does not -# need to be revved everytime a new SDK is pushed. In other words, manually -# update this as needed. -environment: - sdk: ^3.3.0 - -# Packages that are hosted in the engine, i.e. the package is defined here. -# -# Nothing here should have the words "third_party" in the path. -dev_dependencies: - engine_build_configs: - path: tools/pkg/engine_build_configs - engine_repo_tools: - path: tools/pkg/engine_repo_tools - engine_tool: - path: tools/engine_tool - process_fakes: - path: tools/pkg/process_fakes - -# Dependencies that are not hosted in the engine, i.e. brought in via DEPS. -# The version should be "any", as we override the path to point to the local -# copy below. -dependencies: - args: any - async: any - async_helper: any - collection: any - expect: any - file: any - litetest: any - logging: any - meta: any - path: any - platform: any - process: any - process_runner: any - smith: any - source_span: any - string_scanner: any - term_glyph: any - yaml: any - -# Every dependency must resolve to a local directory, either because it is a -# local package (i.e. in tools/pkg or similar), or because it is vended to a -# third_party directly (i.e. through DEPS). Nothing should resolve to pub.dev. -dependency_overrides: - 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 - collection: - path: ../third_party/dart/third_party/pkg/collection - expect: - path: ../third_party/dart/pkg/expect - file: - path: ../third_party/dart/third_party/pkg/file/packages/file - litetest: - path: testing/litetest - logging: - path: ../third_party/dart/third_party/pkg/logging - meta: - path: ../third_party/dart/pkg/meta - path: - path: ../third_party/dart/third_party/pkg/path - platform: - path: third_party/pkg/platform - process: - path: third_party/pkg/process - process_runner: - path: third_party/pkg/process_runner - 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 - yaml: - path: ../third_party/dart/third_party/pkg/yaml From 72ae53cfb1372d5d5b21cdc64c9ea729cb3b20d4 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Fri, 29 Mar 2024 12:10:17 -0700 Subject: [PATCH 3/3] ++ --- bin/et | 9 +++------ tools/pub_get_offline.py | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/bin/et b/bin/et index a3c30df0241d9..806060ae2bc66 100755 --- a/bin/et +++ b/bin/et @@ -58,9 +58,6 @@ PLATFORM="${OS}-${CPU}" DART_SDK_DIR="${ENGINE_DIR}/prebuilts/${PLATFORM}/dart-sdk" DART="${DART_SDK_DIR}/bin/dart" -if [ ! -d "${ENGINE_DIR}/tools/engine_tool/.dart_tool" ]; then - echo "You must run 'gclient sync -D' before using this tool." - exit 1 -fi - -"${DART}" --disable-dart-dev "${ENGINE_DIR}/tools/engine_tool/bin/et.dart" "$@" +"${DART}" \ + --disable-dart-dev \ + "${ENGINE_DIR}/tools/engine_tool/bin/et.dart" "$@" diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index f77e59d7d9577..4fc683465c1a4 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -38,7 +38,6 @@ os.path.join(ENGINE_DIR, 'tools', 'compare_goldens'), os.path.join(ENGINE_DIR, 'tools', 'const_finder'), os.path.join(ENGINE_DIR, 'tools', 'dir_contents_diff'), - os.path.join(ENGINE_DIR, 'tools', 'engine_tool'), os.path.join(ENGINE_DIR, 'tools', 'gen_web_locale_keymap'), os.path.join(ENGINE_DIR, 'tools', 'githooks'), os.path.join(ENGINE_DIR, 'tools', 'golden_tests_harvester'),