mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Make kernel compiler stdoutHandler private (#18283)
Thie field is never used outside of the class and has a private type, making it impossible to subclass/mock.
This commit is contained in:
parent
d803f02d4f
commit
3c25817bc7
@ -166,7 +166,7 @@ class KernelCompiler {
|
|||||||
printError('Failed to start frontend server $error, $stack');
|
printError('Failed to start frontend server $error, $stack');
|
||||||
});
|
});
|
||||||
|
|
||||||
final _StdoutHandler stdoutHandler = new _StdoutHandler();
|
final _StdoutHandler _stdoutHandler = new _StdoutHandler();
|
||||||
|
|
||||||
server.stderr
|
server.stderr
|
||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
@ -174,13 +174,13 @@ class KernelCompiler {
|
|||||||
server.stdout
|
server.stdout
|
||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
.transform(const LineSplitter())
|
.transform(const LineSplitter())
|
||||||
.listen(stdoutHandler.handler);
|
.listen(_stdoutHandler.handler);
|
||||||
final int exitCode = await server.exitCode;
|
final int exitCode = await server.exitCode;
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
if (fingerprinter != null) {
|
if (fingerprinter != null) {
|
||||||
await fingerprinter.writeFingerprint();
|
await fingerprinter.writeFingerprint();
|
||||||
}
|
}
|
||||||
return stdoutHandler.compilerOutput.future;
|
return _stdoutHandler.compilerOutput.future;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ class ResidentCompiler {
|
|||||||
_packagesPath = packagesPath,
|
_packagesPath = packagesPath,
|
||||||
_fileSystemRoots = fileSystemRoots,
|
_fileSystemRoots = fileSystemRoots,
|
||||||
_fileSystemScheme = fileSystemScheme,
|
_fileSystemScheme = fileSystemScheme,
|
||||||
stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer) {
|
_stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer) {
|
||||||
// This is a URI, not a file path, so the forward slash is correct even on Windows.
|
// This is a URI, not a file path, so the forward slash is correct even on Windows.
|
||||||
if (!_sdkRoot.endsWith('/'))
|
if (!_sdkRoot.endsWith('/'))
|
||||||
_sdkRoot = '$_sdkRoot/';
|
_sdkRoot = '$_sdkRoot/';
|
||||||
@ -212,7 +212,7 @@ class ResidentCompiler {
|
|||||||
final String _fileSystemScheme;
|
final String _fileSystemScheme;
|
||||||
String _sdkRoot;
|
String _sdkRoot;
|
||||||
Process _server;
|
Process _server;
|
||||||
final _StdoutHandler stdoutHandler;
|
final _StdoutHandler _stdoutHandler;
|
||||||
|
|
||||||
/// If invoked for the first time, it compiles Dart script identified by
|
/// If invoked for the first time, it compiles Dart script identified by
|
||||||
/// [mainPath], [invalidatedFiles] list is ignored.
|
/// [mainPath], [invalidatedFiles] list is ignored.
|
||||||
@ -223,7 +223,7 @@ class ResidentCompiler {
|
|||||||
/// null is returned.
|
/// null is returned.
|
||||||
Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles,
|
Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles,
|
||||||
{String outputPath, String packagesFilePath}) async {
|
{String outputPath, String packagesFilePath}) async {
|
||||||
stdoutHandler.reset();
|
_stdoutHandler.reset();
|
||||||
|
|
||||||
// First time recompile is called we actually have to compile the app from
|
// First time recompile is called we actually have to compile the app from
|
||||||
// scratch ignoring list of invalidated files.
|
// scratch ignoring list of invalidated files.
|
||||||
@ -237,7 +237,7 @@ class ResidentCompiler {
|
|||||||
}
|
}
|
||||||
_server.stdin.writeln(inputKey);
|
_server.stdin.writeln(inputKey);
|
||||||
|
|
||||||
return stdoutHandler.compilerOutput.future;
|
return _stdoutHandler.compilerOutput.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<CompilerOutput> _compile(String scriptFilename, String outputPath,
|
Future<CompilerOutput> _compile(String scriptFilename, String outputPath,
|
||||||
@ -280,12 +280,12 @@ class ResidentCompiler {
|
|||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
.transform(const LineSplitter())
|
.transform(const LineSplitter())
|
||||||
.listen(
|
.listen(
|
||||||
stdoutHandler.handler,
|
_stdoutHandler.handler,
|
||||||
onDone: () {
|
onDone: () {
|
||||||
// when outputFilename future is not completed, but stdout is closed
|
// when outputFilename future is not completed, but stdout is closed
|
||||||
// process has died unexpectedly.
|
// process has died unexpectedly.
|
||||||
if (!stdoutHandler.compilerOutput.isCompleted) {
|
if (!_stdoutHandler.compilerOutput.isCompleted) {
|
||||||
stdoutHandler.compilerOutput.complete(null);
|
_stdoutHandler.compilerOutput.complete(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -296,12 +296,12 @@ class ResidentCompiler {
|
|||||||
|
|
||||||
_server.stdin.writeln('compile $scriptFilename');
|
_server.stdin.writeln('compile $scriptFilename');
|
||||||
|
|
||||||
return stdoutHandler.compilerOutput.future;
|
return _stdoutHandler.compilerOutput.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<CompilerOutput> compileExpression(String expression, List<String> definitions,
|
Future<CompilerOutput> compileExpression(String expression, List<String> definitions,
|
||||||
List<String> typeDefinitions, String libraryUri, String klass, bool isStatic) {
|
List<String> typeDefinitions, String libraryUri, String klass, bool isStatic) {
|
||||||
stdoutHandler.reset();
|
_stdoutHandler.reset();
|
||||||
|
|
||||||
// 'compile-expression' should be invoked after compiler has been started,
|
// 'compile-expression' should be invoked after compiler has been started,
|
||||||
// program was compiled.
|
// program was compiled.
|
||||||
@ -319,7 +319,7 @@ class ResidentCompiler {
|
|||||||
_server.stdin.writeln(klass ?? '');
|
_server.stdin.writeln(klass ?? '');
|
||||||
_server.stdin.writeln(isStatic ?? false);
|
_server.stdin.writeln(isStatic ?? false);
|
||||||
|
|
||||||
return stdoutHandler.compilerOutput.future;
|
return _stdoutHandler.compilerOutput.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Should be invoked when results of compilation are accepted by the client.
|
/// Should be invoked when results of compilation are accepted by the client.
|
||||||
|
Loading…
Reference in New Issue
Block a user