From 0e4770e8099b146dcd6c7700479303f1e159e61c Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 7 Jun 2018 18:27:08 -0700 Subject: [PATCH] Count kernel bytes in bytes synced by DevFS.update (#18288) DevFS.update() returns the number of bytes synced from the host to the target device. When running in Dart 2 mode, ensure that the size of the kernel file is included in the count of bytes synced. --- packages/flutter_tools/lib/src/devfs.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index dc401b8f92..dce136c2a0 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -397,7 +397,9 @@ class DevFS { printTrace('DevFS: Deleted filesystem on the device ($_baseUri)'); } - /// Update files on the device and return the number of bytes sync'd + /// Updates files on the device. + /// + /// Returns the number of bytes synced. Future update({ String mainPath, String target, @@ -511,12 +513,13 @@ class DevFS { final String entryUri = projectRootPath != null ? fs.path.relative(mainPath, from: projectRootPath): mainPath; - dirtyEntries.putIfAbsent( - fs.path.toUri(entryUri + '.dill'), - () => new DevFSFileContent(fs.file(compiledBinary)) - ); + final Uri kernelUri = fs.path.toUri(entryUri + '.dill'); + if (!dirtyEntries.containsKey(kernelUri)) { + final DevFSFileContent content = new DevFSFileContent(fs.file(compiledBinary)); + dirtyEntries[kernelUri] = content; + numBytes += content.size; + } } - } if (dirtyEntries.isNotEmpty) { printTrace('Updating files');