Skip to content

Commit

Permalink
fix: modules not built sequentially (#3045)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
njlynch committed Oct 8, 2021
1 parent 3d2ba15 commit 1589af8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/jsii-pacmak/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export class OneByOneBuilder implements TargetBuilder {
) {}

public async buildModules(): Promise<void> {
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) {
Expand Down

0 comments on commit 1589af8

Please sign in to comment.