Omit hardcoded --packages=.dart_tool/package_config.json. (#160982)

Closes https://github.com/flutter/flutter/issues/160219.

This hard-coded package configuration is no longer strictly correct
as-of Dart 3.6.0; a pub _workspace_
(https://dart.dev/tools/pub/workspaces) can appear at a higher-level
than a package, and if the package is part of the workspace, tooling is
expected to (automatically) find `.dart_tool/package_config.json` at a
higher-level.

For example, the _engine_ sub-repo uses a
[workspace](9fd5bddc65/engine/src/flutter/pubspec.yaml (L82)),
which means that, for example,
`%ENGINE%/tools/engine_tool/.dart_tool/package_config.json` will _never_
exist (it will be at `%ENGINE%/.dart_tools/package_config.json`.

As currently defined, the test-golden comparator interface will fail
with a package that uses workspaces. By removing the flag (and letting
automatic `--packages` resolution occur), I _believe_ the problem is
automatically resolved (but I'll let CI prove that for us).
This commit is contained in:
Matan Lurey 2025-01-06 08:25:30 -08:00 committed by GitHub
parent a6c057c406
commit 0c3359df8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 9 deletions

View File

@ -112,7 +112,6 @@ final class TestGoldenComparator {
_flutterTesterBinPath,
'--disable-vm-service',
'--non-interactive',
'--packages=${_fileSystem.path.join('.dart_tool', 'package_config.json')}',
output,
];

View File

@ -396,13 +396,7 @@ void main() {
() async {
processManager.addCommand(
const FakeCommand(
command: <String>[
'flutter_tester',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'',
],
command: <String>['flutter_tester', '--disable-vm-service', '--non-interactive', ''],
stdout: '{"success": true}\n',
),
);

View File

@ -222,7 +222,6 @@ FakeCommand _fakeFluterTester(
pathToBinTool,
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
],
stdout: stdout,