Allow parallel execution of async graph.build
corporateuser opened this issue · 1 comments
corporateuser commented
Expected Behavior
I should be able to run multiple graph.build
in parallel with async functions. This is extremely useful for CAP projects where we have multiple independent UI5 applications.
Current Behavior
Due to several places with global variables we're having conflicts between different executions, e.g. for logs in node_modules/@ui5/project/lib/build/ProjectBuilder.js line 4 or minify task worker pool node_modules/@ui5/builder/lib/processors/minifier.js line 17
Steps to Reproduce the Issue
- Create several independent fiori/ui5 applications
- Try to do parallel build with:
ui5Apps = ['app/app1/ui5.yaml','...','app/app30/ui5.yaml'];
await Promise.all(
ui5Apps.map((ui) => buildUi(ui))
);
Where build is
async function buildUi(ui) {
const folderName = path.dirname(ui);
let graph = await graphFromPackageDependencies({
cwd: folderName,
rootConfigPath: `./ui5.yaml`,
});
await graph.build({
destPath: `app/dist/resources`,
cleanDest: false,
includedTasks: ['generateCachebusterInfo'],
excludedTasks: ['replaceVersion'],
});
}
Context
- UI5 Module Version (output of
ui5 --version
when using the CLI):3.6.0
- Node.js Version:
v20.8.0
- yarn Version:
1.22.19
- OS/Platform:
MacOS
- Browser (if relevant):
not relevant
- Other information regarding your environment (optional):
nothing
Log Output / Stack Trace
Error: loggers/Build#endProjectBuild: Unknown project <project_name>
at Build.endProjectBuild (file:///.../node_modules/@ui5/logger/lib/loggers/Build.js:54:10)
at ProjectBuilder.build (file:///.../node_modules/@ui5/project/lib/build/ProjectBuilder.js:245:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ProjectGraph.build (file:///.../node_modules/@ui5/project/lib/graph/ProjectGraph.js:572:3)
at async buildUi (file:///.../build-ui.mjs:194:3)
d3xter666 commented
Hey @corporateuser,
Thanks for reporting this issue!
The fix si ready in @ui5/project@3.7.3
and @ui5/cli@3.7.1