diff --git a/packages/nx/src/hasher/native-task-hasher-impl.spec.ts b/packages/nx/src/hasher/native-task-hasher-impl.spec.ts index 32e6f6ddc2ce56..1e23b868f2ba98 100644 --- a/packages/nx/src/hasher/native-task-hasher-impl.spec.ts +++ b/packages/nx/src/hasher/native-task-hasher-impl.spec.ts @@ -157,17 +157,17 @@ describe('native task hasher', () => { "env:TESTENV": "11441948532827618368", "parent:ProjectConfiguration": "3608670998275221195", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "runtime:echo runtime123": "29846575039086708", "tagged:ProjectConfiguration": "8596726088057301092", "tagged:TsConfig": "2264969541778889434", - "tagged:{projectRoot}/**/*": "112200405683630828", + "tagged:{projectRoot}/**/*": "14666997081331501901", "unrelated:ProjectConfiguration": "11133337791644294114", "unrelated:TsConfig": "2264969541778889434", - "unrelated:{projectRoot}/**/*": "10505120368757496776", + "unrelated:{projectRoot}/**/*": "4127219831408253695", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "5219582320960288192", }, - "value": "13049022000906481001", + "value": "6752177990229940739", }, ] `); @@ -226,13 +226,13 @@ describe('native task hasher', () => { "AllExternalDependencies": "3244421341483603138", "child:ProjectConfiguration": "710102491746666394", "child:TsConfig": "2264969541778889434", - "child:{projectRoot}/**/*": "7694964870822928111", + "child:{projectRoot}/**/*": "3347149359534435991", "parent:ProjectConfiguration": "8031122597231773116", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "5219582320960288192", }, - "value": "17442516481637512275", + "value": "10441723142158830393", } `); }); @@ -305,13 +305,13 @@ describe('native task hasher', () => { "AllExternalDependencies": "3244421341483603138", "child:ProjectConfiguration": "13051054958929525761", "child:TsConfig": "2264969541778889434", - "child:{projectRoot}/**/*": "7694964870822928111", - "parent:!{projectRoot}/**/*.spec.ts": "7663204892242899157", + "child:{projectRoot}/**/*": "3347149359534435991", + "parent:!{projectRoot}/**/*.spec.ts": "8911122541468969799", "parent:ProjectConfiguration": "3608670998275221195", "parent:TsConfig": "2264969541778889434", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "4641558175996703359", }, - "value": "3497993078654537309", + "value": "10915213281046863614", } `); }); @@ -372,22 +372,22 @@ describe('native task hasher', () => { { "details": { "AllExternalDependencies": "3244421341483603138", - "parent:!{projectRoot}/**/*.spec.ts": "7663204892242899157", + "parent:!{projectRoot}/**/*.spec.ts": "8911122541468969799", "parent:ProjectConfiguration": "16402137858974842465", "parent:TsConfig": "2264969541778889434", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "4641558175996703359", }, - "value": "10775755355957559912", + "value": "898401993921705929", }, { "details": { "AllExternalDependencies": "3244421341483603138", "parent:ProjectConfiguration": "16402137858974842465", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "4641558175996703359", }, - "value": "13219368697419749776", + "value": "17751813489978054762", }, ] `); @@ -467,18 +467,18 @@ describe('native task hasher', () => { { "details": { "AllExternalDependencies": "3244421341483603138", - "child:!{projectRoot}/**/*.spec.ts": "13790135045935437026", + "child:!{projectRoot}/**/*.spec.ts": "6212660753359890679", "child:ProjectConfiguration": "10085593111011845427", "child:TsConfig": "2264969541778889434", "env:MY_TEST_HASH_ENV": "17357374746554314488", "parent:ProjectConfiguration": "14398811678394411425", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/global1]": "13078141817211771580", "workspace:[{workspaceRoot}/global2]": "13625885481717016690", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "10897751101872977225", }, - "value": "14298810822113951946", + "value": "715988292529605815", }, ] `); @@ -529,10 +529,10 @@ describe('native task hasher', () => { "AllExternalDependencies": "3244421341483603138", "parent:ProjectConfiguration": "3608670998275221195", "parent:TsConfig": "8661678577354855152", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "5219582320960288192", }, - "value": "10821775409399212451", + "value": "891874926565434230", } `); }); @@ -604,13 +604,13 @@ describe('native task hasher', () => { "AllExternalDependencies": "3244421341483603138", "child:ProjectConfiguration": "13748859057138736105", "child:TsConfig": "2264969541778889434", - "child:{projectRoot}/**/*": "7694964870822928111", + "child:{projectRoot}/**/*": "3347149359534435991", "parent:ProjectConfiguration": "3608670998275221195", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "5219582320960288192", }, - "value": "12197760444984597111", + "value": "6344665026201462314", } `); @@ -626,13 +626,13 @@ describe('native task hasher', () => { "AllExternalDependencies": "3244421341483603138", "child:ProjectConfiguration": "13748859057138736105", "child:TsConfig": "2264969541778889434", - "child:{projectRoot}/**/*": "7694964870822928111", + "child:{projectRoot}/**/*": "3347149359534435991", "parent:ProjectConfiguration": "3608670998275221195", "parent:TsConfig": "2264969541778889434", - "parent:{projectRoot}/**/*": "15295586939211629225", + "parent:{projectRoot}/**/*": "17059468255294227635", "workspace:[{workspaceRoot}/nx.json,{workspaceRoot}/.gitignore,{workspaceRoot}/.nxignore]": "5219582320960288192", }, - "value": "12197760444984597111", + "value": "6344665026201462314", } `); }); diff --git a/packages/nx/src/native/tasks/hashers/hash_project_files.rs b/packages/nx/src/native/tasks/hashers/hash_project_files.rs index c009773cf6af9b..0da62150e681eb 100644 --- a/packages/nx/src/native/tasks/hashers/hash_project_files.rs +++ b/packages/nx/src/native/tasks/hashers/hash_project_files.rs @@ -18,6 +18,7 @@ pub fn hash_project_files( let mut hasher = xxhash_rust::xxh3::Xxh3::new(); for file in collected_files { hasher.update(file.hash.as_bytes()); + hasher.update(file.file.as_bytes()); } Ok(hasher.digest().to_string()) } @@ -157,7 +158,12 @@ mod tests { let hash_result = hash_project_files(proj_name, proj_root, file_sets, &file_map).unwrap(); assert_eq!( hash_result, - hash(&[file_data1.hash.as_bytes(), file_data3.hash.as_bytes()].concat()) + hash(&[ + file_data1.hash.as_bytes(), + file_data1.file.as_bytes(), + file_data3.hash.as_bytes(), + file_data3.file.as_bytes() + ].concat()) ); } @@ -199,7 +205,12 @@ mod tests { let hash_result = hash_project_files(proj_name, proj_root, file_sets, &file_map).unwrap(); assert_eq!( hash_result, - hash(&[file_data1.hash.as_bytes(), file_data3.hash.as_bytes()].concat()) + hash(&[ + file_data1.hash.as_bytes(), + file_data1.file.as_bytes(), + file_data3.hash.as_bytes(), + file_data3.file.as_bytes(), + ].concat()) ); } } diff --git a/packages/nx/src/native/tasks/hashers/hash_workspace_files.rs b/packages/nx/src/native/tasks/hashers/hash_workspace_files.rs index 2535718fb8cca6..6848b7c8cf4d22 100644 --- a/packages/nx/src/native/tasks/hashers/hash_workspace_files.rs +++ b/packages/nx/src/native/tasks/hashers/hash_workspace_files.rs @@ -53,7 +53,8 @@ pub fn hash_workspace_files( .filter(|file| glob.is_match(&file.file)) { trace!("{:?} was found with glob {:?}", file.file, globs); - hashes.push(file.hash.clone()) + hashes.push(file.hash.clone()); + hashes.push(file.file.clone()); } hasher.update(hashes.join(",").as_bytes()); let hashed_value = hasher.digest().to_string(); @@ -110,6 +111,9 @@ mod test { Arc::new(DashMap::new()), ) .unwrap(); - assert_eq!(result, hash(gitignore_file.hash.as_bytes())); + assert_eq!(result, hash([ + gitignore_file.hash, + gitignore_file.file + ].join(",").as_bytes())); } }