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