forked from firka/flutter
[flutter_tools] Add --verify-only flag to flutter upgrade (#68866)
* Add --verify-only flag for flutter upgrade
This commit is contained in:
@@ -38,6 +38,11 @@ class UpgradeCommand extends FlutterCommand {
|
||||
'working-directory',
|
||||
hide: true,
|
||||
help: 'Override the upgrade working directory for integration testing.'
|
||||
)
|
||||
..addFlag(
|
||||
'verify-only',
|
||||
help: 'Verifies for any new flutter update, without fetching the update.',
|
||||
negatable: false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,6 +68,7 @@ class UpgradeCommand extends FlutterCommand {
|
||||
flutterVersion: stringArg('working-directory') == null
|
||||
? globals.flutterVersion
|
||||
: FlutterVersion(const SystemClock(), _commandRunner.workingDirectory),
|
||||
verifyOnly: boolArg('verify-only'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -78,6 +84,7 @@ class UpgradeCommandRunner {
|
||||
@required bool testFlow,
|
||||
@required GitTagVersion gitTagVersion,
|
||||
@required FlutterVersion flutterVersion,
|
||||
@required bool verifyOnly,
|
||||
}) async {
|
||||
if (!continueFlow) {
|
||||
await runCommandFirstHalf(
|
||||
@@ -85,6 +92,7 @@ class UpgradeCommandRunner {
|
||||
gitTagVersion: gitTagVersion,
|
||||
flutterVersion: flutterVersion,
|
||||
testFlow: testFlow,
|
||||
verifyOnly: verifyOnly,
|
||||
);
|
||||
} else {
|
||||
await runCommandSecondHalf(flutterVersion);
|
||||
@@ -97,12 +105,24 @@ class UpgradeCommandRunner {
|
||||
@required GitTagVersion gitTagVersion,
|
||||
@required FlutterVersion flutterVersion,
|
||||
@required bool testFlow,
|
||||
@required bool verifyOnly,
|
||||
}) async {
|
||||
final String upstreamRevision = await fetchRemoteRevision();
|
||||
if (flutterVersion.frameworkRevision == upstreamRevision) {
|
||||
globals.printStatus('Flutter is already up to date on channel ${flutterVersion.channel}');
|
||||
globals.printStatus('$flutterVersion');
|
||||
return;
|
||||
} else if (verifyOnly) {
|
||||
globals.printStatus('A new version of Flutter is available on channel ${flutterVersion.channel}\n');
|
||||
// TODO(fujino): use a [FlutterVersion] once that class supports arbitrary revisions.
|
||||
globals.printStatus('The latest revision: $upstreamRevision', emphasis: true);
|
||||
globals.printStatus('Your current version: ${flutterVersion.frameworkRevision}\n');
|
||||
globals.printStatus('To upgrade now, run "flutter upgrade".');
|
||||
if (flutterVersion.channel == 'stable') {
|
||||
globals.printStatus('\nSee the announcement and release notes:');
|
||||
globals.printStatus('https://flutter.dev/docs/development/tools/sdk/release-notes');
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!force && gitTagVersion == const GitTagVersion.unknown()) {
|
||||
// If the commit is a recognized branch and not master,
|
||||
|
||||
Reference in New Issue
Block a user