fix(bazel): don't console.error from the compile helper (#19879)

This lets other callers of compile() choose different formatting for the diagnostics

PR Close #19879
This commit is contained in:
Alex Eagle 2017-10-23 11:42:48 -07:00 committed by Matias Niemelä
parent 90d1423fb4
commit 5da96c75a2
1 changed files with 4 additions and 3 deletions

View File

@ -60,6 +60,9 @@ export function runOneBuild(args: string[], inputs?: {[path: string]: string}):
inputs, inputs,
expectedOuts expectedOuts
}); });
if (diagnostics.length) {
console.error(ng.formatDiagnostics(diagnostics));
}
return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error); return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);
} }
@ -204,9 +207,7 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
{rootNames: files, options: compilerOpts, host: ngHost, emitCallback, gatherDiagnostics}); {rootNames: files, options: compilerOpts, host: ngHost, emitCallback, gatherDiagnostics});
const tsickleEmitResult = emitResult as tsickle.EmitResult; const tsickleEmitResult = emitResult as tsickle.EmitResult;
let externs = '/** @externs */\n'; let externs = '/** @externs */\n';
if (diagnostics.length) { if (!diagnostics.length) {
console.error(ng.formatDiagnostics(diagnostics));
} else {
if (bazelOpts.tsickleGenerateExterns) { if (bazelOpts.tsickleGenerateExterns) {
externs += tsickle.getGeneratedExterns(tsickleEmitResult.externs); externs += tsickle.getGeneratedExterns(tsickleEmitResult.externs);
} }