Ensure flutter run build is done in incremental mode. (#107184)

* Ensure build is done in incremental mode.

This allows for faster bootstrapping of the compiler from previously created dill file.

Fixes https://github.com/flutter/flutter/issues/107183

* Avoid initializeFromDill in aot mode

* Update tests
This commit is contained in:
Alexander Aprelev 2022-07-07 09:31:18 -07:00 committed by GitHub
parent 043f0f7ea9
commit b1410c2ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -226,6 +226,8 @@ class KernelSnapshot extends Target {
trackWidgetCreation: trackWidgetCreation && buildMode != BuildMode.release,
targetModel: targetModel,
outputFilePath: environment.buildDir.childFile('app.dill').path,
initializeFromDill: buildMode.isPrecompiled ? null :
environment.buildDir.childFile('app.dill').path,
packagesPath: packagesFile.path,
linkPlatformKernelIn: forceLinkPlatform || buildMode.isPrecompiled,
mainPath: targetFileAbsolute,

View File

@ -315,6 +315,7 @@ class KernelCompiler {
fileSystemScheme,
],
if (initializeFromDill != null) ...<String>[
'--incremental',
'--initialize-from-dill',
initializeFromDill,
],

View File

@ -257,6 +257,9 @@ void main() {
'$build/app.dill',
'--depfile',
'$build/kernel_snapshot.d',
'--incremental',
'--initialize-from-dill',
'$build/app.dill',
'--verbosity=error',
'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
@ -295,6 +298,9 @@ void main() {
'$build/app.dill',
'--depfile',
'$build/kernel_snapshot.d',
'--incremental',
'--initialize-from-dill',
'$build/app.dill',
'--verbosity=error',
'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
@ -348,6 +354,9 @@ void main() {
'$build/app.dill',
'--depfile',
'$build/kernel_snapshot.d',
'--incremental',
'--initialize-from-dill',
'$build/app.dill',
'--verbosity=error',
'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey /build/653e11a8e6908714056a57cd6b4f602a/app.dill 0\n'),