From c05da1e29dcfa79c8b97638bddf5ec6ee7b8fccb Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Thu, 19 Oct 2017 07:16:15 -0700 Subject: [PATCH] Stop syncing dart source files when in --preview-dart-2. (#12597) Syncing source files is not needed when host sends kernel file to the device. --- packages/flutter_tools/lib/src/devfs.dart | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 5bbba64b9a3..49dfe45aa4e 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -465,9 +465,21 @@ class DevFS { // Incremental run with no changes is supposed to be fast (considering // that it is initiated by user key press). final List invalidatedFiles = []; - for (DevFSContent content in dirtyEntries.values) - if (content is DevFSFileContent) - invalidatedFiles.add(content.file.uri.toString()); + final Set filesUris = new Set(); + for (Uri uri in dirtyEntries.keys) { + if (!uri.path.startsWith(assetBuildDirPrefix)) { + final DevFSContent content = dirtyEntries[uri]; + if (content is DevFSFileContent) { + filesUris.add(uri); + invalidatedFiles.add(content.file.uri.toString()); + numBytes -= content.size; + } + } + } + // No need to send source files because all compilation is done on the + // host and result of compilation is single kernel file. + for (Uri fileUri in filesUris) + dirtyEntries.remove(fileUri); printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files'); final String compiledBinary = fullRestart ? await compile(