logic: sonargraph fixes
* removed duplicates from detected indexed headers * fixed indexed header paths not used in cxx sonargraph project
This commit is contained in:
+970
-10670
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
|||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
#include "settings/LanguageType.h"
|
#include "settings/LanguageType.h"
|
||||||
#include "settings/SourceGroupSettings.h"
|
#include "settings/SourceGroupSettings.h"
|
||||||
|
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||||
#include "utility/file/FileSystem.h"
|
#include "utility/file/FileSystem.h"
|
||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
#include "utility/sonargraph/SonargraphSoftwareSystem.h"
|
#include "utility/sonargraph/SonargraphSoftwareSystem.h"
|
||||||
@@ -333,15 +334,17 @@ namespace Sonargraph
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FilePath baseDir = rootPath->getFilePath(softwareSystem->getBaseDirectory());
|
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> excludeFilters = utility::toSet(getDerivedExcludeFilters());
|
||||||
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
||||||
const std::string languageStandard = sourceGroupSettings->getStandard();
|
const std::string languageStandard = sourceGroupSettings->getStandard();
|
||||||
const std::vector<FilePath> systemHeaderSearchPaths = utility::concat(
|
const std::vector<FilePath> systemHeaderSearchPaths = (appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>());
|
||||||
(appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>()),
|
|
||||||
utility::toVector(indexedPaths)
|
|
||||||
);
|
|
||||||
const std::vector<FilePath> frameworkSearchPaths = (appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>());
|
const std::vector<FilePath> frameworkSearchPaths = (appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>());
|
||||||
|
|
||||||
OrderedCache<Id, std::vector<std::wstring>> compilerOptionCache([&](const Id& id) {
|
OrderedCache<Id, std::vector<std::wstring>> compilerOptionCache([&](const Id& id) {
|
||||||
@@ -362,9 +365,10 @@ namespace Sonargraph
|
|||||||
rootPath, baseDir, excludeFilters, includeFilters)
|
rootPath, baseDir, excludeFilters, includeFilters)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const FilePath sourceFilePath = sourceFile.getFilePath(baseDir).makeCanonical();
|
||||||
indexerCommands.push_back(std::make_shared<IndexerCommandCxxEmpty>(
|
indexerCommands.push_back(std::make_shared<IndexerCommandCxxEmpty>(
|
||||||
sourceFile.getFilePath(baseDir).makeCanonical(),
|
sourceFilePath,
|
||||||
indexedPaths,
|
utility::concat(indexedHeaderPaths, { sourceFilePath }),
|
||||||
excludeFilters,
|
excludeFilters,
|
||||||
includeFilters,
|
includeFilters,
|
||||||
softwareSystem->getBaseDirectory(),
|
softwareSystem->getBaseDirectory(),
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||||
|
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||||
@@ -245,15 +246,15 @@ void QtProjectWizzardContentPathCDB::pickedPath()
|
|||||||
{
|
{
|
||||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||||
|
|
||||||
std::vector<FilePath> indexedHeaderPaths;
|
std::set<FilePath> indexedHeaderPaths;
|
||||||
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings))
|
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings))
|
||||||
{
|
{
|
||||||
if (projectPath.contains(path))
|
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();
|
m_window->loadContent();
|
||||||
@@ -390,7 +391,21 @@ void QtProjectWizzardContentSonargraphProjectPath::pickedPath()
|
|||||||
{
|
{
|
||||||
m_window->saveContent();
|
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();
|
m_window->loadContent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ public:
|
|||||||
const std::wstring projectName = L"CxxCmakeJsonModules";
|
const std::wstring projectName = L"CxxCmakeJsonModules";
|
||||||
|
|
||||||
ProjectSettings projectSettings;
|
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>();
|
std::shared_ptr<ApplicationSettings> applicationSettings = std::make_shared<ApplicationSettings>();
|
||||||
applicationSettings->setHeaderSearchPaths({ FilePath(L"test/header/search/path") });
|
applicationSettings->setHeaderSearchPaths({ FilePath(L"test/header/search/path") });
|
||||||
|
|||||||
Reference in New Issue
Block a user