Skip to content

Commit

Permalink
fix(core): deterministically hash external nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Jul 27, 2023
1 parent e4d2338 commit 26508b0
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 126 deletions.
64 changes: 44 additions & 20 deletions packages/nx/src/hasher/__snapshots__/task-hasher.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ exports[`TaskHasher dependentTasksOutputFiles should depend on dependent tasks o
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "12802727827024321009",
"TsConfig": "8767608672024750088",
"dist/libs/child/index.d.ts": "3244421341483603138",
"dist/libs/grandchild/index.d.ts": "3244421341483603138",
"parent:!{projectRoot}/**/*.spec.ts": "17962802443644575456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -28,12 +28,12 @@ exports[`TaskHasher dependentTasksOutputFiles should work with dependent tasks w
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "12802727827024321009",
"TsConfig": "8767608672024750088",
"dist/libs/child/index.d.ts": "3244421341483603138",
"dist/libs/grandchild/index.d.ts": "3244421341483603138",
"parent:!{projectRoot}/**/*.spec.ts": "17962802443644575456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -53,14 +53,17 @@ exports[`TaskHasher hashTarget should hash entire subtree of dependencies 1`] =
"ProjectConfiguration": "12026883044296863450",
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "3244421341483603138",
"target": "3789300870433976270",
"npm:@nx/devkit": "$nx/devkit16$",
"npm:@nx/webpack": "$nx/webpack16$",
"npm:nx": "$nx16$",
"npm:webpack": "5.0.0",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "11829832011053499600",
"value": "17607022607820563118",
}
`;

Expand All @@ -73,7 +76,7 @@ exports[`TaskHasher hashTarget should hash executor dependencies of @nx packages
"ProjectConfiguration": "12026883044296863450",
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "3244421341483603138",
"target": "1274004356858584726",
"npm:@nx/webpack": "16.0.0",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -94,7 +97,8 @@ exports[`TaskHasher hashTarget should use externalDependencies to override nx:ru
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "3244421341483603138",
"env:undefined": "3244421341483603138",
"target": "7688798210438770308",
"npm:react": "17.0.0",
"npm:webpack": "5.0.0",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -115,7 +119,6 @@ exports[`TaskHasher hashTarget should use externalDependencies with empty array
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "3244421341483603138",
"env:undefined": "3244421341483603138",
"target": "3244421341483603138",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -132,12 +135,12 @@ exports[`TaskHasher should be able to handle multiple filesets per project 1`] =
"command": "13785966310271077209",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "17211930887387929067",
"TsConfig": "8767608672024750088",
"child:!{projectRoot}/**/*.spec.ts": "17508782620731849000",
"env:MY_TEST_HASH_ENV": "17357374746554314488",
"parent:{projectRoot}/**/*": "7263479247245830838",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/global1": "3052102066027208710",
Expand All @@ -156,10 +159,10 @@ exports[`TaskHasher should be able to handle multiple filesets per project 2`] =
"command": "6958627266354933907",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "17211930887387929067",
"TsConfig": "8767608672024750088",
"child:{projectRoot}/**/*": "2300207741412661544",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/global1": "3052102066027208710",
Expand All @@ -177,12 +180,12 @@ exports[`TaskHasher should be able to include only a part of the base tsconfig 1
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "18166168584521190546",
"TsConfig": "4035819825874039301",
"parent:{projectRoot}/**/*": "8263681721738113012",
"runtime:echo runtime123": "runtime123",
"runtime:echo runtime456": "runtime456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -199,6 +202,7 @@ exports[`TaskHasher should create task hash 1`] = `
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "4875698716044094030",
"TsConfig": "8767608672024750088",
"env:NONEXISTENTENV": "3244421341483603138",
Expand All @@ -207,7 +211,6 @@ exports[`TaskHasher should create task hash 1`] = `
"runtime:echo runtime123": "runtime123",
"runtime:echo runtime456": "runtime456",
"tagged:{projectRoot}/**/*": "3244421341483603138",
"target": "1389868326933519382",
"unrelated:{projectRoot}/**/*": "10091615118977982257",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
Expand All @@ -219,16 +222,37 @@ exports[`TaskHasher should create task hash 1`] = `
}
`;

exports[`TaskHasher should hash missing dependent npm project versions 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "14358315432887000841",
"ProjectConfiguration": "8128657069648957137",
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "9104199730100321982",
"npm:react": "17.0.0",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "3668827038634092448",
}
`;

exports[`TaskHasher should hash multiple filesets of a project 1`] = `
{
"details": {
"command": "13785966310271077209",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "10499856664466672714",
"TsConfig": "8767608672024750088",
"parent:{projectRoot}/**/*": "7263479247245830838",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -245,10 +269,10 @@ exports[`TaskHasher should hash multiple filesets of a project 2`] = `
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "10499856664466672714",
"TsConfig": "8767608672024750088",
"parent:!{projectRoot}/**/*.spec.ts": "17962802443644575456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -265,11 +289,11 @@ exports[`TaskHasher should hash non-default filesets 1`] = `
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "8196293273405506196",
"TsConfig": "8767608672024750088",
"child:{projectRoot}/**/*": "2300207741412661544",
"parent:!{projectRoot}/**/*.spec.ts": "17962802443644575456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -286,11 +310,11 @@ exports[`TaskHasher should hash npm project versions 1`] = `
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "14358315432887000841",
"ProjectConfiguration": "8128657069648957137",
"TsConfig": "8767608672024750088",
"app:{projectRoot}/**/*": "9104199730100321982",
"npm:react": "4468841026152585217",
"target": "14358315432887000841",
"npm:react": "17.0.0",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -307,11 +331,11 @@ exports[`TaskHasher should hash task where the project has dependencies 1`] = `
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "8876282510060012181",
"TsConfig": "8767608672024750088",
"child:{projectRoot}/**/*": "5484012818475684626",
"parent:{projectRoot}/**/*": "14822394489351823627",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -328,11 +352,11 @@ exports[`TaskHasher should hash tasks where the project graph has circular depen
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "9892649345820140726",
"TsConfig": "8767608672024750088",
"child:{projectRoot}/**/*": "8973015561538144423",
"parent:{projectRoot}/**/*": "9104199730100321982",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -349,11 +373,11 @@ exports[`TaskHasher should hash tasks where the project graph has circular depen
"command": "7833005669885463868",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "18166168584521190546",
"TsConfig": "8767608672024750088",
"child:{projectRoot}/**/*": "8973015561538144423",
"parent:{projectRoot}/**/*": "9104199730100321982",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand All @@ -370,11 +394,11 @@ exports[`TaskHasher should use targetDefaults from nx.json 1`] = `
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"AllExternalDependencies": "1389868326933519382",
"ProjectConfiguration": "9892649345820140726",
"TsConfig": "8767608672024750088",
"child:!{projectRoot}/**/*.spec.ts": "17508782620731849000",
"parent:!{projectRoot}/**/*.spec.ts": "17962802443644575456",
"target": "1389868326933519382",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
Expand Down
Loading

0 comments on commit 26508b0

Please sign in to comment.