flutter/dev/tools
Andrew Kolos 295a9a2031
provide command to FakeCommand::onRun (#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff.

## Context
1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename.
2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question.

## Issue
In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched.

Example:
```dart
FakeCommand(
  command: <Pattern>[
    artifacts.getArtifactPath(Artifact.engineDartBinary),
    'run',
    'vector_graphics_compiler',
    RegExp(r'--input=/.*\.temp'),
    RegExp(r'--output=/.*\.temp'),
  ],
  onRun: (List<String> command) {
    final outputPath = (() { 
      // code to parse `--output` from `command`
    })();
    testFileSystem.file(outputPath).createSync(recursive: true);
  },
)
```
2024-01-25 07:51:25 +00:00
..
bin Update generate_gradle_lockfiles script to represent newer templates, and run it on dev/ (#135175) 2023-12-05 18:04:08 +00:00
gen_defaults Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
gen_keycodes Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
localization Fixed few typos (#141543) 2024-01-16 21:40:08 +00:00
test provide command to FakeCommand::onRun (#142206) 2024-01-25 07:51:25 +00:00
vitool Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
.gitignore [flutter_conductor] update dev/tools with release tool (#69791) 2020-11-06 11:14:04 -08:00
create_api_docs.dart Fixed a lot of typos (#141431) 2024-01-12 22:10:25 +00:00
dartdoc_checker.dart update analytics in generate api docs site to use new UA4 (#136497) 2023-10-16 19:47:48 +00:00
examples_smoke_test.dart Use flutter pub get instead of dart pub get in create_api_docs.dart (#133493) 2023-08-28 16:12:16 -07:00
find_engine_commit.dart begin migrating //flutter/dev/tools to null-safety (#80834) 2021-04-23 20:24:03 -07:00
mega_gallery.dart Enable dangling_library_doc_comments and library_annotations lints (#117365) 2022-12-20 16:03:21 -08:00
pubspec.yaml Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
repackage_gradle_wrapper.sh Point to a new artifacts location. (#70673) 2021-02-04 18:44:47 -08:00
update_icons.dart Improve handling of certain icons in RTL (#130979) 2023-07-21 19:07:39 +02:00