mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 15:23:25 +08:00
[tool] Skip pathified analysis on resolver errors (#4647)
If adding a pathified dependency creates a resolver error, then skip it instead of failing when running pathified analysis. The purpose of pathified analysis it to pre-detect failures that would happen on publishing, and if there's a resolver error that means the publishing even won't affect the package anyway. See https://github.com/flutter/packages/pull/4483#issuecomment-1664468621 for an example case where we need this. (In theory we could get delayed OOB errors that this will missâe.g., in the case above if the PR would actually break rfw/example/wasm, then if at some later date `wasm` updated to use a newer `ffi`, eliminating the resolver conflict, then suddenly rfw/example/wasm would pick up the PR and break. That seems *extremely* unlikely, however, so I'm not concerned that this will be a problem in practice. We can revisit if that changes.)
This commit is contained in:
@ -315,6 +315,39 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
test('skips if requested if "pub get" fails in the resolver', () async {
|
||||
final RepositoryPackage plugin = createFakePlugin('foo', packagesDir);
|
||||
|
||||
final FakeProcessInfo failingPubGet = FakeProcessInfo(
|
||||
MockProcess(
|
||||
exitCode: 1,
|
||||
stderr: 'So, because foo depends on both thing_one ^1.0.0 and '
|
||||
'thing_two from path, version solving failed.'),
|
||||
<String>['pub', 'get']);
|
||||
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
|
||||
failingPubGet,
|
||||
// The command re-runs failures when --skip-if-resolver-fails is passed
|
||||
// to check the output, so provide the same failing outcome.
|
||||
failingPubGet,
|
||||
];
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['analyze', '--skip-if-resolving-fails']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Skipping package due to pub resolution failure.'),
|
||||
]),
|
||||
);
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall('flutter', const <String>['pub', 'get'], plugin.path),
|
||||
ProcessCall('flutter', const <String>['pub', 'get'], plugin.path),
|
||||
]));
|
||||
});
|
||||
|
||||
test('fails if "pub get" fails', () async {
|
||||
createFakePlugin('foo', packagesDir);
|
||||
|
||||
|
Reference in New Issue
Block a user