Skip to content

Commit

Permalink
Revert "fix(core): provide a way to reuse cached graph in CI (#29156)"
Browse files Browse the repository at this point in the history
This reverts commit 6bd8615.
  • Loading branch information
AgentEnder committed Dec 3, 2024
1 parent 3cc321d commit b95776e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@ import { getPlugins } from '../../plugins/get-plugins';

export const getTouchedProjectsFromProjectGlobChanges: TouchedProjectLocator =
async (touchedFiles, projectGraphNodes): Promise<string[]> => {
const globPattern = await (async () => {
// TODO: We need a quicker way to get patterns that should not
// require starting up plugin workers
if (process.env.NX_FORCE_REUSE_CACHED_GRAPH === 'true') {
return combineGlobPatterns([
'**/package.json',
'**/project.json',
'project.json',
'package.json',
]);
}
const plugins = await getPlugins();
return combineGlobPatterns(configurationGlobs(plugins));
})();
const plugins = await getPlugins();
const globPattern = combineGlobPatterns(configurationGlobs(plugins));

const touchedProjects = new Set<string>();
for (const touchedFile of touchedFiles) {
Expand Down
10 changes: 0 additions & 10 deletions packages/nx/src/project-graph/build-project-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ export function getFileMap(): {
}
}

export function hydrateFileMap(
fileMap: FileMap,
allWorkspaceFiles: FileData[],
rustReferences: NxWorkspaceFilesExternals
) {
storedFileMap = fileMap;
storedAllWorkspaceFiles = allWorkspaceFiles;
storedRustReferences = rustReferences;
}

export async function buildProjectGraphUsingProjectFileMap(
projectRootMap: Record<string, ProjectConfiguration>,
externalNodes: Record<string, ProjectGraphExternalNode>,
Expand Down
25 changes: 1 addition & 24 deletions packages/nx/src/project-graph/project-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { fileExists } from '../utils/fileutils';
import { output } from '../utils/output';
import { stripIndents } from '../utils/strip-indents';
import { workspaceRoot } from '../utils/workspace-root';
import {
buildProjectGraphUsingProjectFileMap,
hydrateFileMap,
} from './build-project-graph';
import { buildProjectGraphUsingProjectFileMap } from './build-project-graph';
import {
AggregateProjectGraphError,
isAggregateProjectGraphError,
Expand All @@ -33,7 +30,6 @@ import {
retrieveWorkspaceFiles,
} from './utils/retrieve-workspace-files';
import { getPlugins } from './plugins/get-plugins';
import { logger } from '../utils/logger';

/**
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
Expand Down Expand Up @@ -233,25 +229,6 @@ export async function createProjectGraphAsync(
resetDaemonClient: false,
}
): Promise<ProjectGraph> {
if (process.env.NX_FORCE_REUSE_CACHED_GRAPH === 'true') {
try {
const graph = readCachedProjectGraph();
const projectRootMap = Object.fromEntries(
Object.entries(graph.nodes).map(([project, { data }]) => [
data.root,
project,
])
);
const { allWorkspaceFiles, fileMap, rustReferences } =
await retrieveWorkspaceFiles(workspaceRoot, projectRootMap);
hydrateFileMap(fileMap, allWorkspaceFiles, rustReferences);
return graph;
// If no cached graph is found, we will fall through to the normal flow
} catch (e) {
logger.verbose('Unable to use cached project graph', e);
}
}

const projectGraphAndSourceMaps = await createProjectGraphAndSourceMapsAsync(
opts
);
Expand Down

0 comments on commit b95776e

Please sign in to comment.