in frontend_server_common/lib/src/frontend_server_client.dart [492:559]
Future<CompilerOutput> _compile(
String scriptUri, String outputFilePath, String packagesFilePath) async {
var frontendServer = frontendServerExecutable;
var args = <String>[
frontendServer,
'--sdk-root',
sdkRoot,
'--incremental',
'--target=dartdevc',
'-Ddart.developer.causal_async_stacks=true',
'--output-dill',
outputFilePath,
if (packagesFilePath != null) ...<String>[
'--packages',
packagesFilePath,
] else if (packagesPath != null) ...<String>[
'--packages',
packagesPath,
],
if (fileSystemRoots != null)
for (final String root in fileSystemRoots) ...<String>[
'--filesystem-root',
root,
],
if (fileSystemScheme != null) ...<String>[
'--filesystem-scheme',
fileSystemScheme,
],
if (platformDill != null) ...<String>[
'--platform',
platformDill,
],
'--debugger-module-names',
'--experimental-emit-debug-metadata',
if (verbose) '--verbose'
];
_logger.info(args.join(' '));
_server = await Process.start(Platform.resolvedExecutable, args,
workingDirectory: packagesPath);
_server.stdout
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen(_stdoutHandler.handler, onDone: () {
// when outputFilename future is not completed, but stdout is closed
// process has died unexpectedly.
if (!_stdoutHandler.compilerOutput.isCompleted) {
_stdoutHandler.compilerOutput.complete(null);
throw Exception('the Dart compiler exited unexpectedly.');
}
});
_server.stderr
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen(_logger.info);
unawaited(_server.exitCode.then((int code) {
if (code != 0) {
throw Exception('the Dart compiler exited unexpectedly.');
}
}));
_server.stdin.writeln('compile $scriptUri');
_logger.info('<- compile $scriptUri');
return _stdoutHandler.compilerOutput.future;
}