mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[kernel/flutter] Improve speed of first hot reload
This commit is contained in:
parent
a96487929b
commit
f3dc133878
@ -50,6 +50,8 @@ class AssetBundle {
|
||||
}
|
||||
}
|
||||
|
||||
bool wasBuildOnce() => _lastBuildTimestamp != null;
|
||||
|
||||
bool needsBuild({String manifestPath: defaultManifestPath}) {
|
||||
if (_fixed)
|
||||
return false;
|
||||
|
@ -383,6 +383,7 @@ class DevFS {
|
||||
String mainPath,
|
||||
String target,
|
||||
AssetBundle bundle,
|
||||
bool bundleFirstUpload: false,
|
||||
bool bundleDirty: false,
|
||||
Set<String> fileFilter,
|
||||
ResidentCompiler generator,
|
||||
@ -445,10 +446,10 @@ class DevFS {
|
||||
// that isModified does not reset last check timestamp because we
|
||||
// want to report all modified files to incremental compiler next time
|
||||
// user does hot reload.
|
||||
if (content.isModified || (bundleDirty && archivePath != null)) {
|
||||
if (content.isModified || ((bundleDirty || bundleFirstUpload) && archivePath != null)) {
|
||||
dirtyEntries[deviceUri] = content;
|
||||
numBytes += content.size;
|
||||
if (archivePath != null)
|
||||
if (archivePath != null && !bundleFirstUpload)
|
||||
assetPathsToEvict.add(archivePath);
|
||||
}
|
||||
});
|
||||
|
@ -350,6 +350,7 @@ class FlutterDevice {
|
||||
String mainPath,
|
||||
String target,
|
||||
AssetBundle bundle,
|
||||
bool bundleFirstUpload: false,
|
||||
bool bundleDirty: false,
|
||||
Set<String> fileFilter,
|
||||
bool fullRestart: false
|
||||
@ -364,6 +365,7 @@ class FlutterDevice {
|
||||
mainPath: mainPath,
|
||||
target: target,
|
||||
bundle: bundle,
|
||||
bundleFirstUpload: bundleFirstUpload,
|
||||
bundleDirty: bundleDirty,
|
||||
fileFilter: fileFilter,
|
||||
generator: generator,
|
||||
|
@ -260,6 +260,7 @@ class HotRunner extends ResidentRunner {
|
||||
// Did not update DevFS because of a Dart source error.
|
||||
return false;
|
||||
}
|
||||
final bool isFirstUpload = assetBundle.wasBuildOnce() == false;
|
||||
final bool rebuildBundle = assetBundle.needsBuild();
|
||||
if (rebuildBundle) {
|
||||
printTrace('Updating assets');
|
||||
@ -273,7 +274,8 @@ class HotRunner extends ResidentRunner {
|
||||
mainPath: mainPath,
|
||||
target: target,
|
||||
bundle: assetBundle,
|
||||
bundleDirty: rebuildBundle,
|
||||
bundleFirstUpload: isFirstUpload,
|
||||
bundleDirty: isFirstUpload == false && rebuildBundle,
|
||||
fileFilter: _dartDependencies,
|
||||
fullRestart: fullRestart
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user