Skip to content

Commit 6533be2

Browse files
Trying to fix stale files not updated again
1 parent 0de25e2 commit 6533be2

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed

Examples/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main(int argc, char* argv[])
136136
#else
137137
auto re = System2CppRun("ls -lah", commandInfo);
138138
#endif
139-
System2CppGetCommandReturnValueSync(commandInfo, returnCode);
139+
System2CppGetCommandReturnValueSync(commandInfo, returnCode, false);
140140

141141
for(int i = 0; i < argc; ++i)
142142
std::cout << "Arg" << i << ": " << argv[i] << std::endl;

Examples/test_static.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main(int argc, char* argv[])
136136
#else
137137
auto re = System2CppRun("ls -lah", commandInfo);
138138
#endif
139-
System2CppGetCommandReturnValueSync(commandInfo, returnCode);
139+
System2CppGetCommandReturnValueSync(commandInfo, returnCode, false);
140140

141141
for(int i = 0; i < argc; ++i)
142142
std::cout << "Arg" << i << ": " << argv[i] << std::endl;

Include/runcpp2/PipelineSteps.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ namespace runcpp2
134134
using SourceIncludeMap = std::unordered_map<std::string, std::vector<ghc::filesystem::path>>;
135135

136136
bool GatherFilesIncludes( const std::vector<ghc::filesystem::path>& sourceFiles,
137+
const std::vector<bool>& sourceHasCache,
137138
const std::vector<ghc::filesystem::path>& includePaths,
138139
SourceIncludeMap& outSourceIncludes);
139140
}

Src/runcpp2/IncludeManager.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ namespace runcpp2
115115
std::error_code e;
116116
ghc::filesystem::file_time_type sourceTime = ghc::filesystem::last_write_time(sourceFile, e);
117117

118+
ssLOG_DEBUG("sourceTime: " << sourceTime.time_since_epoch().count());
119+
ssLOG_DEBUG("recordTime: " << recordTime.time_since_epoch().count());
120+
118121
if(sourceTime > recordTime)
119122
{
120123
ssLOG_DEBUG("Source file newer than include record");

Src/runcpp2/PipelineSteps.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,17 +1267,29 @@ bool runcpp2::GatherIncludePaths( const ghc::filesystem::path& scriptDirectory
12671267
}
12681268

12691269
bool runcpp2::GatherFilesIncludes( const std::vector<ghc::filesystem::path>& sourceFiles,
1270+
const std::vector<bool>& sourceHasCache,
12701271
const std::vector<ghc::filesystem::path>& includePaths,
12711272
SourceIncludeMap& outSourceIncludes)
12721273
{
12731274
ssLOG_FUNC_INFO();
12741275
INTERNAL_RUNCPP2_SAFE_START();
12751276

1277+
if(sourceFiles.size() != sourceHasCache.size())
1278+
{
1279+
ssLOG_ERROR("Size of sourceFiles and sourceHasCache not matching");
1280+
return false;
1281+
}
1282+
12761283
outSourceIncludes.clear();
1277-
std::unordered_set<std::string> visitedFiles;
12781284

1279-
for(const ghc::filesystem::path& source : sourceFiles)
1285+
for(int i = 0; i < sourceFiles.size(); ++i)
12801286
{
1287+
if(sourceHasCache.at(i))
1288+
continue;
1289+
1290+
const ghc::filesystem::path& source = sourceFiles.at(i);
1291+
1292+
std::unordered_set<std::string> visitedFiles;
12811293
ssLOG_INFO("Gathering includes for " << source.string());
12821294

12831295
std::vector<ghc::filesystem::path>& currentIncludes = outSourceIncludes[source.string()];

Src/runcpp2/runcpp2.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ namespace
120120
bool useCache = currentObjectWriteTime > currentSourceWriteTime &&
121121
currentObjectWriteTime > currentIncludeWriteTime &&
122122
!outdatedIncludeRecord;
123+
124+
ssLOG_DEBUG("currentObjectWriteTime: " <<
125+
currentObjectWriteTime.time_since_epoch().count());
126+
ssLOG_DEBUG("currentSourceWriteTime: " <<
127+
currentSourceWriteTime.time_since_epoch().count());
128+
ssLOG_DEBUG("currentIncludeWriteTime: " <<
129+
currentIncludeWriteTime.time_since_epoch().count());
130+
ssLOG_DEBUG("outdatedIncludeRecord: " << outdatedIncludeRecord);
131+
123132
if(useCache)
124133
{
125134
ssLOG_INFO("Using cache for " << sourceFiles.at(i).string());
@@ -578,14 +587,14 @@ runcpp2::StartPipeline( const std::string& scriptPath,
578587
}
579588

580589
runcpp2::SourceIncludeMap sourcesIncludes;
581-
if(!runcpp2::GatherFilesIncludes(sourceFiles, includePaths, sourcesIncludes))
590+
if(!runcpp2::GatherFilesIncludes(sourceFiles, sourceHasCache, includePaths, sourcesIncludes))
582591
return PipelineResult::UNEXPECTED_FAILURE;
583592

584593
for(int i = 0; i < sourceFiles.size(); ++i)
585594
{
586-
ssLOG_DEBUG("Updating include record for " << sourceFiles.at(i).string());
587595
if(!sourceHasCache.at(i))
588596
{
597+
ssLOG_DEBUG("Updating include record for " << sourceFiles.at(i).string());
589598
if(sourcesIncludes.count(sourceFiles.at(i)) == 0)
590599
{
591600
ssLOG_WARNING( "Includes not gathered for " <<
@@ -607,6 +616,8 @@ runcpp2::StartPipeline( const std::string& scriptPath,
607616
return PipelineResult::UNEXPECTED_FAILURE;
608617
}
609618
}
619+
else
620+
ssLOG_DEBUG("Include record for " << sourceFiles.at(i).string() << " is up to date");
610621
}
611622

612623
std::vector<std::string> linkFilesPaths;

0 commit comments

Comments
 (0)