mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #1477 from devoncarew/engine_version
add the engine revision to --version
This commit is contained in:
commit
5af87aaf61
@ -204,7 +204,6 @@ class ArtifactStore {
|
||||
|
||||
static String get engineRevision {
|
||||
if (_engineRevision == null) {
|
||||
ensurePackageRootIsValid();
|
||||
File revisionFile = new File(path.join(packageRoot, 'sky_engine', 'REVISION'));
|
||||
if (revisionFile.existsSync())
|
||||
_engineRevision = revisionFile.readAsStringSync();
|
||||
|
||||
@ -8,6 +8,7 @@ import '../artifacts.dart';
|
||||
import '../base/context.dart';
|
||||
import '../base/process.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
import '../runner/version.dart';
|
||||
|
||||
class UpgradeCommand extends FlutterCommand {
|
||||
final String name = 'upgrade';
|
||||
@ -15,6 +16,8 @@ class UpgradeCommand extends FlutterCommand {
|
||||
|
||||
@override
|
||||
Future<int> runInProject() async {
|
||||
printStatus(getVersion(ArtifactStore.flutterRoot));
|
||||
|
||||
try {
|
||||
runCheckedSync(<String>[
|
||||
'git', 'rev-parse', '@{u}'
|
||||
@ -24,6 +27,9 @@ class UpgradeCommand extends FlutterCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
printStatus('');
|
||||
printStatus('Upgrading Flutter...');
|
||||
|
||||
int code = await runCommandAndStreamOutput(<String>[
|
||||
'git', 'pull', '--ff-only'
|
||||
], workingDirectory: ArtifactStore.flutterRoot);
|
||||
@ -31,6 +37,15 @@ class UpgradeCommand extends FlutterCommand {
|
||||
if (code != 0)
|
||||
return code;
|
||||
|
||||
return await runCommandAndStreamOutput([sdkBinaryName('pub'), 'upgrade']);
|
||||
printStatus('');
|
||||
code = await runCommandAndStreamOutput([sdkBinaryName('pub'), 'upgrade']);
|
||||
|
||||
if (code != 0)
|
||||
return code;
|
||||
|
||||
printStatus('');
|
||||
printStatus(getVersion(ArtifactStore.flutterRoot));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../base/process.dart';
|
||||
|
||||
String getVersion(String flutterRoot) {
|
||||
@ -20,5 +21,12 @@ String getVersion(String flutterRoot) {
|
||||
String revision = runSync([
|
||||
'git', 'log', '-n', '1', '--pretty=format:%H (%ar)'
|
||||
], workingDirectory: flutterRoot).trim();
|
||||
return 'Flutter\nRepository: $repository\nBranch: $upstream\nRevision: $revision';
|
||||
|
||||
String version = 'Flutter from $repository (on $upstream)\nflutter revision: $revision';
|
||||
|
||||
String engineRevision = ArtifactStore.engineRevision;
|
||||
if (engineRevision != null)
|
||||
version += '\nengine revision : $engineRevision';
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user