Commit d3d9e1ca authored by Devon Carew's avatar Devon Carew Committed by GitHub

use less granular progress (#6130)

* use less granular progress

* update restart text
parent 6cdab85d
......@@ -8,7 +8,6 @@ import 'dart:io';
import 'package:path/path.dart' as path;
import 'base/logger.dart';
import 'build_info.dart';
import 'dart/package_map.dart';
import 'asset.dart';
......@@ -307,15 +306,13 @@ class DevFS {
Set<String> fileFilter}) async {
_reset();
printTrace('DevFS: Starting sync from $rootDirectory');
Status status;
status = logger.startProgress('Scanning project files...');
logger.printTrace('Scanning project files');
Directory directory = rootDirectory;
await _scanDirectory(directory,
recursive: true,
fileFilter: fileFilter);
status.stop(showElapsedTime: true);
status = logger.startProgress('Scanning package files...');
printTrace('Scanning package files');
String packagesFilePath = path.join(rootDirectory.path, kPackagesFileName);
StringBuffer sb;
if (FileSystemEntity.isFileSync(packagesFilePath)) {
......@@ -346,9 +343,8 @@ class DevFS {
}
}
}
status.stop(showElapsedTime: true);
if (bundle != null) {
status = logger.startProgress('Scanning asset files...');
printTrace('Scanning asset files');
// Synchronize asset bundle.
for (AssetBundleEntry entry in bundle.entries) {
// We write the assets into the AssetBundle working dir so that they
......@@ -357,10 +353,9 @@ class DevFS {
path.join(getAssetBuildDirectory(), entry.archivePath);
_scanBundleEntry(devicePath, entry, bundleDirty);
}
status.stop(showElapsedTime: true);
}
// Handle deletions.
status = logger.startProgress('Scanning for deleted files...');
printTrace('Scanning for deleted files');
final List<String> toRemove = new List<String>();
_entries.forEach((String path, DevFSEntry entry) {
if (!entry._exists) {
......@@ -371,10 +366,9 @@ class DevFS {
for (int i = 0; i < toRemove.length; i++) {
_entries.remove(toRemove[i]);
}
status.stop(showElapsedTime: true);
if (_deletedEntries.length > 0) {
status = logger.startProgress('Removing deleted files...');
printTrace('Removing deleted files');
for (DevFSEntry entry in _deletedEntries) {
Future<Map<String, dynamic>> operation =
_operations.deleteFile(fsName, entry);
......@@ -384,13 +378,10 @@ class DevFS {
await Future.wait(_pendingOperations);
_pendingOperations.clear();
_deletedEntries.clear();
status.stop(showElapsedTime: true);
} else {
printStatus("No files to remove.");
}
if (_dirtyEntries.length > 0) {
status = logger.startProgress('Updating files...');
printTrace('Updating files');
if (_httpWriter != null) {
try {
await _httpWriter.write(_dirtyEntries,
......@@ -418,9 +409,6 @@ class DevFS {
_pendingOperations.clear();
}
_dirtyEntries.clear();
status.stop(showElapsedTime: true);
} else {
printStatus("No files to update.");
}
if (sb != null)
......
......@@ -18,12 +18,12 @@ import 'cache.dart';
import 'commands/build_apk.dart';
import 'commands/install.dart';
import 'dart/package_map.dart';
import 'devfs.dart';
import 'device.dart';
import 'globals.dart';
import 'devfs.dart';
import 'vmservice.dart';
import 'resident_runner.dart';
import 'toolchain.dart';
import 'vmservice.dart';
const bool kHotReloadDefault = true;
......@@ -272,7 +272,7 @@ class HotRunner extends ResidentRunner {
}
await vmService.vm.refreshViews();
printStatus('Connected to view \'${vmService.vm.mainView}\'.');
printStatus('Connected to ${vmService.vm.mainView}.');
printStatus('Running ${getDisplayPath(_mainPath)} on ${device.name}...');
_loaderShowMessage('Launching...');
......@@ -284,7 +284,7 @@ class HotRunner extends ResidentRunner {
registerSignalHandlers();
printStatus('Finishing file synchronization...');
printTrace('Finishing file synchronization');
// Finish the file sync now.
await _updateDevFS();
......@@ -347,13 +347,12 @@ class HotRunner extends ResidentRunner {
}
Future<bool> _updateDevFS({ DevFSProgressReporter progressReporter }) async {
Status devFSStatus = logger.startProgress('Syncing files to device...');
final bool rebuildBundle = bundle.needsBuild();
if (rebuildBundle) {
Status bundleStatus = logger.startProgress('Updating assets...');
printTrace('Updating assets');
await bundle.build();
bundleStatus.stop(showElapsedTime: true);
}
Status devFSStatus = logger.startProgress('Syncing files to device...');
await _devFS.update(progressReporter: progressReporter,
bundle: bundle,
bundleDirty: rebuildBundle,
......@@ -426,8 +425,8 @@ class HotRunner extends ResidentRunner {
}
restartStatus.stop(showElapsedTime: true);
if (waitForFrame) {
printStatus('Restart time: '
'${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}');
printStatus('Restart performed in '
'${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}.');
if (benchmarkMode) {
benchmarkData['hotRestartMillisecondsToFrame'] =
firstFrameTimer.elapsed.inMilliseconds;
......@@ -495,17 +494,14 @@ class HotRunner extends ResidentRunner {
return false;
}
await _evictDirtyAssets();
Status reassembleStatus =
logger.startProgress('Reassembling application...');
printTrace('Reassembling application');
bool waitForFrame = true;
try {
waitForFrame = (await currentView.uiIsolate.flutterReassemble() != null);
} catch (_) {
reassembleStatus.stop(showElapsedTime: true);
printError('Reassembling application failed.');
return false;
}
reassembleStatus.stop(showElapsedTime: true);
try {
/* ensure that a frame is scheduled */
await currentView.uiIsolate.uiWindowScheduleFrame();
......@@ -516,8 +512,8 @@ class HotRunner extends ResidentRunner {
// When the framework is present, we can wait for the first frame
// event and measure reload itme.
await firstFrameTimer.firstFrame();
printStatus('Hot reload time: '
'${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}');
printStatus('Hot reload performed in '
'${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}.');
if (benchmarkMode) {
benchmarkData['hotReloadMillisecondsToFrame'] =
firstFrameTimer.elapsed.inMilliseconds;
......
......@@ -202,7 +202,7 @@ class RunAndStayResident extends ResidentRunner {
if (vmService != null) {
await vmService.vm.refreshViews();
printStatus('Connected to view \'${vmService.vm.mainView}\'.');
printStatus('Connected to ${vmService.vm.mainView}\.');
}
if (vmService != null && traceStartup) {
......
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