Reland 9534082fc0 with fix for incremen… (#14040)
* Reland 9534082fc0 with fix for incremental compilation.
When in incremental mode, awaiting exitCode won't work because compiler is not expected to exit after compilation.
Instead listen for stdout stream closing and report error if outputFilename has not been received.
* Fix lints
This commit is contained in:
committed by
GitHub
parent
bedf987fc8
commit
e2e3c5df05
@@ -342,6 +342,10 @@ Future<String> _buildAotSnapshot(
|
||||
aot : true,
|
||||
strongMode: strongMode,
|
||||
);
|
||||
if (mainPath == null) {
|
||||
printError('Compiler terminated unexpectedly.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
genSnapshotCmd.add(mainPath);
|
||||
|
||||
@@ -110,8 +110,8 @@ Future<String> compile(
|
||||
.transform(UTF8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.listen(stdoutHandler.handler);
|
||||
await server.exitCode;
|
||||
return stdoutHandler.outputFilename.future;
|
||||
final int exitCode = await server.exitCode;
|
||||
return exitCode == 0 ? stdoutHandler.outputFilename.future : null;
|
||||
}
|
||||
|
||||
/// Wrapper around incremental frontend server compiler, that communicates with
|
||||
@@ -173,7 +173,16 @@ class ResidentCompiler {
|
||||
_server.stdout
|
||||
.transform(UTF8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.listen(stdoutHandler.handler);
|
||||
.listen(
|
||||
stdoutHandler.handler,
|
||||
onDone: () {
|
||||
// when outputFilename future is not completed, but stdout is closed
|
||||
// process has died unexpectedly.
|
||||
if (!stdoutHandler.outputFilename.isCompleted) {
|
||||
stdoutHandler.outputFilename.complete(null);
|
||||
}
|
||||
});
|
||||
|
||||
_server.stderr
|
||||
.transform(UTF8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
|
||||
@@ -76,6 +76,9 @@ Future<Null> build({
|
||||
mainPath: fs.file(mainPath).absolute.path,
|
||||
strongMode: strongMode
|
||||
);
|
||||
if (kernelBinaryFilename == null) {
|
||||
throwToolExit('Compiler terminated unexpectedly on $mainPath');
|
||||
}
|
||||
kernelContent = new DevFSFileContent(fs.file(kernelBinaryFilename));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user