logic: added project setup support for Sonargraph projects (Java and CMake-JSON modules supported)
* added classes for loading a Sonargraph project * added Sonargraph options to project setup wizard * added test for generating indexer commands from Sonargraph modules * fixed sqlite storage crashing in constructor when parent directory of provided path does not exist * removed unused FileRegister from Java indexing * removed unused info from IndexerCommandJava * refactored loading and saving of SourceGroupSettings * extracted sourcepaths settings to own class that can be re-used * merged CDB wizard contentents for source file and indexed paths * unified wizard content for sonargraph project path * removed include filters from default source groups * extracted generation of RefreshInfo from Project to RefreshInfoGenerator * added tests for RefreshInfoGenerator * added language and standard selection to sonargraph project setup * added auto-detection for indexed header paths of sonargraph cmake json modules * Sonargraph::Project can enable/disable support for specific modules * warn if sonargraph project contains no matching modules * indexed headers can be detected from sonargraph project
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
#include "project/SourceGroup.h"
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
SourceGroup::~SourceGroup()
|
||||
SourceGroupType SourceGroup::getType() const
|
||||
{
|
||||
return getSourceGroupSettings()->getType();
|
||||
}
|
||||
|
||||
LanguageType SourceGroup::getLanguage() const
|
||||
{
|
||||
return getSourceGroupSettings()->getLanguage();
|
||||
}
|
||||
|
||||
SourceGroupStatusType SourceGroup::getStatus() const
|
||||
@@ -15,68 +18,25 @@ SourceGroupStatusType SourceGroup::getStatus() const
|
||||
return getSourceGroupSettings()->getStatus();
|
||||
}
|
||||
|
||||
LanguageType SourceGroup::getLanguage() const
|
||||
{
|
||||
return getLanguageTypeForSourceGroupType(getType());
|
||||
}
|
||||
|
||||
bool SourceGroup::prepareIndexing()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SourceGroup::fetchAllSourceFilePaths()
|
||||
std::set<FilePath> SourceGroup::filterToContainedSourceFilePath(const std::set<FilePath>& sourceFilePaths) const
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
getAllSourcePaths(),
|
||||
getSourceGroupSettings()->getExcludeFiltersExpandedAndAbsolute(),
|
||||
getSourceGroupSettings()->getSourceExtensions()
|
||||
);
|
||||
m_allSourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getIndexedPaths() const
|
||||
{
|
||||
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getSourcePathsExpandedAndAbsolute());
|
||||
}
|
||||
|
||||
std::set<FilePathFilter> SourceGroup::getExcludeFilters() const
|
||||
{
|
||||
return utility::toSet(getSourceGroupSettings()->getExcludeFiltersExpandedAndAbsolute());
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getAllSourceFilePaths() const
|
||||
{
|
||||
return m_allSourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths) const
|
||||
{
|
||||
std::set<FilePath> sourceFilePathsToIndex;
|
||||
for (const FilePath& sourceFilePath: m_allSourceFilePaths)
|
||||
std::set<FilePath> filteredSourceFilePaths;
|
||||
for (const FilePath& sourceFilePath: getAllSourceFilePaths())
|
||||
{
|
||||
if (staticSourceFilePaths.find(sourceFilePath) == staticSourceFilePaths.end())
|
||||
if (sourceFilePaths.find(sourceFilePath) == sourceFilePaths.end())
|
||||
{
|
||||
sourceFilePathsToIndex.insert(sourceFilePath);
|
||||
filteredSourceFilePaths.insert(sourceFilePath);
|
||||
}
|
||||
}
|
||||
return sourceFilePathsToIndex;
|
||||
return filteredSourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths) const
|
||||
bool SourceGroup::containsSourceFilePath(const FilePath& sourceFilePath) const
|
||||
{
|
||||
std::set<FilePath> resultPaths;
|
||||
for (const FilePath& path: paths)
|
||||
{
|
||||
if (path.exists())
|
||||
{
|
||||
resultPaths.insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
std::set<FilePath> symLinkPaths = FileSystem::getSymLinkedDirectories(paths);
|
||||
resultPaths.insert(symLinkPaths.begin(), symLinkPaths.end());
|
||||
|
||||
return resultPaths;
|
||||
return !filterToContainedSourceFilePath({ sourceFilePath }).empty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user