From 785d19988743a48ceb8fe2940ec3264ea1058eca Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Tue, 9 Apr 2019 01:14:17 +0300 Subject: [PATCH] build: workaround for jsii exit code issue (#2200) Until https://github.com/awslabs/jsii/pull/442 is released we must fail builds on compilation errors. This is a temporary workaround for this issue (if there is something in stdout we consider that a compilation error). --- tools/cdk-build-tools/lib/compile.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cdk-build-tools/lib/compile.ts b/tools/cdk-build-tools/lib/compile.ts index c58e7e75c579d..ef8a1bbed0ab6 100644 --- a/tools/cdk-build-tools/lib/compile.ts +++ b/tools/cdk-build-tools/lib/compile.ts @@ -7,7 +7,13 @@ import { Timers } from "./timer"; * Run the compiler on the current package */ export async function compileCurrentPackage(timers: Timers, compilers: CompilerOverrides = {}): Promise { - await shell(packageCompiler(compilers), timers); + const stdout = await shell(packageCompiler(compilers), timers); + + // WORKAROUND: jsii 0.8.2 does not exit with non-zero on compilation errors + // until this is released: https://github.com/awslabs/jsii/pull/442 + if (stdout.trim()) { + throw new Error(`Compilation failed`); + } // Find files in bin/ that look like they should be executable, and make them so. const scripts = currentPackageJson().bin || {};