logic: sonargraph fixes

* removed duplicates from detected indexed headers
* fixed indexed header paths not used in cxx sonargraph project
This commit is contained in:
mlangkabel
2018-06-05 15:48:54 +02:00
parent 2a3420eedf
commit 2584a1f4e2
4 changed files with 1002 additions and 10682 deletions
File diff suppressed because it is too large Load Diff
@@ -6,6 +6,7 @@
#include "settings/ApplicationSettings.h"
#include "settings/LanguageType.h"
#include "settings/SourceGroupSettings.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/sonargraph/SonargraphSoftwareSystem.h"
@@ -333,15 +334,17 @@ namespace Sonargraph
}
const FilePath baseDir = rootPath->getFilePath(softwareSystem->getBaseDirectory());
const std::set<FilePath> indexedPaths = softwareSystem->getAllSourcePaths();
std::set<FilePath> indexedHeaderPaths;
if (std::shared_ptr<const SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<const SourceGroupSettingsCxxSonargraph>(sourceGroupSettings))
{
indexedHeaderPaths = utility::toSet(sonargraphSettings->getIndexedHeaderPathsExpandedAndAbsolute());
}
const std::set<FilePathFilter> excludeFilters = utility::toSet(getDerivedExcludeFilters());
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
const std::string languageStandard = sourceGroupSettings->getStandard();
const std::vector<FilePath> systemHeaderSearchPaths = utility::concat(
(appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>()),
utility::toVector(indexedPaths)
);
const std::vector<FilePath> systemHeaderSearchPaths = (appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>());
const std::vector<FilePath> frameworkSearchPaths = (appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>());
OrderedCache<Id, std::vector<std::wstring>> compilerOptionCache([&](const Id& id) {
@@ -362,9 +365,10 @@ namespace Sonargraph
rootPath, baseDir, excludeFilters, includeFilters)
)
{
const FilePath sourceFilePath = sourceFile.getFilePath(baseDir).makeCanonical();
indexerCommands.push_back(std::make_shared<IndexerCommandCxxEmpty>(
sourceFile.getFilePath(baseDir).makeCanonical(),
indexedPaths,
sourceFilePath,
utility::concat(indexedHeaderPaths, { sourceFilePath }),
excludeFilters,
includeFilters,
softwareSystem->getBaseDirectory(),
@@ -12,6 +12,7 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
#include "settings/ApplicationSettings.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "settings/SourceGroupSettingsJavaMaven.h"
#include "settings/SourceGroupSettingsJavaGradle.h"
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
@@ -245,15 +246,15 @@ void QtProjectWizzardContentPathCDB::pickedPath()
{
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::vector<FilePath> indexedHeaderPaths;
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings))
{
if (projectPath.contains(path))
{
indexedHeaderPaths.push_back(path.getRelativeTo(projectPath));
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
}
cdbSettings->setIndexedHeaderPaths(indexedHeaderPaths);
cdbSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
}
m_window->loadContent();
@@ -390,7 +391,21 @@ void QtProjectWizzardContentSonargraphProjectPath::pickedPath()
{
m_window->saveContent();
// TODO: update indexed headers
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
{
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings))
{
std::string asdasd = path.str();
if (projectPath.contains(path))
{
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
}
sonargraphSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
}
m_window->loadContent();
}
+2 -1
View File
@@ -23,7 +23,8 @@ public:
const std::wstring projectName = L"CxxCmakeJsonModules";
ProjectSettings projectSettings;
std::shared_ptr<SourceGroupSettings> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>("fake_id", &projectSettings);
std::shared_ptr<SourceGroupSettingsCxxSonargraph> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>("fake_id", &projectSettings);
sourceGroupSettings->setIndexedHeaderPaths({ FilePath(L"test/indexed/header/path") });
std::shared_ptr<ApplicationSettings> applicationSettings = std::make_shared<ApplicationSettings>();
applicationSettings->setHeaderSearchPaths({ FilePath(L"test/header/search/path") });