diff --git a/server/src/Server.cpp b/server/src/Server.cpp index 2f3706a58..fd5721d18 100644 --- a/server/src/Server.cpp +++ b/server/src/Server.cpp @@ -257,7 +257,7 @@ Status Server::TestsGenServiceImpl::ProcessBaseTestRequest(BaseTestGen &testGen, auto generator = std::make_shared(&testGen, typesHandler, pathSubstitution); ReturnTypesFetcher returnTypesFetcher{&testGen}; - returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getSourceFiles()); + returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getTargetSourceFiles()); LOG_S(DEBUG) << "Temporary build directory path: " << testGen.serverBuildDir; generator->buildKleeFiles(testGen.tests, lineInfo); generator->handleFailedFunctions(testGen.tests); diff --git a/server/src/Synchronizer.cpp b/server/src/Synchronizer.cpp index 7bfc6f863..16da36497 100644 --- a/server/src/Synchronizer.cpp +++ b/server/src/Synchronizer.cpp @@ -65,7 +65,7 @@ bool Synchronizer::isProbablyOutdated(const fs::path &srcFilePath) const { } CollectionUtils::FileSet Synchronizer::getOutdatedSourcePaths() const { - return CollectionUtils::filterOut(getSourceFiles(), [this](fs::path const &sourcePath) { + return CollectionUtils::filterOut(getTargetSourceFiles(), [this](fs::path const &sourcePath) { return !isProbablyOutdated(sourcePath); }); } @@ -161,6 +161,7 @@ void Synchronizer::synchronizeStubs(StubSet &outdatedStubs, fs::path ccJsonStubDirPath = Paths::getUTBotBuildDir(testGen->projectContext) / "stubs_build_files"; + // todo: is it needed? auto stubsCdb = createStubsCompilationDatabase(stubFiles, ccJsonStubDirPath); auto sourceToHeaderRewriter = @@ -197,7 +198,7 @@ Synchronizer::createStubsCompilationDatabase(StubSet &stubFiles, void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedSourcePaths) const { auto sourceFilesNeedToRegenerateWrappers = outdatedSourcePaths; - for (fs::path const &sourceFilePath : getSourceFiles()) { + for (fs::path const &sourceFilePath : getTargetSourceFiles()) { if (!CollectionUtils::contains(sourceFilesNeedToRegenerateWrappers, sourceFilePath)) { auto wrapperFilePath = Paths::getWrapperFilePath(testGen->projectContext, sourceFilePath); @@ -217,10 +218,14 @@ void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedS }); } -const CollectionUtils::FileSet &Synchronizer::getSourceFiles() const { +const CollectionUtils::FileSet &Synchronizer::getTargetSourceFiles() const { return testGen->getTargetBuildDatabase()->compilationDatabase->getAllFiles(); } +const CollectionUtils::FileSet &Synchronizer::getProjectSourceFiles() const { + return testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles(); +} + StubSet Synchronizer::getStubsFiles() const { return getStubSetFromSources(testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles()); } @@ -233,7 +238,7 @@ void Synchronizer::prepareDirectory(const fs::path &stubDirectory) { if (!Paths::isHeaderFile(stubPath)) { fs::path sourcePath = Paths::stubPathToSourcePath(testGen->projectContext, stubPath); - if (!CollectionUtils::contains(getSourceFiles(), sourcePath)) { + if (!CollectionUtils::contains(getProjectSourceFiles(), sourcePath)) { LOG_S(DEBUG) << "Found extra file in stub directory: " << stubPath << ". Removing it."; fs::remove(stubPath); diff --git a/server/src/Synchronizer.h b/server/src/Synchronizer.h index 4a8c1ccf8..62d70661a 100644 --- a/server/src/Synchronizer.h +++ b/server/src/Synchronizer.h @@ -56,7 +56,8 @@ class Synchronizer { void synchronize(const types::TypesHandler &typesHandler); - [[nodiscard]] const CollectionUtils::FileSet &getSourceFiles() const; + [[nodiscard]] const CollectionUtils::FileSet &getTargetSourceFiles() const; + [[nodiscard]] const CollectionUtils::FileSet &getProjectSourceFiles() const; [[nodiscard]] std::unordered_set getStubsFiles() const; };