Unverified Commit cfda7a65 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Make sure `flutter update-packages --verify-only` has a non-zero exit code (#15962)

* make sure --verify-only logs error messages and fix typo

* ensure non zero exit code

* undo random pubspec change
parent b4274ef6
......@@ -101,6 +101,7 @@ class UpdatePackagesCommand extends FlutterCommand {
final bool isVerifyOnly = argResults['verify-only'];
if (isVerifyOnly) {
bool needsUpdate = false;
printStatus('Verifying pubspecs...');
for (Directory directory in packages) {
final PubspecYaml pubspec = new PubspecYaml(directory);
......@@ -126,15 +127,23 @@ class UpdatePackagesCommand extends FlutterCommand {
if (checksum != pubspec.checksum.value) {
// If the checksum doesn't match, they may have added or removed some dependencies.
// we need to run update-packages to recapture the transitive deps.
printStatus(
printError(
'Warning: pubspec in ${directory.path} has invalid dependencies. '
'Please run "flutter update-packages" --force-upgrade to update them correctly.'
'Please run "flutter update-packages --force-upgrade" to update them correctly.'
);
needsUpdate = true;
} else {
// everything is correct in the pubspec.
printStatus('pubspec in ${directory.path} is up to date!');
}
}
if (needsUpdate) {
throwToolExit(
'Warning: one or more pubspecs have invalid dependencies. '
'Please run "flutter update-packages --force-upgrade" to update them correctly.',
exitCode: 1,
);
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment