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 { ...@@ -60,7 +60,7 @@ class UpgradeCommand extends FlutterCommand {
printStatus('Upgrading engine...'); printStatus('Upgrading engine...');
code = await runCommandAndStreamOutput( code = await runCommandAndStreamOutput(
<String>[ <String>[
fs.path.join('bin', 'flutter'), '--no-color', 'precache', fs.path.join('bin', 'flutter'), '--no-color', '--no-version-check', 'precache',
], ],
workingDirectory: Cache.flutterRoot, workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true allowReentrantFlutter: true
...@@ -80,7 +80,7 @@ class UpgradeCommand extends FlutterCommand { ...@@ -80,7 +80,7 @@ class UpgradeCommand extends FlutterCommand {
printStatus('Running flutter doctor...'); printStatus('Running flutter doctor...');
code = await runCommandAndStreamOutput( code = await runCommandAndStreamOutput(
<String>[ <String>[
fs.path.join('bin', 'flutter'), 'doctor', fs.path.join('bin', 'flutter'), '--no-version-check', 'doctor',
], ],
workingDirectory: Cache.flutterRoot, workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true, allowReentrantFlutter: true,
......
...@@ -71,6 +71,11 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -71,6 +71,11 @@ class FlutterCommandRunner extends CommandRunner<Null> {
negatable: true, negatable: true,
hide: !verboseHelp, hide: !verboseHelp,
help: 'Whether to use terminal colors.'); 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', argParser.addFlag('suppress-analytics',
negatable: false, negatable: false,
hide: !verboseHelp, hide: !verboseHelp,
...@@ -280,7 +285,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -280,7 +285,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
_checkFlutterCopy(); _checkFlutterCopy();
await FlutterVersion.instance.ensureVersionFile(); await FlutterVersion.instance.ensureVersionFile();
if (topLevelResults.command?.name != 'upgrade') { if (topLevelResults.command?.name != 'upgrade' && topLevelResults['version-check']) {
await FlutterVersion.instance.checkFlutterVersionFreshness(); 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