Skip to content

Commit 9b4c93d

Browse files
committed
refactor: Cleanup of ProjectGraph
1 parent 7b97f37 commit 9b4c93d

2 files changed

Lines changed: 2 additions & 142 deletions

File tree

‎packages/project/lib/graph/ProjectGraph.js‎

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
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";
61
import OutputStyleEnum from "../build/helpers/ProjectBuilderOutputStyle.js";
72
import {getLogger} from "@ui5/logger";
83
const log = getLogger("graph:ProjectGraph");
94
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";
125

136

147
/**
@@ -761,13 +754,11 @@ class ProjectGraph {
761754
ui5DataDir,
762755
});
763756

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({
767758
destPath, cleanDest,
768759
includedDependencies, excludedDependencies,
769760
dependencyIncludes,
770-
}));
761+
});
771762
}
772763

773764
async serve({
@@ -801,17 +792,6 @@ class ProjectGraph {
801792
ui5DataDir,
802793
});
803794

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-
815795
const {
816796
default: BuildServer
817797
} = await import("../build/BuildServer.js");

‎packages/project/test/lib/graph/ProjectGraph.lock.js‎

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)