Unverified Commit 15082387 authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tool] Include impellerc output in ShaderCompilerException (#108348)

parent 41940c93
......@@ -181,12 +181,16 @@ class ShaderCompiler {
final Process impellercProcess = await _processManager.start(cmd);
final int code = await impellercProcess.exitCode;
if (code != 0) {
_logger.printTrace(await utf8.decodeStream(impellercProcess.stdout));
_logger.printError(await utf8.decodeStream(impellercProcess.stderr));
final String stdout = await utf8.decodeStream(impellercProcess.stdout);
final String stderr = await utf8.decodeStream(impellercProcess.stderr);
_logger.printTrace(stdout);
_logger.printError(stderr);
if (fatal) {
throw ShaderCompilerException._(
'Shader compilation of "${input.path}" to "$outputPath" '
'failed with exit code $code.',
'failed with exit code $code.\n'
'impellerc stdout:\n$stdout\n'
'impellerc stderr:\n$stderr',
);
}
return false;
......
......@@ -199,6 +199,8 @@ void main() {
'--input-type=frag',
'--include=$fragDir',
],
stdout: 'impellerc stdout',
stderr: 'impellerc stderr',
exitCode: 1,
),
]);
......@@ -209,14 +211,18 @@ void main() {
artifacts: artifacts,
);
await expectLater(
() => shaderCompiler.compileShader(
try {
await shaderCompiler.compileShader(
input: fileSystem.file(notFragPath),
outputPath: outputPath,
target: ShaderTarget.sksl,
),
throwsA(isA<ShaderCompilerException>()),
);
fail('unreachable');
} on ShaderCompilerException catch (e) {
expect(e.toString(), contains('impellerc stdout:\nimpellerc stdout'));
expect(e.toString(), contains('impellerc stderr:\nimpellerc stderr'));
}
expect(fileSystem.file(outputPath).existsSync(), false);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment