@@ -44,7 +44,13 @@ Synchronizer::Synchronizer(BaseTestGen *testGen,
4444 : testGen(testGen), sizeContext(sizeContext) {
4545}
4646
47- bool Synchronizer::isProbablyOutdated (const fs::path &srcFilePath) const {
47+ long long Synchronizer::getFileOutdatedTime (const fs::path &filePath) const {
48+ return TimeUtils::convertFileToSystemClock (fs::last_write_time (filePath))
49+ .time_since_epoch ()
50+ .count ();
51+ }
52+
53+ bool Synchronizer::isProbablyOutdatedStubs (const fs::path &srcFilePath) const {
4854 fs::path stubFilePath = Paths::sourcePathToStubPath (testGen->projectContext , srcFilePath);
4955 if (!fs::exists (stubFilePath)) {
5056 return true ;
@@ -58,22 +64,33 @@ bool Synchronizer::isProbablyOutdated(const fs::path &srcFilePath) const {
5864 } catch (...) {
5965 return true ;
6066 }
61- srcTimestamp = TimeUtils::convertFileToSystemClock (fs::last_write_time (srcFilePath))
62- .time_since_epoch ()
63- .count ();
67+ srcTimestamp = Synchronizer::getFileOutdatedTime (srcFilePath);
6468 return stubTimestamp <= srcTimestamp;
6569}
6670
71+ bool Synchronizer::isProbablyOutdatedWrappers (const fs::path &srcFilePath) const {
72+ fs::path wrapperFilePath = Paths::getWrapperFilePath (testGen->projectContext , srcFilePath);
73+ if (!fs::exists (wrapperFilePath)) {
74+ return true ;
75+ }
76+ long long wrapperTimestamp, srcTimestamp;
77+ wrapperTimestamp = Synchronizer::getFileOutdatedTime (wrapperFilePath);
78+ srcTimestamp = Synchronizer::getFileOutdatedTime (srcFilePath);
79+ return wrapperTimestamp <= srcTimestamp;
80+ }
81+
6782CollectionUtils::FileSet Synchronizer::getOutdatedSourcePaths () const {
68- return CollectionUtils::filterOut (getTargetSourceFiles (), [this ](fs::path const &sourcePath) {
69- return !isProbablyOutdated (sourcePath);
83+ auto allFiles = getTargetSourceFiles ();
84+ auto outdatedSources = CollectionUtils::filterOut (getTargetSourceFiles (), [this ](fs::path const &sourcePath) {
85+ return !isProbablyOutdatedWrappers (sourcePath);
7086 });
87+ return outdatedSources;
7188}
7289
7390StubSet Synchronizer::getOutdatedStubs () const {
7491 auto allFiles = getStubsFiles ();
7592 auto outdatedStubs = CollectionUtils::filterOut (allFiles, [this ](StubOperator const &stubOperator) {
76- return !isProbablyOutdated (stubOperator.getSourceFilePath ());
93+ return !isProbablyOutdatedStubs (stubOperator.getSourceFilePath ());
7794 });
7895 return outdatedStubs;
7996}
0 commit comments