@@ -23,6 +23,7 @@ import 'base/utils.dart';
23
23
import 'build_info.dart' ;
24
24
import 'build_system/build_system.dart' ;
25
25
import 'build_system/targets/localizations.dart' ;
26
+ import 'bundle.dart' ;
26
27
import 'cache.dart' ;
27
28
import 'codegen.dart' ;
28
29
import 'compile.dart' ;
@@ -83,6 +84,12 @@ class FlutterDevice {
83
84
if (device.platformType == PlatformType .fuchsia) {
84
85
targetModel = TargetModel .flutterRunner;
85
86
}
87
+ // For both web and non-web platforms we initialize dill to/from
88
+ // a shared location for faster bootstrapping. If the compiler fails
89
+ // due to a kernel target or version mismatch, no error is reported
90
+ // and the compiler starts up as normal. Unexpected errors will print
91
+ // a warning message and dump some debug information which can be
92
+ // used to file a bug, but the compiler will still start up correctly.
86
93
if (targetPlatform == TargetPlatform .web_javascript) {
87
94
generator = ResidentCompiler (
88
95
globals.artifacts.getArtifactPath (Artifact .flutterWebSdk, mode: buildInfo.mode),
@@ -95,6 +102,9 @@ class FlutterDevice {
95
102
compilerMessageConsumer:
96
103
(String message, {bool emphasis, TerminalColor color, }) =>
97
104
globals.printTrace (message),
105
+ initializeFromDill: getDefaultCachedKernelPath (
106
+ trackWidgetCreation: buildInfo.trackWidgetCreation,
107
+ ),
98
108
targetModel: TargetModel .dartdevc,
99
109
experimentalFlags: experimentalFlags,
100
110
platformDill: globals.fs.file (globals.artifacts
@@ -119,6 +129,9 @@ class FlutterDevice {
119
129
targetModel: targetModel,
120
130
experimentalFlags: experimentalFlags,
121
131
dartDefines: buildInfo.dartDefines,
132
+ initializeFromDill: getDefaultCachedKernelPath (
133
+ trackWidgetCreation: buildInfo.trackWidgetCreation,
134
+ ),
122
135
packagesPath: globalPackagesPath,
123
136
);
124
137
}
@@ -691,7 +704,6 @@ abstract class ResidentRunner {
691
704
final bool ipv6;
692
705
final String _dillOutputPath;
693
706
/// The parent location of the incremental artifacts.
694
- @visibleForTesting
695
707
final Directory artifactDirectory;
696
708
final String packagesFilePath;
697
709
final String projectRootPath;
@@ -1196,6 +1208,12 @@ abstract class ResidentRunner {
1196
1208
Future <void > preExit () async {
1197
1209
// If _dillOutputPath is null, we created a temporary directory for the dill.
1198
1210
if (_dillOutputPath == null && artifactDirectory.existsSync ()) {
1211
+ final File outputDill = globals.fs.file (dillOutputPath);
1212
+ if (outputDill.existsSync ()) {
1213
+ outputDill.copySync (getDefaultCachedKernelPath (
1214
+ trackWidgetCreation: trackWidgetCreation,
1215
+ ));
1216
+ }
1199
1217
artifactDirectory.deleteSync (recursive: true );
1200
1218
}
1201
1219
}
0 commit comments