@@ -44,7 +44,13 @@ Synchronizer::Synchronizer(BaseTestGen *testGen,
44
44
: testGen(testGen), sizeContext(sizeContext) {
45
45
}
46
46
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 {
48
54
fs::path stubFilePath = Paths::sourcePathToStubPath (testGen->projectContext , srcFilePath);
49
55
if (!fs::exists (stubFilePath)) {
50
56
return true ;
@@ -58,22 +64,33 @@ bool Synchronizer::isProbablyOutdated(const fs::path &srcFilePath) const {
58
64
} catch (...) {
59
65
return true ;
60
66
}
61
- srcTimestamp = TimeUtils::convertFileToSystemClock (fs::last_write_time (srcFilePath))
62
- .time_since_epoch ()
63
- .count ();
67
+ srcTimestamp = Synchronizer::getFileOutdatedTime (srcFilePath);
64
68
return stubTimestamp <= srcTimestamp;
65
69
}
66
70
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
+
67
82
CollectionUtils::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);
70
86
});
87
+ return outdatedSources;
71
88
}
72
89
73
90
StubSet Synchronizer::getOutdatedStubs () const {
74
91
auto allFiles = getStubsFiles ();
75
92
auto outdatedStubs = CollectionUtils::filterOut (allFiles, [this ](StubOperator const &stubOperator) {
76
- return !isProbablyOutdated (stubOperator.getSourceFilePath ());
93
+ return !isProbablyOutdatedStubs (stubOperator.getSourceFilePath ());
77
94
});
78
95
return outdatedStubs;
79
96
}
0 commit comments