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 { ...@@ -181,12 +181,16 @@ class ShaderCompiler {
final Process impellercProcess = await _processManager.start(cmd); final Process impellercProcess = await _processManager.start(cmd);
final int code = await impellercProcess.exitCode; final int code = await impellercProcess.exitCode;
if (code != 0) { if (code != 0) {
_logger.printTrace(await utf8.decodeStream(impellercProcess.stdout)); final String stdout = await utf8.decodeStream(impellercProcess.stdout);
_logger.printError(await utf8.decodeStream(impellercProcess.stderr)); final String stderr = await utf8.decodeStream(impellercProcess.stderr);
_logger.printTrace(stdout);
_logger.printError(stderr);
if (fatal) { if (fatal) {
throw ShaderCompilerException._( throw ShaderCompilerException._(
'Shader compilation of "${input.path}" to "$outputPath" ' '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; return false;
......
...@@ -199,6 +199,8 @@ void main() { ...@@ -199,6 +199,8 @@ void main() {
'--input-type=frag', '--input-type=frag',
'--include=$fragDir', '--include=$fragDir',
], ],
stdout: 'impellerc stdout',
stderr: 'impellerc stderr',
exitCode: 1, exitCode: 1,
), ),
]); ]);
...@@ -209,14 +211,18 @@ void main() { ...@@ -209,14 +211,18 @@ void main() {
artifacts: artifacts, artifacts: artifacts,
); );
await expectLater( try {
() => shaderCompiler.compileShader( await shaderCompiler.compileShader(
input: fileSystem.file(notFragPath), input: fileSystem.file(notFragPath),
outputPath: outputPath, outputPath: outputPath,
target: ShaderTarget.sksl, 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); 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