mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix flutter test --preview-dart-2
following last dart roll. (#15233)
* Fix `flutter test --preview-dart-2` following last dart roll. Incremental compiler maintains single incremental dill file, so for every test compilation that dill file has to be copied away for execution. * Fix lints
This commit is contained in:
parent
9c38d6bb35
commit
c01cad3491
@ -107,6 +107,14 @@ class _FlutterPlatform extends PlatformPlugin {
|
|||||||
this.port,
|
this.port,
|
||||||
this.dillFilePath,
|
this.dillFilePath,
|
||||||
}) : assert(shellPath != null) {
|
}) : assert(shellPath != null) {
|
||||||
|
|
||||||
|
// Compiler maintains and updates single incremental dill file.
|
||||||
|
// Incremental compilation requests done for each test copy that file away
|
||||||
|
// for independent execution.
|
||||||
|
final Directory outputDillDirectory = fs.systemTempDirectory
|
||||||
|
.createTempSync('output_dill');
|
||||||
|
final File outputDill = outputDillDirectory.childFile('output.dill');
|
||||||
|
|
||||||
compilerController.stream.listen((CompilationRequest request) async {
|
compilerController.stream.listen((CompilationRequest request) async {
|
||||||
final bool isEmpty = compilationQueue.isEmpty;
|
final bool isEmpty = compilationQueue.isEmpty;
|
||||||
compilationQueue.add(request);
|
compilationQueue.add(request);
|
||||||
@ -118,9 +126,11 @@ class _FlutterPlatform extends PlatformPlugin {
|
|||||||
final CompilationRequest request = compilationQueue.first;
|
final CompilationRequest request = compilationQueue.first;
|
||||||
printTrace('Compiling ${request.path}');
|
printTrace('Compiling ${request.path}');
|
||||||
final String outputPath = await compiler.recompile(request.path,
|
final String outputPath = await compiler.recompile(request.path,
|
||||||
<String>[request.path]
|
<String>[request.path],
|
||||||
|
outputPath: outputDill.path
|
||||||
);
|
);
|
||||||
print('Finished compilation of ${request.path} into $outputPath');
|
// Copy output dill next to the source file.
|
||||||
|
await outputDill.copy(request.path + '.dill');
|
||||||
compiler.accept();
|
compiler.accept();
|
||||||
compiler.reset();
|
compiler.reset();
|
||||||
request.result.complete(outputPath);
|
request.result.complete(outputPath);
|
||||||
@ -128,6 +138,8 @@ class _FlutterPlatform extends PlatformPlugin {
|
|||||||
compilationQueue.removeAt(0);
|
compilationQueue.removeAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, onDone: () {
|
||||||
|
outputDillDirectory.delete(recursive: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user