Unverified Commit 1fec30ef authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Place existing dill into hot reload temp directory to boost initialization time (#40366)

parent a6138bb0
......@@ -530,6 +530,16 @@ abstract class ResidentRunner {
if (!artifactDirectory.existsSync()) {
artifactDirectory.createSync(recursive: true);
}
// TODO(jonahwilliams): this is a temporary work around to regain some of
// the initialize from dill performance. Longer term, we should have a
// better way to determine where the appropriate dill file is, as this
// doesn't work for Android or macOS builds.}
if (dillOutputPath == null) {
final File existingDill = fs.file(fs.path.join('build', 'app.dill'));
if (existingDill.existsSync()) {
existingDill.copySync(fs.path.join(artifactDirectory.path, 'app.dill'));
}
}
}
@protected
......
......@@ -35,6 +35,9 @@ void main() {
setUp(() {
testbed = Testbed(setup: () {
fs.file(fs.path.join('build', 'app.dill'))
..createSync(recursive: true)
..writeAsStringSync('ABC');
residentRunner = HotRunner(
<FlutterDevice>[
mockFlutterDevice,
......@@ -193,6 +196,10 @@ void main() {
Usage: () => MockUsage(),
}));
test('ResidentRunner copies dill file from build output into temp directory', () => testbed.run(() async {
expect(residentRunner.artifactDirectory.childFile('app.dill').readAsStringSync(), 'ABC');
}));
test('ResidentRunner can send target platform to analytics from hot reload', () => testbed.run(() async {
when(mockDevice.sdkNameAndVersion).thenAnswer((Invocation invocation) async {
return 'Example';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment