mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Place existing dill into hot reload temp directory to boost initialization time (#40366)
This commit is contained in:
parent
a6138bb005
commit
1fec30efb6
@ -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';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user