diff --git a/bin/app/data/gui/icon/sonargraph_icon.png b/bin/app/data/gui/icon/sonargraph_icon.png index 571f1149..9100eb4f 100644 Binary files a/bin/app/data/gui/icon/sonargraph_icon.png and b/bin/app/data/gui/icon/sonargraph_icon.png differ diff --git a/src/lib/data/indexer/IndexerCommandList.cpp b/src/lib/data/indexer/IndexerCommandList.cpp index fbfe0024..a66984b3 100644 --- a/src/lib/data/indexer/IndexerCommandList.cpp +++ b/src/lib/data/indexer/IndexerCommandList.cpp @@ -35,7 +35,14 @@ void IndexerCommandList::shuffle() std::vector sourceFileSizesToCommands; for (std::shared_ptr command: m_commands) { - sourceFileSizesToCommands.push_back(std::make_pair(FileSystem::getFileByteSize(command->getSourceFilePath()), command)); + if (command->getSourceFilePath().exists()) + { + sourceFileSizesToCommands.push_back(std::make_pair(FileSystem::getFileByteSize(command->getSourceFilePath()), command)); + } + else + { + sourceFileSizesToCommands.push_back(std::make_pair(1, command)); + } } std::sort(sourceFileSizesToCommands.begin(), sourceFileSizesToCommands.end(), [](const PairType& p, const PairType& q){ return p.first > q.first; }); diff --git a/src/lib/project/RefreshInfoGenerator.cpp b/src/lib/project/RefreshInfoGenerator.cpp index b45e168f..f952e79e 100644 --- a/src/lib/project/RefreshInfoGenerator.cpp +++ b/src/lib/project/RefreshInfoGenerator.cpp @@ -170,7 +170,13 @@ std::set RefreshInfoGenerator::getAllSourceFilePaths(const std::vector { if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED) { - utility::append(allSourceFilePaths, sourceGroup->getAllSourceFilePaths()); + for (const FilePath& sourceFilePath : sourceGroup->getAllSourceFilePaths()) + { + if (sourceFilePath.exists()) + { + allSourceFilePaths.insert(sourceFilePath); + } + } } } diff --git a/src/lib_cxx/project/SourceGroupCxxSonargraph.cpp b/src/lib_cxx/project/SourceGroupCxxSonargraph.cpp index a2c1f41b..aad71442 100644 --- a/src/lib_cxx/project/SourceGroupCxxSonargraph.cpp +++ b/src/lib_cxx/project/SourceGroupCxxSonargraph.cpp @@ -1,5 +1,6 @@ #include "project/SourceGroupCxxSonargraph.h" +#include "data/indexer/IndexerCommand.h" #include "settings/ApplicationSettings.h" #include "settings/SourceGroupSettingsCxxSonargraph.h" #include "utility/messaging/type/MessageStatus.h" @@ -66,7 +67,13 @@ std::vector> SourceGroupCxxSonargraph::getIndexe m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage() )) { - indexerCommands = project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()); + for (std::shared_ptr indexerCommand : project->getIndexerCommands(m_settings, ApplicationSettings::getInstance())) + { + if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end()) + { + indexerCommands.push_back(indexerCommand); + } + } } return indexerCommands; } diff --git a/src/lib_java/project/SourceGroupJavaSonargraph.cpp b/src/lib_java/project/SourceGroupJavaSonargraph.cpp index a83d628f..860a0e1a 100644 --- a/src/lib_java/project/SourceGroupJavaSonargraph.cpp +++ b/src/lib_java/project/SourceGroupJavaSonargraph.cpp @@ -75,7 +75,13 @@ std::vector> SourceGroupJavaSonargraph::getIndex m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage() )) { - indexerCommands = project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()); + for (std::shared_ptr indexerCommand : project->getIndexerCommands(m_settings, ApplicationSettings::getInstance())) + { + if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end()) + { + indexerCommands.push_back(indexerCommand); + } + } } if (!indexerCommands.empty()) diff --git a/src/test/RefreshInfoGeneratorTestSuite.h b/src/test/RefreshInfoGeneratorTestSuite.h index cf88ecee..712c649d 100644 --- a/src/test/RefreshInfoGeneratorTestSuite.h +++ b/src/test/RefreshInfoGeneratorTestSuite.h @@ -31,21 +31,27 @@ public: void test_refresh_info_for_all_files_has_nothing_to_clear_and_specified_source_files_for_basic_sourcegroup() { - const FilePath sourceFilePath = m_sourceFolder.getConcatenated(L"main.cpp"); + cleanup(); + { + const FilePath sourceFilePath = m_sourceFolder.getConcatenated(L"main.cpp"); - std::vector> sourceGroups; - sourceGroups.push_back(std::shared_ptr(new SourceGroupTest({ sourceFilePath }))); + std::vector> sourceGroups; + sourceGroups.push_back(std::shared_ptr(new SourceGroupTest({ sourceFilePath }))); - const RefreshInfo refreshInfo = RefreshInfoGenerator::getRefreshInfoForAllFiles(sourceGroups); + addFileToFileSystem(sourceFilePath); - TS_ASSERT_EQUALS(REFRESH_ALL_FILES, refreshInfo.mode); - TS_ASSERT_EQUALS(0, refreshInfo.nonIndexedFilesToClear.size()); - TS_ASSERT_EQUALS(0, refreshInfo.filesToClear.size()); - TS_ASSERT_EQUALS(1, refreshInfo.filesToIndex.size()); + const RefreshInfo refreshInfo = RefreshInfoGenerator::getRefreshInfoForAllFiles(sourceGroups); - TS_ASSERT(utility::containsElement( - utility::toVector(refreshInfo.filesToIndex), sourceFilePath - )); + TS_ASSERT_EQUALS(REFRESH_ALL_FILES, refreshInfo.mode); + TS_ASSERT_EQUALS(0, refreshInfo.nonIndexedFilesToClear.size()); + TS_ASSERT_EQUALS(0, refreshInfo.filesToClear.size()); + TS_ASSERT_EQUALS(1, refreshInfo.filesToIndex.size()); + + TS_ASSERT(utility::containsElement( + utility::toVector(refreshInfo.filesToIndex), sourceFilePath + )); + } + cleanup(); } void test_refresh_info_for_updated_files_is_empty_for_empty_storage_and_empty_sourcegroup()