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.
This commit is contained in:
Danny Tuppeny
2018-06-04 12:04:45 +01:00
committed by GitHub
parent 4cd5870ece
commit f833c43e6e
2 changed files with 8 additions and 3 deletions

View File

@@ -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,

View File

@@ -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();
}