From 5da96c75a22b2c0ee3f845c740a0a803669ae974 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 23 Oct 2017 11:42:48 -0700 Subject: [PATCH] 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 --- packages/bazel/src/ngc-wrapped/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/bazel/src/ngc-wrapped/index.ts b/packages/bazel/src/ngc-wrapped/index.ts index 81b8b36491..b0931ea2b2 100644 --- a/packages/bazel/src/ngc-wrapped/index.ts +++ b/packages/bazel/src/ngc-wrapped/index.ts @@ -60,6 +60,9 @@ export function runOneBuild(args: string[], inputs?: {[path: string]: string}): inputs, expectedOuts }); + if (diagnostics.length) { + console.error(ng.formatDiagnostics(diagnostics)); + } 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}); const tsickleEmitResult = emitResult as tsickle.EmitResult; let externs = '/** @externs */\n'; - if (diagnostics.length) { - console.error(ng.formatDiagnostics(diagnostics)); - } else { + if (!diagnostics.length) { if (bazelOpts.tsickleGenerateExterns) { externs += tsickle.getGeneratedExterns(tsickleEmitResult.externs); }