Unverified Commit f833c43e authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Skip version checks when running `flutter upgrade` (#18031)

We were already skipping the check in `flutter upgrade` but this also spawns `flutter precache` and `flutter doctor` which would still check and potentially output the message.
parent 4cd5870e
......@@ -60,7 +60,7 @@ class UpgradeCommand extends FlutterCommand {
printStatus('Upgrading engine...');
code = await runCommandAndStreamOutput(
<String>[
fs.path.join('bin', 'flutter'), '--no-color', 'precache',
fs.path.join('bin', 'flutter'), '--no-color', '--no-version-check', 'precache',
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true
......@@ -80,7 +80,7 @@ class UpgradeCommand extends FlutterCommand {
printStatus('Running flutter doctor...');
code = await runCommandAndStreamOutput(
<String>[
fs.path.join('bin', 'flutter'), 'doctor',
fs.path.join('bin', 'flutter'), '--no-version-check', 'doctor',
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true,
......
......@@ -71,6 +71,11 @@ class FlutterCommandRunner extends CommandRunner<Null> {
negatable: true,
hide: !verboseHelp,
help: 'Whether to use terminal colors.');
argParser.addFlag('version-check',
negatable: true,
defaultsTo: true,
hide: !verboseHelp,
help: 'Allow Flutter to check for updates when this command runs.');
argParser.addFlag('suppress-analytics',
negatable: false,
hide: !verboseHelp,
......@@ -280,7 +285,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
_checkFlutterCopy();
await FlutterVersion.instance.ensureVersionFile();
if (topLevelResults.command?.name != 'upgrade') {
if (topLevelResults.command?.name != 'upgrade' && topLevelResults['version-check']) {
await FlutterVersion.instance.checkFlutterVersionFreshness();
}
......
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