Revert "Revert "[flutter_tools] always initialize the resident runner from di…" (#58208)
This commit is contained in:
@@ -23,6 +23,7 @@ import 'base/utils.dart';
|
||||
import 'build_info.dart';
|
||||
import 'build_system/build_system.dart';
|
||||
import 'build_system/targets/localizations.dart';
|
||||
import 'bundle.dart';
|
||||
import 'cache.dart';
|
||||
import 'codegen.dart';
|
||||
import 'compile.dart';
|
||||
@@ -83,6 +84,12 @@ class FlutterDevice {
|
||||
if (device.platformType == PlatformType.fuchsia) {
|
||||
targetModel = TargetModel.flutterRunner;
|
||||
}
|
||||
// For both web and non-web platforms we initialize dill to/from
|
||||
// a shared location for faster bootstrapping. If the compiler fails
|
||||
// due to a kernel target or version mismatch, no error is reported
|
||||
// and the compiler starts up as normal. Unexpected errors will print
|
||||
// a warning message and dump some debug information which can be
|
||||
// used to file a bug, but the compiler will still start up correctly.
|
||||
if (targetPlatform == TargetPlatform.web_javascript) {
|
||||
generator = ResidentCompiler(
|
||||
globals.artifacts.getArtifactPath(Artifact.flutterWebSdk, mode: buildInfo.mode),
|
||||
@@ -95,6 +102,9 @@ class FlutterDevice {
|
||||
compilerMessageConsumer:
|
||||
(String message, {bool emphasis, TerminalColor color, }) =>
|
||||
globals.printTrace(message),
|
||||
initializeFromDill: getDefaultCachedKernelPath(
|
||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||
),
|
||||
targetModel: TargetModel.dartdevc,
|
||||
experimentalFlags: experimentalFlags,
|
||||
platformDill: globals.fs.file(globals.artifacts
|
||||
@@ -119,6 +129,9 @@ class FlutterDevice {
|
||||
targetModel: targetModel,
|
||||
experimentalFlags: experimentalFlags,
|
||||
dartDefines: buildInfo.dartDefines,
|
||||
initializeFromDill: getDefaultCachedKernelPath(
|
||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||
),
|
||||
packagesPath: globalPackagesPath,
|
||||
);
|
||||
}
|
||||
@@ -691,7 +704,6 @@ abstract class ResidentRunner {
|
||||
final bool ipv6;
|
||||
final String _dillOutputPath;
|
||||
/// The parent location of the incremental artifacts.
|
||||
@visibleForTesting
|
||||
final Directory artifactDirectory;
|
||||
final String packagesFilePath;
|
||||
final String projectRootPath;
|
||||
@@ -1196,6 +1208,12 @@ abstract class ResidentRunner {
|
||||
Future<void> preExit() async {
|
||||
// If _dillOutputPath is null, we created a temporary directory for the dill.
|
||||
if (_dillOutputPath == null && artifactDirectory.existsSync()) {
|
||||
final File outputDill = globals.fs.file(dillOutputPath);
|
||||
if (outputDill.existsSync()) {
|
||||
outputDill.copySync(getDefaultCachedKernelPath(
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
));
|
||||
}
|
||||
artifactDirectory.deleteSync(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user