Commit Graph

10 Commits

Author SHA1 Message Date
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
Victoria Ashworth
2892b57558
Reland "Print pretty error when xcodebuild fails due to missing simulator #130286" (#130506)
Reland https://github.com/flutter/flutter/pull/130286 with fix.

It failed the first time because of a discrepancy between the master branch and my branch (see https://github.com/flutter/flutter/pull/130504#issue-1803449182 for more info).
2023-07-13 19:36:10 +00:00
Victoria Ashworth
ab86c79c3a
Revert "Print pretty error when xcodebuild fails due to missing simulator" (#130504)
Reverts flutter/flutter#130286
2023-07-13 17:19:56 +00:00
Victoria Ashworth
604010e9e2
Print pretty error when xcodebuild fails due to missing simulator (#130286)
Starting in Xcode 15, the simulator is no longer included in Xcode and must be downloaded and installed separately.

If you try to run flutter and the simulator is missing, you'll get an error like
```
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
               		{ id:B1234A5C-67B8-901D-B2CB-FE34F56BDE78 }

               	Ineligible destinations for the "Runner" scheme:
               		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 17.0 is not installed. To use with Xcode, first download and install the platform }
```

Print a pretty error to make it easier for developers to know what to do.

Part 2 of https://github.com/flutter/flutter/issues/129558.
2023-07-13 16:51:13 +00:00
Phil Quitslund
b5e7fb076c
[flutter_tools] rename local functions with _s (#102688) 2022-04-27 16:19:07 -07:00
Michael Goderbauer
5684b9f69e
Enable no_leading_underscores_for_local_identifiers (#96422) 2022-01-21 14:43:59 -08:00
Chris Yang
1c4128c703
Xcode error message (#94747) 2021-12-21 08:39:18 -08:00
Chris Yang
e4dadf788b
[tool] xcresult issue discarder (#95273) 2021-12-14 13:29:13 -08:00
Chris Yang
70fea6d250
[tool] XCResult also parses "url" in xcresult bundle (#95054) 2021-12-13 16:04:04 -08:00
Chris Yang
04156b6636
[flutter_tools] xcresult parser. (#92604) 2021-10-29 18:29:31 -07:00