|
1 | | -import path from "node:path"; |
2 | | -import {mkdir} from "node:fs/promises"; |
3 | | -import {getRandomValues} from "node:crypto"; |
4 | | -import {promisify} from "node:util"; |
5 | | -import lockfile from "lockfile"; |
6 | 1 | import OutputStyleEnum from "../build/helpers/ProjectBuilderOutputStyle.js"; |
7 | 2 | import {getLogger} from "@ui5/logger"; |
8 | 3 | const log = getLogger("graph:ProjectGraph"); |
9 | 4 | import Cache from "../../../project/lib/build/cache/Cache.js"; |
10 | | -import {resolveUi5DataDir} from "../utils/dataDir.js"; |
11 | | -import {getLockDir, LOCK_STALE_MS, withLock} from "../utils/lock.js"; |
12 | 5 |
|
13 | 6 |
|
14 | 7 | /** |
@@ -761,13 +754,11 @@ class ProjectGraph { |
761 | 754 | ui5DataDir, |
762 | 755 | }); |
763 | 756 |
|
764 | | - const resolvedUi5DataDir = ui5DataDir ?? await resolveUi5DataDir(); |
765 | | - const lockPath = path.join(getLockDir(resolvedUi5DataDir), `build-${process.pid}.lock`); |
766 | | - return withLock(lockPath, () => builder.buildToTarget({ |
| 757 | + return await builder.buildToTarget({ |
767 | 758 | destPath, cleanDest, |
768 | 759 | includedDependencies, excludedDependencies, |
769 | 760 | dependencyIncludes, |
770 | | - })); |
| 761 | + }); |
771 | 762 | } |
772 | 763 |
|
773 | 764 | async serve({ |
@@ -801,17 +792,6 @@ class ProjectGraph { |
801 | 792 | ui5DataDir, |
802 | 793 | }); |
803 | 794 |
|
804 | | - // Acquire a process-lifetime lock so that 'ui5 cache clean' cannot delete |
805 | | - // framework files while the server is actively serving them. |
806 | | - // A random suffix ensures uniqueness when multiple server instances run in |
807 | | - // the same process (e.g. programmatic API callers, integration tests). |
808 | | - // On abnormal exit (signals), lockfile's own signal-exit handler handles cleanup. |
809 | | - const resolvedUi5DataDir = ui5DataDir ?? await resolveUi5DataDir(); |
810 | | - const lockId = Buffer.from(getRandomValues(new Uint8Array(4))).toString("hex"); |
811 | | - const lockPath = path.join(getLockDir(resolvedUi5DataDir), `server-${process.pid}-${lockId}.lock`); |
812 | | - await mkdir(path.dirname(lockPath), {recursive: true}); |
813 | | - await promisify(lockfile.lock)(lockPath, {stale: LOCK_STALE_MS}); |
814 | | - |
815 | 795 | const { |
816 | 796 | default: BuildServer |
817 | 797 | } = await import("../build/BuildServer.js"); |
|
0 commit comments