Skip to content

Commit

Permalink
fix(core): move hashing to parsing time
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Oct 5, 2022
1 parent 7da42ee commit 2bd13ad
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 145 deletions.
19 changes: 0 additions & 19 deletions packages/nx/src/hasher/hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,6 @@ class TaskHasher {
if (n?.data?.hash) {
// we already know the hash of this dependency
hash = n.data.hash;
} else if (version) {
const deps = [`${projectName}@${version}`];
this.traverseExternalNodesDependencies(projectName, deps);
hash = this.hashing.hashArray(deps.sort());
// store hash of given dependency for later use
n.data.hash = hash;
} else {
// unknown dependency
// this may occur dependency is not an npm package
Expand All @@ -366,19 +360,6 @@ class TaskHasher {
};
}

private traverseExternalNodesDependencies(
projectName: string,
visited: string[]
) {
const dependencies = this.projectGraph.dependencies[projectName] ?? [];
dependencies.forEach((d) => {
if (visited.indexOf(d.target) === -1) {
visited.push(d.target);
this.traverseExternalNodesDependencies(d.target, visited);
}
});
}

private hashTarget(projectName: string, targetName: string): PartialHash {
const projectNode = this.projectGraph.nodes[projectName];
const target = projectNode.data.targets[targetName];
Expand Down
Loading

0 comments on commit 2bd13ad

Please sign in to comment.