mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Revert "Improve time to development by initializing frontend_server concurrently with platform build (#45236)" (#45422)
This commit is contained in:
parent
c63c576bca
commit
35b571ccfc
@ -468,6 +468,7 @@ abstract class ResidentCompiler {
|
||||
List<String> dartDefines,
|
||||
}) = DefaultResidentCompiler;
|
||||
|
||||
|
||||
/// If invoked for the first time, it compiles Dart script identified by
|
||||
/// [mainPath], [invalidatedFiles] list is ignored.
|
||||
/// On successive runs [invalidatedFiles] indicates which files need to be
|
||||
|
||||
@ -487,9 +487,6 @@ class DevFS {
|
||||
if (fullRestart) {
|
||||
generator.reset();
|
||||
}
|
||||
// On a full restart, or on an initial compile for the attach based workflow,
|
||||
// this will produce a full dill. Subsequent invocations will produce incremental
|
||||
// dill files that depend on the invalidated files.
|
||||
printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files');
|
||||
final CompilerOutput compilerOutput = await generator.recompile(
|
||||
mainPath,
|
||||
|
||||
@ -18,7 +18,6 @@ import 'base/platform.dart';
|
||||
import 'base/terminal.dart';
|
||||
import 'base/utils.dart';
|
||||
import 'build_info.dart';
|
||||
import 'bundle.dart';
|
||||
import 'compile.dart';
|
||||
import 'convert.dart';
|
||||
import 'devfs.dart';
|
||||
@ -263,31 +262,14 @@ class HotRunner extends ResidentRunner {
|
||||
|
||||
firstBuildTime = DateTime.now();
|
||||
|
||||
final List<Future<bool>> startupTasks = <Future<bool>>[];
|
||||
for (FlutterDevice device in flutterDevices) {
|
||||
// Here we initialize the frontend_server conccurently with the gradle
|
||||
// build, reducing initialization time. This is safe because the first
|
||||
// invocation of the frontend server produces a full dill file that
|
||||
// the subsequent invocation in devfs will not overwrite.
|
||||
if (device.generator != null) {
|
||||
startupTasks.add(
|
||||
device.generator.recompile(
|
||||
mainPath,
|
||||
<Uri>[],
|
||||
outputPath: dillOutputPath ??
|
||||
getDefaultApplicationKernelPath(trackWidgetCreation: device.trackWidgetCreation),
|
||||
packagesFilePath : packagesFilePath,
|
||||
).then((CompilerOutput output) => output?.errorCount == 0)
|
||||
);
|
||||
}
|
||||
startupTasks.add(device.runHot(
|
||||
final int result = await device.runHot(
|
||||
hotRunner: this,
|
||||
route: route,
|
||||
).then((int result) => result == 0));
|
||||
}
|
||||
final List<bool> results = await Future.wait(startupTasks);
|
||||
if (!results.every((bool passed) => passed)) {
|
||||
return 1;
|
||||
);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return attach(
|
||||
|
||||
@ -108,18 +108,13 @@ void main() {
|
||||
});
|
||||
|
||||
test('hot reload doesn\'t reassemble if paused', () async {
|
||||
final Future<void> setup = _flutter.run(withDebugger: true);
|
||||
final Completer<void> sawTick1 = Completer<void>();
|
||||
await _flutter.run(withDebugger: true);
|
||||
final Completer<void> sawTick2 = Completer<void>();
|
||||
final Completer<void> sawTick3 = Completer<void>();
|
||||
final Completer<void> sawDebuggerPausedMessage1 = Completer<void>();
|
||||
final Completer<void> sawDebuggerPausedMessage2 = Completer<void>();
|
||||
final StreamSubscription<String> subscription = _flutter.stdout.listen(
|
||||
(String line) {
|
||||
if (line.contains('((((TICK 1))))')) {
|
||||
expect(sawTick1.isCompleted, isFalse);
|
||||
sawTick1.complete();
|
||||
}
|
||||
if (line.contains('((((TICK 2))))')) {
|
||||
expect(sawTick2.isCompleted, isFalse);
|
||||
sawTick2.complete();
|
||||
@ -134,8 +129,6 @@ void main() {
|
||||
}
|
||||
},
|
||||
);
|
||||
await setup;
|
||||
await sawTick1.future;
|
||||
await _flutter.addBreakpoint(
|
||||
_project.buildBreakpointUri,
|
||||
_project.buildBreakpointLine,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user