From 1589af8484df894258aabd16e13bfe8e5f56e630 Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Fri, 8 Oct 2021 10:47:39 +0100 Subject: [PATCH] fix: modules not built sequentially (#3045) For Go, JS, and Python, the `OneByOneBuilder` is used to build the modules sequentially. The modules are first sorted topologically, then passed into the builder to build one at a time. However, the package builds are kicked off asynchronously, leading to parallel builds and potential build issues when a local package depends on another. --- packages/jsii-pacmak/lib/builder.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/jsii-pacmak/lib/builder.ts b/packages/jsii-pacmak/lib/builder.ts index 405c563b44..a65bf24c89 100644 --- a/packages/jsii-pacmak/lib/builder.ts +++ b/packages/jsii-pacmak/lib/builder.ts @@ -67,12 +67,15 @@ export class OneByOneBuilder implements TargetBuilder { ) {} public async buildModules(): Promise { - const promises = this.modules.map((module) => - this.options.codeOnly - ? this.generateModuleCode(module, this.options) - : this.buildModule(module, this.options), - ); - await Promise.all(promises); + for (const module of this.modules) { + if (this.options.codeOnly) { + // eslint-disable-next-line no-await-in-loop + await this.generateModuleCode(module, this.options); + } else { + // eslint-disable-next-line no-await-in-loop + await this.buildModule(module, this.options); + } + } } private async generateModuleCode(module: JsiiModule, options: BuildOptions) {