Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[flutter_tools] always initialize the resident runner from dill #58607

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions packages/flutter_tools/lib/src/resident_runner.dart
Expand Up @@ -74,12 +74,6 @@ 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),
Expand All @@ -89,7 +83,6 @@ class FlutterDevice {
// Override the filesystem scheme so that the frontend_server can find
// the generated entrypoint code.
fileSystemScheme: 'org-dartlang-app',
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'),
targetModel: TargetModel.dartdevc,
experimentalFlags: experimentalFlags,
platformDill: globals.fs.file(globals.artifacts
Expand All @@ -113,7 +106,6 @@ class FlutterDevice {
targetModel: targetModel,
experimentalFlags: experimentalFlags,
dartDefines: buildInfo.dartDefines,
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'),
);
}

Expand Down Expand Up @@ -642,6 +634,7 @@ 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;
Expand Down Expand Up @@ -1029,11 +1022,6 @@ 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 = artifactDirectory.childFile('app.dill');
if (outputDill.existsSync()) {
artifactDirectory.childFile('app.dill')
.copySync(globals.fs.path.join(getBuildDirectory(), 'cache.dill'));
}
artifactDirectory.deleteSync(recursive: true);
}
}
Expand Down
Expand Up @@ -5,7 +5,6 @@
import 'dart:async';

import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/command_help.dart';
import 'package:flutter_tools/src/base/common.dart';
Expand Down Expand Up @@ -358,22 +357,6 @@ void main() {
expect(otherRunner.artifactDirectory.path, contains('foobar'));
}));

test('ResidentRunner copies output dill to cache location during preExit', () => testbed.run(() async {
residentRunner.artifactDirectory.childFile('app.dill').writeAsStringSync('hello');
await residentRunner.preExit();
final File cacheDill = globals.fs.file(globals.fs.path.join(getBuildDirectory(), 'cache.dill'));

expect(cacheDill, exists);
expect(cacheDill.readAsStringSync(), 'hello');
}));

test('ResidentRunner handles output dill missing during preExit', () => testbed.run(() async {
await residentRunner.preExit();
final File cacheDill = globals.fs.file(globals.fs.path.join(getBuildDirectory(), 'cache.dill'));

expect(cacheDill, isNot(exists));
}));

test('ResidentRunner printHelpDetails', () => testbed.run(() {
when(mockDevice.supportsHotRestart).thenReturn(true);
when(mockDevice.supportsScreenshot).thenReturn(true);
Expand Down Expand Up @@ -715,8 +698,6 @@ void main() {
target: null,
)).generator as DefaultResidentCompiler;

expect(residentCompiler.initializeFromDill,
globals.fs.path.join(getBuildDirectory(), 'cache.dill'));
expect(residentCompiler.librariesSpec,
globals.fs.file(globals.artifacts.getArtifactPath(Artifact.flutterWebLibrariesJson))
.uri.toString());
Expand Down