[flutter_tool] Include impellerc output in ShaderCompilerException (#108348)
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user