Skip to content

Commit fd00049

Browse files
committed
fix(core): remove redundant allWorkspaceFiles from the project graph pipeline
1 parent 860d00f commit fd00049

File tree

7 files changed

+13
-38
lines changed

7 files changed

+13
-38
lines changed

packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ let cachedSerializedProjectGraphPromise: Promise<SerializedProjectGraph>;
5757
export let fileMapWithFiles:
5858
| {
5959
fileMap: FileMap;
60-
allWorkspaceFiles: FileData[];
6160
rustReferences: NxWorkspaceFilesExternals;
6261
}
6362
| undefined;
@@ -408,14 +407,12 @@ async function createAndSerializeProjectGraph({
408407
try {
409408
performance.mark('create-project-graph-start');
410409
const fileMap = copyFileMap(fileMapWithFiles.fileMap);
411-
const allWorkspaceFiles = copyFileData(fileMapWithFiles.allWorkspaceFiles);
412410
const rustReferences = fileMapWithFiles.rustReferences;
413411
const { projectGraph, projectFileMapCache } =
414412
await buildProjectGraphUsingFileMap(
415413
projects,
416414
knownExternalNodes,
417415
fileMap,
418-
allWorkspaceFiles,
419416
rustReferences,
420417
currentProjectFileMapCache || readFileMapCache(),
421418
await getPlugins(),

packages/nx/src/hasher/create-task-hasher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function createTaskHasher(
1616
if (daemonClient.enabled()) {
1717
return new DaemonBasedTaskHasher(daemonClient, runnerOptions);
1818
} else {
19-
const { fileMap, allWorkspaceFiles, rustReferences } = getFileMap();
19+
const { rustReferences } = getFileMap();
2020
return new InProcessTaskHasher(
2121
projectGraph,
2222
nxJson,

packages/nx/src/project-graph/build-project-graph.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,15 @@ import { DelayedSpinner } from '../utils/delayed-spinner';
4848
import { hashObject } from '../hasher/file-hasher';
4949

5050
let storedFileMap: FileMap | null = null;
51-
let storedAllWorkspaceFiles: FileData[] | null = null;
5251
let storedRustReferences: NxWorkspaceFilesExternals | null = null;
5352

5453
export function getFileMap(): {
5554
fileMap: FileMap;
56-
allWorkspaceFiles: FileData[];
5755
rustReferences: NxWorkspaceFilesExternals | null;
5856
} {
5957
if (!!storedFileMap) {
6058
return {
6159
fileMap: storedFileMap,
62-
allWorkspaceFiles: storedAllWorkspaceFiles,
6360
rustReferences: storedRustReferences,
6461
};
6562
} else {
@@ -68,27 +65,23 @@ export function getFileMap(): {
6865
nonProjectFiles: [],
6966
projectFileMap: {},
7067
},
71-
allWorkspaceFiles: [],
7268
rustReferences: null,
7369
};
7470
}
7571
}
7672

7773
export function hydrateFileMap(
7874
fileMap: FileMap,
79-
allWorkspaceFiles: FileData[],
8075
rustReferences: NxWorkspaceFilesExternals
8176
) {
8277
storedFileMap = fileMap;
83-
storedAllWorkspaceFiles = allWorkspaceFiles;
8478
storedRustReferences = rustReferences;
8579
}
8680

8781
export async function buildProjectGraphUsingProjectFileMap(
8882
projectRootMap: Record<string, ProjectConfiguration>,
8983
externalNodes: Record<string, ProjectGraphExternalNode>,
9084
fileMap: FileMap,
91-
allWorkspaceFiles: FileData[],
9285
rustReferences: NxWorkspaceFilesExternals,
9386
fileMapCache: FileMapCache | null,
9487
plugins: LoadedNxPlugin[],
@@ -98,7 +91,6 @@ export async function buildProjectGraphUsingProjectFileMap(
9891
projectFileMapCache: FileMapCache;
9992
}> {
10093
storedFileMap = fileMap;
101-
storedAllWorkspaceFiles = allWorkspaceFiles;
10294
storedRustReferences = rustReferences;
10395

10496
const projects: Record<string, ProjectConfiguration> = {};

packages/nx/src/project-graph/file-map-utils.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ describe('fileMapUtils', () => {
4747
},
4848
nonProjectFiles: [{ file: 'tools/myfile.txt', hash: 'some-hash' }],
4949
},
50-
allWorkspaceFiles: [
51-
{ file: 'apps/demo/src/main.ts', hash: 'some-hash' },
52-
{ file: 'apps/demo-e2e/src/main.ts', hash: 'some-hash' },
53-
{ file: 'libs/ui/src/index.ts', hash: 'some-hash' },
54-
{ file: 'tools/myfile.txt', hash: 'some-hash' },
55-
],
5650
});
5751
});
5852
});

packages/nx/src/project-graph/file-map-utils.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
import {
1+
import type {
22
FileData,
33
FileMap,
44
ProjectFileMap,
55
ProjectGraph,
66
} from '../config/project-graph';
7-
import {
7+
import type {
88
ProjectConfiguration,
99
ProjectsConfigurations,
1010
} from '../config/workspace-json-project-json';
11-
import { daemonClient } from '../daemon/client/client';
1211
import { NxWorkspaceFilesExternals } from '../native';
1312
import {
1413
getAllFileDataInContext,
1514
updateProjectFiles,
1615
} from '../utils/workspace-context';
1716
import { workspaceRoot } from '../utils/workspace-root';
1817
import { readProjectsConfigurationFromProjectGraph } from './project-graph';
19-
import { buildAllWorkspaceFiles } from './utils/build-all-workspace-files';
2018
import {
2119
createProjectRootMappingsFromProjectConfigurations,
2220
findProjectForPath,
2321
} from './utils/find-project-for-path';
2422

2523
export interface WorkspaceFileMap {
26-
allWorkspaceFiles: FileData[];
2724
fileMap: FileMap;
2825
}
2926

@@ -70,7 +67,6 @@ export function createFileMap(
7067
}
7168
}
7269
return {
73-
allWorkspaceFiles,
7470
fileMap: {
7571
projectFileMap,
7672
nonProjectFiles,
@@ -94,10 +90,6 @@ export function updateFileMap(
9490
);
9591
return {
9692
fileMap: updates.fileMap,
97-
allWorkspaceFiles: buildAllWorkspaceFiles(
98-
updates.fileMap.projectFileMap,
99-
updates.fileMap.nonProjectFiles
100-
),
10193
rustReferences: updates.externalReferences,
10294
};
10395
}

packages/nx/src/project-graph/project-graph.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ export async function buildProjectGraphAndSourceMapsWithoutDaemon() {
133133
performance.mark('retrieve-project-configurations:end');
134134

135135
performance.mark('retrieve-workspace-files:start');
136-
const { allWorkspaceFiles, fileMap, rustReferences } =
137-
await retrieveWorkspaceFiles(workspaceRoot, projectRootMap);
136+
const { fileMap, rustReferences } = await retrieveWorkspaceFiles(
137+
workspaceRoot,
138+
projectRootMap
139+
);
138140
performance.mark('retrieve-workspace-files:end');
139141

140142
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
@@ -148,7 +150,6 @@ export async function buildProjectGraphAndSourceMapsWithoutDaemon() {
148150
projects,
149151
externalNodes,
150152
fileMap,
151-
allWorkspaceFiles,
152153
rustReferences,
153154
cacheEnabled ? readFileMapCache() : null,
154155
plugins,
@@ -227,9 +228,11 @@ async function readCachedGraphAndHydrateFileMap(minimumComputedAt?: number) {
227228
project,
228229
])
229230
);
230-
const { allWorkspaceFiles, fileMap, rustReferences } =
231-
await retrieveWorkspaceFiles(workspaceRoot, projectRootMap);
232-
hydrateFileMap(fileMap, allWorkspaceFiles, rustReferences);
231+
const { fileMap, rustReferences } = await retrieveWorkspaceFiles(
232+
workspaceRoot,
233+
projectRootMap
234+
);
235+
hydrateFileMap(fileMap, rustReferences);
233236
return graph;
234237
}
235238

packages/nx/src/project-graph/utils/retrieve-workspace-files.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import {
1212
import type { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
1313
import {
1414
getNxWorkspaceFilesFromContext,
15-
globWithWorkspaceContext,
1615
multiGlobWithWorkspaceContext,
1716
} from '../../utils/workspace-context';
18-
import { buildAllWorkspaceFiles } from './build-all-workspace-files';
1917
import { join } from 'path';
2018
import { getOnlyDefaultPlugins, getPlugins } from '../plugins/get-plugins';
2119

2220
/**
23-
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
21+
* Walks the workspace directory to create the `projectFileMap` and `ProjectConfigurations`
2422
* @throws
2523
* @param workspaceRoot
2624
* @param nxJson
@@ -49,7 +47,6 @@ export async function retrieveWorkspaceFiles(
4947
);
5048

5149
return {
52-
allWorkspaceFiles: buildAllWorkspaceFiles(projectFileMap, globalFiles),
5350
fileMap: {
5451
projectFileMap,
5552
nonProjectFiles: globalFiles,

0 commit comments

Comments
 (0)