src: removed sonargraph based project setup methods
This commit is contained in:
@@ -381,8 +381,6 @@ add_files(
|
||||
settings/source_group/component/SourceGroupSettingsWithCustomCommand.h
|
||||
settings/source_group/component/SourceGroupSettingsWithExcludeFilters.cpp
|
||||
settings/source_group/component/SourceGroupSettingsWithExcludeFilters.h
|
||||
settings/source_group/component/SourceGroupSettingsWithSonargraphProjectPath.cpp
|
||||
settings/source_group/component/SourceGroupSettingsWithSonargraphProjectPath.h
|
||||
settings/source_group/component/SourceGroupSettingsWithSourceExtensions.cpp
|
||||
settings/source_group/component/SourceGroupSettingsWithSourceExtensions.h
|
||||
settings/source_group/component/SourceGroupSettingsWithSourceExtensionsEmpty.h
|
||||
@@ -395,11 +393,9 @@ add_files(
|
||||
settings/source_group/type/SourceGroupSettingsCxxCdb.h
|
||||
settings/source_group/type/SourceGroupSettingsCxxCdbVs.h
|
||||
settings/source_group/type/SourceGroupSettingsCxxCodeblocks.h
|
||||
settings/source_group/type/SourceGroupSettingsCxxSonargraph.h
|
||||
settings/source_group/type/SourceGroupSettingsJavaEmpty.h
|
||||
settings/source_group/type/SourceGroupSettingsJavaGradle.h
|
||||
settings/source_group/type/SourceGroupSettingsJavaMaven.h
|
||||
settings/source_group/type/SourceGroupSettingsJavaSonargraph.h
|
||||
settings/source_group/type/SourceGroupSettingsPythonEmpty.h
|
||||
|
||||
settings/source_group/SourceGroupSettings.cpp
|
||||
@@ -623,33 +619,6 @@ add_files(
|
||||
utility/scheduling/TaskScheduler.h
|
||||
utility/scheduling/TaskSetValue.h
|
||||
|
||||
utility/sonargraph/SonargraphProject.cpp
|
||||
utility/sonargraph/SonargraphProject.h
|
||||
utility/sonargraph/SonargraphSoftwareSystem.cpp
|
||||
utility/sonargraph/SonargraphSoftwareSystem.h
|
||||
utility/sonargraph/SonargraphSourceRootPath.cpp
|
||||
utility/sonargraph/SonargraphSourceRootPath.h
|
||||
utility/sonargraph/SonargraphXsdAbstractModule.cpp
|
||||
utility/sonargraph/SonargraphXsdAbstractModule.h
|
||||
utility/sonargraph/SonargraphXsdAbstractSystemExtension.cpp
|
||||
utility/sonargraph/SonargraphXsdAbstractSystemExtension.h
|
||||
utility/sonargraph/SonargraphXsdCmakeJsonModule.cpp
|
||||
utility/sonargraph/SonargraphXsdCmakeJsonModule.h
|
||||
utility/sonargraph/SonargraphXsdCppManualModule.cpp
|
||||
utility/sonargraph/SonargraphXsdCppManualModule.h
|
||||
utility/sonargraph/SonargraphXsdCppSystemSettings.cpp
|
||||
utility/sonargraph/SonargraphXsdCppSystemSettings.h
|
||||
utility/sonargraph/SonargraphXsdJavaModule.cpp
|
||||
utility/sonargraph/SonargraphXsdJavaModule.h
|
||||
utility/sonargraph/SonargraphXsdRootPath.cpp
|
||||
utility/sonargraph/SonargraphXsdRootPath.h
|
||||
utility/sonargraph/SonargraphXsdRootPathWithFiles.cpp
|
||||
utility/sonargraph/SonargraphXsdRootPathWithFiles.h
|
||||
utility/sonargraph/SonargraphXsdSourceRootPath.cpp
|
||||
utility/sonargraph/SonargraphXsdSourceRootPath.h
|
||||
utility/sonargraph/utilitySonargraph.cpp
|
||||
utility/sonargraph/utilitySonargraph.h
|
||||
|
||||
utility/text/TextAccess.cpp
|
||||
utility/text/TextAccess.h
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
@@ -67,8 +65,6 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return LANGUAGE_PYTHON;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "logging.h"
|
||||
#include "utilityFile.h"
|
||||
@@ -188,9 +186,6 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxSonargraph>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaEmpty>(id, this);
|
||||
break;
|
||||
@@ -200,9 +195,6 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaGradle>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaSonargraph>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsPythonEmpty>(id, this);
|
||||
break;
|
||||
|
||||
@@ -12,8 +12,6 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
return "C/C++ from Compilation Database";
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return "C/C++ from Code::Blocks";
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "C/C++ from Sonargraph";
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
return "C/C++ from Visual Studio";
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
@@ -22,8 +20,6 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
return "Java Source Group from Maven";
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
return "Java Source Group from Gradle";
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return "Java from Sonargraph";
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return "Python Source Group";
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
@@ -46,8 +42,6 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
return "C/C++ from Compilation Database";
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return "C/C++ from Code::Blocks";
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "C/C++ from Sonargraph";
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
return "C/C++ from Visual Studio";
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
@@ -56,8 +50,6 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
return "Java Source Group from Maven";
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
return "Java Source Group from Gradle";
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return "Java from Sonargraph";
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return "Empty Python Source Group";
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
@@ -86,10 +78,6 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_CXX_CODEBLOCKS;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_SONARGRAPH))
|
||||
{
|
||||
return SOURCE_GROUP_CXX_SONARGRAPH;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_VS))
|
||||
{
|
||||
return SOURCE_GROUP_CXX_VS;
|
||||
@@ -106,10 +94,6 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_JAVA_GRADLE;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_SONARGRAPH))
|
||||
{
|
||||
return SOURCE_GROUP_JAVA_SONARGRAPH;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_PYTHON_EMPTY))
|
||||
{
|
||||
return SOURCE_GROUP_PYTHON_EMPTY;
|
||||
|
||||
@@ -9,12 +9,10 @@ enum SourceGroupType
|
||||
SOURCE_GROUP_CPP_EMPTY,
|
||||
SOURCE_GROUP_CXX_CDB,
|
||||
SOURCE_GROUP_CXX_CODEBLOCKS,
|
||||
SOURCE_GROUP_CXX_SONARGRAPH,
|
||||
SOURCE_GROUP_CXX_VS,
|
||||
SOURCE_GROUP_JAVA_EMPTY,
|
||||
SOURCE_GROUP_JAVA_MAVEN,
|
||||
SOURCE_GROUP_JAVA_GRADLE,
|
||||
SOURCE_GROUP_JAVA_SONARGRAPH,
|
||||
SOURCE_GROUP_PYTHON_EMPTY,
|
||||
SOURCE_GROUP_CUSTOM_COMMAND,
|
||||
SOURCE_GROUP_UNKNOWN
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
#include "ProjectSettings.h"
|
||||
#include "utilityFile.h"
|
||||
|
||||
FilePath SourceGroupSettingsWithSonargraphProjectPath::getSonargraphProjectPath() const
|
||||
{
|
||||
return m_sonargraphProjectPath;
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsWithSonargraphProjectPath::getSonargraphProjectPathExpandedAndAbsolute() const
|
||||
{
|
||||
return utility::getExpandedAndAbsolutePath(getSonargraphProjectPath(), getProjectSettings()->getProjectDirectoryPath());
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSonargraphProjectPath::setSonargraphProjectPath(const FilePath& sonargraphProjectPath)
|
||||
{
|
||||
m_sonargraphProjectPath = sonargraphProjectPath;
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithSonargraphProjectPath::equals(const SourceGroupSettingsBase* other) const
|
||||
{
|
||||
const SourceGroupSettingsWithSonargraphProjectPath* otherPtr =
|
||||
dynamic_cast<const SourceGroupSettingsWithSonargraphProjectPath*>(other);
|
||||
|
||||
return (
|
||||
otherPtr &&
|
||||
m_sonargraphProjectPath == otherPtr->m_sonargraphProjectPath
|
||||
);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSonargraphProjectPath::load(const ConfigManager* config, const std::string& key)
|
||||
{
|
||||
setSonargraphProjectPath(config->getValueOrDefault(key + "/sonargraph_project_path", FilePath(L"")));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSonargraphProjectPath::save(ConfigManager* config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/sonargraph_project_path", getSonargraphProjectPath().wstr());
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "SourceGroupSettingsComponent.h"
|
||||
|
||||
class SourceGroupSettingsWithSonargraphProjectPath
|
||||
: public SourceGroupSettingsComponent
|
||||
{
|
||||
public:
|
||||
virtual ~SourceGroupSettingsWithSonargraphProjectPath() = default;
|
||||
|
||||
FilePath getSonargraphProjectPath() const;
|
||||
FilePath getSonargraphProjectPathExpandedAndAbsolute() const;
|
||||
void setSonargraphProjectPath(const FilePath& sonargraphProjectPath);
|
||||
|
||||
protected:
|
||||
bool equals(const SourceGroupSettingsBase* other) const override;
|
||||
|
||||
void load(const ConfigManager* config, const std::string& key) override;
|
||||
void save(ConfigManager* config, const std::string& key) override;
|
||||
|
||||
private:
|
||||
FilePath m_sonargraphProjectPath;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
|
||||
#include "SourceGroupSettingsWithComponents.h"
|
||||
#include "SourceGroupSettingsWithCppStandard.h"
|
||||
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
|
||||
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsCxxSonargraph
|
||||
: public SourceGroupSettingsWithComponents<
|
||||
SourceGroupSettingsWithCppStandard,
|
||||
SourceGroupSettingsWithCxxPathsAndFlags,
|
||||
SourceGroupSettingsWithIndexedHeaderPaths,
|
||||
SourceGroupSettingsWithSonargraphProjectPath>
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCxxSonargraph(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CXX_SONARGRAPH, id, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> createCopy() const override
|
||||
{
|
||||
return std::make_shared<SourceGroupSettingsCxxSonargraph>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
|
||||
#define SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
|
||||
|
||||
#include "SourceGroupSettingsWithComponents.h"
|
||||
#include "SourceGroupSettingsWithClasspath.h"
|
||||
#include "SourceGroupSettingsWithJavaStandard.h"
|
||||
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsJavaSonargraph
|
||||
: public SourceGroupSettingsWithComponents<
|
||||
SourceGroupSettingsWithClasspath,
|
||||
SourceGroupSettingsWithJavaStandard,
|
||||
SourceGroupSettingsWithSonargraphProjectPath>
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsJavaSonargraph(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsWithComponents(SOURCE_GROUP_JAVA_SONARGRAPH, id, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> createCopy() const override
|
||||
{
|
||||
return std::make_shared<SourceGroupSettingsJavaSonargraph>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
|
||||
@@ -1,79 +0,0 @@
|
||||
#include "SonargraphProject.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
#include "logging.h"
|
||||
#include "TextAccess.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::shared_ptr<Project> Project::load(const FilePath& projectFilePath, LanguageType targetLanguage)
|
||||
{
|
||||
return load(TextAccess::createFromFile(projectFilePath), targetLanguage);
|
||||
}
|
||||
|
||||
std::shared_ptr<Project> Project::load(std::shared_ptr<TextAccess> xmlAccess, LanguageType targetLanguage)
|
||||
{
|
||||
if (!xmlAccess)
|
||||
{
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Project> project = std::shared_ptr<Project>(new Project());
|
||||
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(xmlAccess->getText().c_str(), 0, TIXML_ENCODING_UTF8);
|
||||
if (doc.Error())
|
||||
{
|
||||
LOG_ERROR(
|
||||
"Unable to parse Sonargraph project because of an error in row " + std::to_string(doc.ErrorRow()) + ", col " +
|
||||
std::to_string(doc.ErrorCol()) + ": " + std::string(doc.ErrorDesc())
|
||||
);
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
TiXmlHandle docHandle(&doc);
|
||||
TiXmlElement* softwareSystemElement = docHandle.FirstChildElement("ns2:softwareSystem").ToElement();
|
||||
if (softwareSystemElement == nullptr)
|
||||
{
|
||||
LOG_ERROR("Unable to find \"ns2:softwareSystem\" in Sonargraph project.");
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
std::shared_ptr<SoftwareSystem> softwareSystem = SoftwareSystem::create(
|
||||
softwareSystemElement, xmlAccess->getFilePath().getParentDirectory().getParentDirectory(), targetLanguage
|
||||
);
|
||||
if (!softwareSystem)
|
||||
{
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
project->m_softwareSystem = softwareSystem;
|
||||
return project;
|
||||
}
|
||||
|
||||
int Project::getLoadedModuleCount() const
|
||||
{
|
||||
return m_softwareSystem->getModules().size();
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
return m_softwareSystem->getAllSourceFilePathsCanonical();
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
return m_softwareSystem->getAllCxxHeaderSearchPathsCanonical();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> Project::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
return m_softwareSystem->getIndexerCommands(sourceGroupSettings, appSettings);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#ifndef SONARGRAPH_PROJECT_H
|
||||
#define SONARGRAPH_PROJECT_H
|
||||
|
||||
#include <set>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "LanguageType.h"
|
||||
|
||||
// xsdCppModule
|
||||
// xsdCppManualModule -> basePathForIncludes(0, n), sourceFileExtensions(0, n), moduleCompilerOptions(0, n)
|
||||
// xsdCmakeJsonModule -> rootPathWithFiles(0, n)
|
||||
// xsdCppMakefileModule -> makefile(1), additionalCompilerOptions(0, 1)
|
||||
// xsdCppVsProjectFileModule -> projectFile(1,1)
|
||||
// xsdCppCaptureModule -> captureFile(1,1)
|
||||
|
||||
class ApplicationSettings;
|
||||
class FilePath;
|
||||
class IndexerCommand;
|
||||
class SourceGroupSettings;
|
||||
class TextAccess;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class SoftwareSystem;
|
||||
|
||||
class Project
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Project> load(const FilePath& projectFilePath, LanguageType targetLanguage);
|
||||
static std::shared_ptr<Project> load(std::shared_ptr<TextAccess> xmlAccess, LanguageType targetLanguage);
|
||||
|
||||
int getLoadedModuleCount() const;
|
||||
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const;
|
||||
|
||||
private:
|
||||
Project() = default;
|
||||
|
||||
std::shared_ptr<SoftwareSystem> m_softwareSystem;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_PROJECT_H
|
||||
@@ -1,200 +0,0 @@
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "IndexerCommand.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::shared_ptr<SoftwareSystem> SoftwareSystem::create(const TiXmlElement* element, const FilePath& baseDirectory, LanguageType targetLanguage)
|
||||
{
|
||||
std::shared_ptr<SoftwareSystem> softwareSystem = std::shared_ptr<SoftwareSystem>(new SoftwareSystem());
|
||||
if (softwareSystem->init(element, baseDirectory, targetLanguage))
|
||||
{
|
||||
return softwareSystem;
|
||||
}
|
||||
return std::shared_ptr<SoftwareSystem>();
|
||||
}
|
||||
|
||||
std::wstring SoftwareSystem::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
std::string SoftwareSystem::getVersion() const
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
std::wstring SoftwareSystem::getDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> SoftwareSystem::getExcludeFilters() const
|
||||
{
|
||||
return m_excludeFilters;
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> SoftwareSystem::getIncludeFilters() const
|
||||
{
|
||||
return m_includeFilters;
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<XsdAbstractModule>> SoftwareSystem::getModules() const
|
||||
{
|
||||
return m_modules;
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<XsdAbstractSystemExtension>> SoftwareSystem::getSystemExtensions() const
|
||||
{
|
||||
return m_systemExtensions;
|
||||
}
|
||||
|
||||
FilePath SoftwareSystem::getBaseDirectory() const
|
||||
{
|
||||
return m_baseDirectory;
|
||||
}
|
||||
|
||||
std::set<FilePath> SoftwareSystem::getAllSourcePaths() const
|
||||
{
|
||||
std::set<FilePath> sourcePaths;
|
||||
for (std::shared_ptr<XsdAbstractModule> module : m_modules)
|
||||
{
|
||||
utility::append(sourcePaths, module->getAllSourcePaths());
|
||||
}
|
||||
return sourcePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SoftwareSystem::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
for (std::shared_ptr<XsdAbstractModule> module : m_modules)
|
||||
{
|
||||
utility::append(sourceFilePaths, module->getAllSourceFilePathsCanonical());
|
||||
}
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SoftwareSystem::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
for (std::shared_ptr<XsdAbstractModule> module : m_modules)
|
||||
{
|
||||
utility::append(sourceFilePaths, module->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SoftwareSystem::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (std::shared_ptr<XsdAbstractModule> module : m_modules)
|
||||
{
|
||||
utility::append(indexerCommands, module->getIndexerCommands(sourceGroupSettings, appSettings));
|
||||
}
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
bool SoftwareSystem::init(const TiXmlElement* element, const FilePath& baseDirectory, LanguageType targetLanguage)
|
||||
{
|
||||
m_baseDirectory = baseDirectory;
|
||||
if (element != nullptr)
|
||||
{
|
||||
{
|
||||
const char* value = element->Attribute("name");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_name = utility::decodeFromUtf8(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("Unable to parse \"name\" attribute of Sonargraph softwareSystem.");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const char* value = element->Attribute("version");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_version = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to parse \"version\" attribute of Sonargraph softwareSystem.");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* descriptionElement = element->FirstChildElement("description");
|
||||
if (descriptionElement != nullptr)
|
||||
{
|
||||
const char* text = descriptionElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_description = utility::decodeFromUtf8(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* excludeElement : utility::getXmlChildElementsWithName(element, "exclude"))
|
||||
{
|
||||
const char* text = excludeElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_excludeFilters.push_back(FilePathFilter(utility::decodeFromUtf8(text)));
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* includeElement : utility::getXmlChildElementsWithName(element, "include"))
|
||||
{
|
||||
const char* text = includeElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_includeFilters.push_back(FilePathFilter(utility::decodeFromUtf8(text)));
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* moduleElement : utility::getXmlChildElementsWithName(element, "module"))
|
||||
{
|
||||
if (std::shared_ptr<XsdAbstractModule> module = XsdAbstractModule::create(moduleElement, shared_from_this()))
|
||||
{
|
||||
if (module->getSupportedLanguage() == targetLanguage)
|
||||
{
|
||||
m_modules.push_back(module);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO(L"Discarding Sonargraph module \"" + module->getName() + L"\" because it does not match the Sourcetrail project's language type.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"module\" element of Sonargraph softwareSystem.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* systemExtensionElement : utility::getXmlChildElementsWithName(element, "systemExtension"))
|
||||
{
|
||||
if (std::shared_ptr<XsdAbstractSystemExtension> systemExtension = XsdAbstractSystemExtension::create(systemExtensionElement))
|
||||
{
|
||||
m_systemExtensions.push_back(systemExtension);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"systemExtension\" element of Sonargraph softwareSystem.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
#ifndef SONARGRAPH_SOFTWARE_SYSTEM_H
|
||||
#define SONARGRAPH_SOFTWARE_SYSTEM_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "FilePathFilter.h"
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
#include "SonargraphXsdAbstractSystemExtension.h"
|
||||
|
||||
class ApplicationSettings;
|
||||
class IndexerCommand;
|
||||
class SourceGroupSettings;
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class SoftwareSystem : public std::enable_shared_from_this<SoftwareSystem>
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<SoftwareSystem> create(const TiXmlElement* element, const FilePath& baseDirectory, LanguageType targetLanguage);
|
||||
|
||||
std::wstring getName() const;
|
||||
std::string getVersion() const;
|
||||
std::wstring getDescription() const;
|
||||
std::vector<FilePathFilter> getExcludeFilters() const;
|
||||
std::vector<FilePathFilter> getIncludeFilters() const;
|
||||
const std::vector<std::shared_ptr<XsdAbstractModule>> getModules() const;
|
||||
const std::vector<std::shared_ptr<XsdAbstractSystemExtension>> getSystemExtensions() const;
|
||||
|
||||
FilePath getBaseDirectory() const;
|
||||
std::set<FilePath> getAllSourcePaths() const;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const;
|
||||
|
||||
template <typename ExtensionType>
|
||||
std::vector<std::shared_ptr<ExtensionType>> getSpecificSystemExtensions() const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const;
|
||||
|
||||
protected:
|
||||
SoftwareSystem() = default;
|
||||
bool init(const TiXmlElement* element, const FilePath& baseDirectory, LanguageType targetLanguage);
|
||||
|
||||
FilePath m_baseDirectory;
|
||||
|
||||
std::wstring m_name;
|
||||
std::string m_version;
|
||||
std::wstring m_description;
|
||||
|
||||
std::vector<FilePathFilter> m_excludeFilters;
|
||||
std::vector<FilePathFilter> m_includeFilters;
|
||||
std::vector<std::shared_ptr<XsdAbstractModule>> m_modules;
|
||||
std::vector<std::shared_ptr<XsdAbstractSystemExtension>> m_systemExtensions;
|
||||
};
|
||||
|
||||
template <typename ExtensionType>
|
||||
std::vector<std::shared_ptr<ExtensionType>> SoftwareSystem::getSpecificSystemExtensions() const
|
||||
{
|
||||
std::vector<std::shared_ptr<ExtensionType>> systemExtensions;
|
||||
for (std::shared_ptr<XsdAbstractSystemExtension> systemExtension : getSystemExtensions())
|
||||
{
|
||||
if (std::shared_ptr<ExtensionType> castSystemExtension = std::dynamic_pointer_cast<ExtensionType>(systemExtension))
|
||||
{
|
||||
systemExtensions.push_back(castSystemExtension);
|
||||
}
|
||||
}
|
||||
return systemExtensions;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_SOFTWARE_SYSTEM_H
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "SonargraphSourceRootPath.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "IndexerCommandJava.h"
|
||||
#include "logging.h"
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
#include "SonargraphXsdRootPathWithFiles.h"
|
||||
#include "utilitySonargraph.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string SourceRootPath::getXsdTypeName()
|
||||
{
|
||||
return "sourceRootPath";
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceRootPath> SourceRootPath::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<SourceRootPath> rootPath = std::shared_ptr<SourceRootPath>(new SourceRootPath());
|
||||
if (rootPath->init(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
}
|
||||
|
||||
return std::shared_ptr<SourceRootPath>();
|
||||
}
|
||||
|
||||
std::wstring SourceRootPath::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
FilePath SourceRootPath::getFilePath(const FilePath& baseDirectory) const
|
||||
{
|
||||
FilePath filePath(getName());
|
||||
if (filePath.isAbsolute())
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
return baseDirectory.getConcatenated(filePath);
|
||||
}
|
||||
|
||||
bool SourceRootPath::init(const TiXmlElement* element)
|
||||
{
|
||||
if (element != nullptr)
|
||||
{
|
||||
const char* value = element->Attribute("name");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_name = utility::decodeFromUtf8(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"name\" of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef SONARGRAPH_SOURCE_ROOT_PATH_H
|
||||
#define SONARGRAPH_SOURCE_ROOT_PATH_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class SourceRootPath
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<SourceRootPath> create(const TiXmlElement* element);
|
||||
|
||||
virtual ~SourceRootPath() = default;
|
||||
|
||||
std::wstring getName() const;
|
||||
|
||||
FilePath getFilePath(const FilePath& baseDirectory) const;
|
||||
|
||||
protected:
|
||||
SourceRootPath() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
|
||||
std::wstring m_name;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_SOURCE_ROOT_PATH_H
|
||||
@@ -1,153 +0,0 @@
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "logging.h"
|
||||
#include "SonargraphXsdCmakeJsonModule.h"
|
||||
#include "SonargraphXsdCppManualModule.h"
|
||||
#include "SonargraphXsdJavaModule.h"
|
||||
#include "SonargraphXsdRootPath.h"
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdAbstractModule::getXsdTypeName()
|
||||
{
|
||||
return "xsdAbstractModule";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdAbstractModule> XsdAbstractModule::create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (std::shared_ptr<XsdAbstractModule> module = XsdCmakeJsonModule::create(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
if (std::shared_ptr<XsdCppManualModule> module = XsdCppManualModule::create(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
if (std::shared_ptr<XsdJavaModule> module = XsdJavaModule::create(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
|
||||
return std::shared_ptr<XsdAbstractModule>();
|
||||
}
|
||||
|
||||
std::wstring XsdAbstractModule::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
std::wstring XsdAbstractModule::getDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> XsdAbstractModule::getExcludeFilters() const
|
||||
{
|
||||
return m_excludeFilters;
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> XsdAbstractModule::getIncludeFilters() const
|
||||
{
|
||||
return m_includeFilters;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<XsdRootPath>> XsdAbstractModule::getRootPaths() const
|
||||
{
|
||||
return m_rootPaths;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SoftwareSystem> XsdAbstractModule::getSoftwareSystem() const
|
||||
{
|
||||
return m_parent.lock();
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> XsdAbstractModule::getDerivedExcludeFilters() const
|
||||
{
|
||||
std::vector<FilePathFilter> excludeFilters = getExcludeFilters();
|
||||
if (std::shared_ptr<const SoftwareSystem> parent = getSoftwareSystem())
|
||||
{
|
||||
utility::append(excludeFilters, parent->getExcludeFilters());
|
||||
}
|
||||
return excludeFilters;
|
||||
}
|
||||
|
||||
std::vector<FilePathFilter> XsdAbstractModule::getDerivedIncludeFilters() const
|
||||
{
|
||||
std::vector<FilePathFilter> includeFilters = getIncludeFilters();
|
||||
if (std::shared_ptr<const SoftwareSystem> parent = getSoftwareSystem())
|
||||
{
|
||||
utility::append(includeFilters, parent->getIncludeFilters());
|
||||
}
|
||||
return includeFilters;
|
||||
}
|
||||
|
||||
bool XsdAbstractModule::init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
m_parent = parent;
|
||||
if (element != nullptr)
|
||||
{
|
||||
{
|
||||
const char* value = element->Attribute("name");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_name = utility::decodeFromUtf8(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to parse \"name\" attribute of Sonargraph " + getXsdTypeName() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* descriptionElement = element->FirstChildElement("description");
|
||||
if (descriptionElement != nullptr)
|
||||
{
|
||||
const char* text = descriptionElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_description = utility::decodeFromUtf8(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* excludeElement : utility::getXmlChildElementsWithName(element, "exclude"))
|
||||
{
|
||||
const char* text = excludeElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_excludeFilters.push_back(FilePathFilter(utility::decodeFromUtf8(text)));
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* includeElement : utility::getXmlChildElementsWithName(element, "include"))
|
||||
{
|
||||
const char* text = includeElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_includeFilters.push_back(FilePathFilter(utility::decodeFromUtf8(text)));
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* rootPathElement : utility::getXmlChildElementsWithName(element, "rootPath"))
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPath> rootPath = XsdRootPath::create(rootPathElement))
|
||||
{
|
||||
m_rootPaths.push_back(rootPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"rootPath\" element of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_ABSTRACT_MODULE_H
|
||||
#define SONARGRAPH_XSD_ABSTRACT_MODULE_H
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "LanguageType.h"
|
||||
#include "FilePathFilter.h"
|
||||
|
||||
class ApplicationSettings;
|
||||
class IndexerCommand;
|
||||
class SourceGroupSettings;
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdRootPath;
|
||||
class SoftwareSystem;
|
||||
|
||||
class XsdAbstractModule
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdAbstractModule> create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
virtual ~XsdAbstractModule() = default;
|
||||
|
||||
virtual LanguageType getSupportedLanguage() const = 0;
|
||||
|
||||
std::wstring getName() const;
|
||||
std::wstring getDescription() const;
|
||||
std::vector<FilePathFilter> getExcludeFilters() const;
|
||||
std::vector<FilePathFilter> getIncludeFilters() const;
|
||||
std::vector<std::shared_ptr<XsdRootPath>> getRootPaths() const;
|
||||
|
||||
virtual std::set<FilePath> getAllSourcePaths() const = 0;
|
||||
virtual std::set<FilePath> getAllSourceFilePathsCanonical() const = 0;
|
||||
virtual std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const = 0;
|
||||
|
||||
std::shared_ptr<const SoftwareSystem> getSoftwareSystem() const;
|
||||
std::vector<FilePathFilter> getDerivedExcludeFilters() const;
|
||||
std::vector<FilePathFilter> getDerivedIncludeFilters() const;
|
||||
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const = 0;
|
||||
|
||||
protected:
|
||||
XsdAbstractModule() = default;
|
||||
bool init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
std::weak_ptr<SoftwareSystem> m_parent;
|
||||
|
||||
std::wstring m_name;
|
||||
std::wstring m_description;
|
||||
std::vector<FilePathFilter> m_excludeFilters;
|
||||
std::vector<FilePathFilter> m_includeFilters;
|
||||
std::vector<std::shared_ptr<XsdRootPath>> m_rootPaths;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_ABSTRACT_MODULE_H
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "SonargraphXsdAbstractSystemExtension.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "logging.h"
|
||||
#include "SonargraphXsdCppSystemSettings.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdAbstractSystemExtension::getXsdTypeName()
|
||||
{
|
||||
return "xsdAbstractSystemExtension";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdAbstractSystemExtension> XsdAbstractSystemExtension::create(const TiXmlElement* element)
|
||||
{
|
||||
if (std::shared_ptr<XsdCppSystemSettings> systemExtension = XsdCppSystemSettings::create(element))
|
||||
{
|
||||
return systemExtension;
|
||||
}
|
||||
|
||||
return std::shared_ptr<XsdAbstractSystemExtension>();
|
||||
}
|
||||
|
||||
bool XsdAbstractSystemExtension::init(const TiXmlElement* element)
|
||||
{
|
||||
if (element != nullptr)
|
||||
{
|
||||
const char* value = element->Attribute("language");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_language = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to parse \"language\" attribute of Sonargraph " + getXsdTypeName() + ".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_ABSTRACT_SYSTEM_EXTENSION_H
|
||||
#define SONARGRAPH_XSD_ABSTRACT_SYSTEM_EXTENSION_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdAbstractSystemExtension
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdAbstractSystemExtension> create(const TiXmlElement* element);
|
||||
|
||||
virtual ~XsdAbstractSystemExtension() = default;
|
||||
|
||||
protected:
|
||||
XsdAbstractSystemExtension() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
|
||||
std::string m_language;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_ABSTRACT_SYSTEM_EXTENSION_H
|
||||
@@ -1,349 +0,0 @@
|
||||
#include "SonargraphXsdCmakeJsonModule.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "LanguageType.h"
|
||||
#include "SourceGroupSettings.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsWithCppStandard.h"
|
||||
#include "SourceGroupSettingsWithCStandard.h"
|
||||
#include "FileSystem.h"
|
||||
#include "logging.h"
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
#include "SonargraphXsdCppSystemSettings.h"
|
||||
#include "utilitySonargraph.h"
|
||||
#include "utility.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
#include "OrderedCache.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdCmakeJsonModule::getXsdTypeName()
|
||||
{
|
||||
return "xsdCmakeJsonModule";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdCmakeJsonModule> XsdCmakeJsonModule::create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdCmakeJsonModule> module = std::shared_ptr<XsdCmakeJsonModule>(new XsdCmakeJsonModule());
|
||||
if (module->init(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdCmakeJsonModule>();
|
||||
}
|
||||
|
||||
LanguageType XsdCmakeJsonModule::getSupportedLanguage() const
|
||||
{
|
||||
return LANGUAGE_CPP;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCmakeJsonModule::getAllSourcePaths() const
|
||||
{
|
||||
FilePath baseDirectory;
|
||||
if (std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem())
|
||||
{
|
||||
baseDirectory = softwareSystem->getBaseDirectory();
|
||||
}
|
||||
|
||||
std::set<FilePath> sourcePaths;
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
sourcePaths.insert(rootPath->getFilePath(baseDirectory));
|
||||
}
|
||||
|
||||
for (std::shared_ptr<XsdRootPathWithFiles> rootPath : m_rootPathWithFiles)
|
||||
{
|
||||
sourcePaths.insert(rootPath->getFilePath(baseDirectory));
|
||||
}
|
||||
|
||||
return sourcePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCmakeJsonModule::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
FilePath baseDir;
|
||||
if (std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem())
|
||||
{
|
||||
baseDir = softwareSystem->getBaseDirectory();
|
||||
}
|
||||
|
||||
const std::set<FilePathFilter> excludeFilters = utility::toSet(getDerivedExcludeFilters());
|
||||
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
||||
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : getIncludedSourceFilesForRootPath(rootPath, baseDir, excludeFilters, includeFilters))
|
||||
{
|
||||
sourceFilePaths.insert(sourceFile.getFilePath(baseDir.getConcatenated(rootPath->getName())));
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : m_rootPathWithFiles)
|
||||
{
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : getIncludedSourceFilesForRootPath(rootPath, baseDir, excludeFilters, includeFilters))
|
||||
{
|
||||
sourceFilePaths.insert(sourceFile.getFilePath(baseDir.getConcatenated(rootPath->getName())));
|
||||
}
|
||||
}
|
||||
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCmakeJsonModule::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
std::set<Id> usedCompilerOptionSetIds;
|
||||
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPathWithFiles = std::dynamic_pointer_cast<XsdRootPathWithFiles>(rootPath))
|
||||
{
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : rootPathWithFiles->getSourceFiles())
|
||||
{
|
||||
usedCompilerOptionSetIds.insert(sourceFile.compilerOptionSetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<XsdRootPathWithFiles> rootPath : m_rootPathWithFiles)
|
||||
{
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : rootPath->getSourceFiles())
|
||||
{
|
||||
usedCompilerOptionSetIds.insert(sourceFile.compilerOptionSetId);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem();
|
||||
if (!softwareSystem)
|
||||
{
|
||||
return std::set<FilePath>();
|
||||
}
|
||||
|
||||
std::set<std::wstring> usedCompilerOptions;
|
||||
for (Id compilerOptionSetId : usedCompilerOptionSetIds)
|
||||
{
|
||||
for (std::shared_ptr<const XsdCppSystemSettings> systemExtension :
|
||||
softwareSystem->getSpecificSystemExtensions<XsdCppSystemSettings>()
|
||||
)
|
||||
{
|
||||
if (systemExtension->hasCompilerOptionsForId(compilerOptionSetId))
|
||||
{
|
||||
utility::append(
|
||||
usedCompilerOptions,
|
||||
utility::toSet(systemExtension->getCompilerOptionsForId(compilerOptionSetId))
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that none of these prefixes is the prefix of a prefix that appears further down in the list
|
||||
const std::vector<std::wstring> optionPrefixes = {
|
||||
L"--include-directory=",
|
||||
L"--include-directory",
|
||||
L"-cxx-isystem",
|
||||
L"-iquote",
|
||||
L"-isystem-after",
|
||||
L"-isystem",
|
||||
L"-I"
|
||||
};
|
||||
|
||||
std::set<FilePath> headerSearchPaths;
|
||||
for (const std::wstring& compilerOption : usedCompilerOptions)
|
||||
{
|
||||
for (const std::wstring& optionPrefix : optionPrefixes)
|
||||
{
|
||||
if (utility::isPrefix(optionPrefix, compilerOption))
|
||||
{
|
||||
FilePath headerSearchPath(utility::trim(compilerOption.substr(optionPrefix.size())));
|
||||
if (headerSearchPath.isAbsolute())
|
||||
{
|
||||
headerSearchPaths.insert(headerSearchPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
headerSearchPaths.insert(softwareSystem->getBaseDirectory().getConcatenated(headerSearchPath));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return headerSearchPaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdCmakeJsonModule::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
std::wstring languageStandard = SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic();
|
||||
|
||||
if (std::shared_ptr<const SourceGroupSettingsCxxSonargraph> sonargraphSettings =
|
||||
std::dynamic_pointer_cast<const SourceGroupSettingsCxxSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
indexedHeaderPaths = utility::toSet(sonargraphSettings->getIndexedHeaderPathsExpandedAndAbsolute());
|
||||
languageStandard = sonargraphSettings->getCppStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(L"Source group doesn't specify language standard. Falling back to \"" + languageStandard + L"\".");
|
||||
LOG_ERROR(L"Source group doesn't specify any indexed header paths");
|
||||
}
|
||||
|
||||
std::vector<std::wstring> compilerFlags;
|
||||
compilerFlags.emplace_back(IndexerCommandCxx::getCompilerFlagLanguageStandard(languageStandard));
|
||||
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>()));
|
||||
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>()));
|
||||
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPathWithFiles = std::dynamic_pointer_cast<XsdRootPathWithFiles>(rootPath))
|
||||
{
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(
|
||||
rootPathWithFiles, indexedHeaderPaths, compilerFlags
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<XsdRootPathWithFiles> rootPath : m_rootPathWithFiles)
|
||||
{
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(
|
||||
rootPath, indexedHeaderPaths, compilerFlags
|
||||
));
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
bool XsdCmakeJsonModule::init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!XsdAbstractModule::init(element, parent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element != nullptr)
|
||||
{
|
||||
for (const TiXmlElement* rootPathWithFilesElement : utility::getXmlChildElementsWithName(element, "rootPathWithFiles"))
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPath = XsdRootPathWithFiles::create(rootPathWithFilesElement))
|
||||
{
|
||||
m_rootPathWithFiles.push_back(rootPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"rootPathWithFiles\" element of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<XsdRootPathWithFiles::SourceFile> XsdCmakeJsonModule::getIncludedSourceFilesForRootPath(
|
||||
std::shared_ptr<XsdRootPath> rootPath,
|
||||
const FilePath& baseDir,
|
||||
const std::set<FilePathFilter>& excludeFilters,
|
||||
const std::set<FilePathFilter>& includeFilters) const
|
||||
{
|
||||
std::vector<XsdRootPathWithFiles::SourceFile> sourceFiles;
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPathWithFiles = std::dynamic_pointer_cast<XsdRootPathWithFiles>(rootPath))
|
||||
{
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : rootPathWithFiles->getSourceFiles())
|
||||
{
|
||||
const FilePath sourceFilePath = sourceFile.getFilePath(baseDir).makeCanonical();
|
||||
|
||||
bool excludeMatches = false;
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (excludeMatches)
|
||||
{
|
||||
for (const FilePathFilter& includeFilter : includeFilters)
|
||||
{
|
||||
if (includeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!excludeMatches)
|
||||
{
|
||||
sourceFiles.push_back(sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sourceFiles;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdCmakeJsonModule::getIndexerCommandsForRootPath(
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath,
|
||||
const std::set<FilePath>& indexedHeaderPaths,
|
||||
const std::vector<std::wstring>& compilerFlags) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
if (rootPath)
|
||||
{
|
||||
std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem();
|
||||
if (!softwareSystem)
|
||||
{
|
||||
return std::vector<std::shared_ptr<IndexerCommand>>();
|
||||
}
|
||||
|
||||
const FilePath baseDir = rootPath->getFilePath(softwareSystem->getBaseDirectory());
|
||||
|
||||
const std::set<FilePathFilter> excludeFilters = utility::toSet(getDerivedExcludeFilters());
|
||||
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
||||
|
||||
OrderedCache<Id, std::vector<std::wstring>> compilerOptionCache([&](const Id& id) {
|
||||
if (std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem())
|
||||
{
|
||||
for (std::shared_ptr<const XsdCppSystemSettings> systemExtension : softwareSystem->getSpecificSystemExtensions<XsdCppSystemSettings>())
|
||||
{
|
||||
if (systemExtension->hasCompilerOptionsForId(id))
|
||||
{
|
||||
return utility::concat(systemExtension->getCompilerOptionsForId(id), compilerFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
return compilerFlags;
|
||||
});
|
||||
|
||||
for (const XsdRootPathWithFiles::SourceFile& sourceFile : getIncludedSourceFilesForRootPath(
|
||||
rootPath, baseDir, excludeFilters, includeFilters)
|
||||
)
|
||||
{
|
||||
const FilePath sourceFilePath = sourceFile.getFilePath(baseDir).makeCanonical();
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCxx>(
|
||||
sourceFilePath,
|
||||
utility::concat(indexedHeaderPaths, { sourceFilePath }),
|
||||
excludeFilters,
|
||||
includeFilters,
|
||||
softwareSystem->getBaseDirectory(),
|
||||
utility::concat(
|
||||
compilerOptionCache.getValue(sourceFile.compilerOptionSetId),
|
||||
sourceFilePath.wstr()
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
return indexerCommands;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_CMAKE_JSON_MODULE_H
|
||||
#define SONARGRAPH_XSD_CMAKE_JSON_MODULE_H
|
||||
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
#include "SonargraphXsdRootPathWithFiles.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdCmakeJsonModule : public XsdAbstractModule
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdCmakeJsonModule> create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
LanguageType getSupportedLanguage() const override;
|
||||
|
||||
std::set<FilePath> getAllSourcePaths() const override;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const override;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const override;
|
||||
|
||||
protected:
|
||||
XsdCmakeJsonModule() = default;
|
||||
bool init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
std::vector<XsdRootPathWithFiles::SourceFile> getIncludedSourceFilesForRootPath(
|
||||
std::shared_ptr<XsdRootPath> rootPath,
|
||||
const FilePath& baseDir,
|
||||
const std::set<FilePathFilter>& excludeFilters,
|
||||
const std::set<FilePathFilter>& includeFilters) const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommandsForRootPath(
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath,
|
||||
const std::set<FilePath>& indexedHeaderPaths,
|
||||
const std::vector<std::wstring>& compilerFlags) const;
|
||||
|
||||
std::vector<std::shared_ptr<XsdRootPathWithFiles>> m_rootPathWithFiles;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_CMAKE_JSON_MODULE_H
|
||||
@@ -1,296 +0,0 @@
|
||||
#include "SonargraphXsdCppManualModule.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "ApplicationSettings.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "FileSystem.h"
|
||||
#include "logging.h"
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "utility.h"
|
||||
#include "utilityFile.h"
|
||||
#include "utilitySonargraph.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdCppManualModule::getXsdTypeName()
|
||||
{
|
||||
return "xsdCppManualModule";
|
||||
}
|
||||
|
||||
std::vector<std::wstring> XsdCppManualModule::getIncludeOptionPrefixes()
|
||||
{
|
||||
// make sure that none of these prefixes is the prefix of a prefix that appears further down in the list
|
||||
return {
|
||||
L"-I",
|
||||
L"--include_directory=",
|
||||
L"--sys_include="
|
||||
};
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdCppManualModule> XsdCppManualModule::create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdCppManualModule> module = std::shared_ptr<XsdCppManualModule>(new XsdCppManualModule());
|
||||
if (module->init(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdCppManualModule>();
|
||||
}
|
||||
|
||||
LanguageType XsdCppManualModule::getSupportedLanguage() const
|
||||
{
|
||||
return LANGUAGE_CPP;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCppManualModule::getAllSourcePaths() const
|
||||
{
|
||||
FilePath baseDirectory;
|
||||
if (std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem())
|
||||
{
|
||||
baseDirectory = softwareSystem->getBaseDirectory();
|
||||
}
|
||||
|
||||
std::set<FilePath> sourcePaths;
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
sourcePaths.insert(rootPath->getFilePath(baseDirectory));
|
||||
}
|
||||
|
||||
return sourcePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCppManualModule::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
const std::vector<FilePathFilter> excludeFilters = getDerivedExcludeFilters();
|
||||
const std::vector<FilePathFilter> includeFilters = getDerivedIncludeFilters();
|
||||
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
|
||||
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(utility::getTopLevelPaths(getAllSourcePaths()), m_sourceFileExtensions))
|
||||
{
|
||||
const FilePath sourceFilePath = fileInfo.path.getCanonical();
|
||||
|
||||
bool excludeMatches = false;
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (excludeMatches)
|
||||
{
|
||||
for (const FilePathFilter& includeFilter : includeFilters)
|
||||
{
|
||||
if (includeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!excludeMatches)
|
||||
{
|
||||
sourceFilePaths.insert(sourceFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCppManualModule::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem();
|
||||
if (!softwareSystem)
|
||||
{
|
||||
return std::set<FilePath>();
|
||||
}
|
||||
|
||||
const std::vector<std::wstring> optionPrefixes = getIncludeOptionPrefixes();
|
||||
const FilePath baseDir = softwareSystem->getBaseDirectory();
|
||||
const FilePath baseIncludeDir = m_basePathForIncludes.isAbsolute() ? m_basePathForIncludes : baseDir.getConcatenated(m_basePathForIncludes);
|
||||
|
||||
std::set<FilePath> headerSearchPaths;
|
||||
for (const std::wstring& compilerOption : m_moduleCompilerOptions)
|
||||
{
|
||||
for (const std::wstring& optionPrefix : optionPrefixes)
|
||||
{
|
||||
if (utility::isPrefix(optionPrefix, compilerOption))
|
||||
{
|
||||
FilePath headerSearchPath(utility::trim(compilerOption.substr(optionPrefix.size())));
|
||||
if (headerSearchPath.isAbsolute())
|
||||
{
|
||||
headerSearchPaths.insert(headerSearchPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
headerSearchPaths.insert(baseIncludeDir.getConcatenated(headerSearchPath));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return headerSearchPaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdCppManualModule::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem();
|
||||
if (!softwareSystem)
|
||||
{
|
||||
return std::vector<std::shared_ptr<IndexerCommand>>();
|
||||
}
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
std::wstring languageStandard = SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic();
|
||||
|
||||
if (std::shared_ptr<const SourceGroupSettingsCxxSonargraph> sonargraphSettings =
|
||||
std::dynamic_pointer_cast<const SourceGroupSettingsCxxSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
indexedHeaderPaths = utility::toSet(sonargraphSettings->getIndexedHeaderPathsExpandedAndAbsolute());
|
||||
languageStandard = sonargraphSettings->getCppStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(L"Source group doesn't specify language standard. Falling back to \"" + languageStandard + L"\".");
|
||||
LOG_ERROR(L"Source group doesn't specify any indexed header paths");
|
||||
}
|
||||
|
||||
const std::set<FilePathFilter> excludeFilters = utility::toSet(getDerivedExcludeFilters());
|
||||
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
||||
|
||||
std::vector<std::wstring> compilerFlags;
|
||||
{
|
||||
const std::vector<std::wstring> optionPrefixes = getIncludeOptionPrefixes();
|
||||
const FilePath baseIncludeDir = m_basePathForIncludes.isAbsolute() ? m_basePathForIncludes : softwareSystem->getBaseDirectory().getConcatenated(m_basePathForIncludes);
|
||||
|
||||
for (const std::wstring& compilerOption : m_moduleCompilerOptions)
|
||||
{
|
||||
bool isIncludeOption = false;
|
||||
for (const std::wstring& optionPrefix : optionPrefixes)
|
||||
{
|
||||
if (utility::isPrefix(optionPrefix, compilerOption))
|
||||
{
|
||||
isIncludeOption = true;
|
||||
|
||||
compilerFlags.push_back(L"-isystem");
|
||||
|
||||
FilePath headerSearchPath(utility::trim(compilerOption.substr(optionPrefix.size())));
|
||||
if (headerSearchPath.isAbsolute())
|
||||
{
|
||||
compilerFlags.push_back(headerSearchPath.wstr());
|
||||
}
|
||||
else
|
||||
{
|
||||
compilerFlags.push_back(baseIncludeDir.getConcatenated(headerSearchPath).wstr());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isIncludeOption)
|
||||
{
|
||||
compilerFlags.push_back(compilerOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compilerFlags.emplace_back(IndexerCommandCxx::getCompilerFlagLanguageStandard(languageStandard));
|
||||
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>()));
|
||||
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>()));
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (const FilePath& sourceFilePath : getAllSourceFilePathsCanonical())
|
||||
{
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCxx>(
|
||||
sourceFilePath,
|
||||
utility::concat(indexedHeaderPaths, { sourceFilePath }),
|
||||
excludeFilters,
|
||||
includeFilters,
|
||||
softwareSystem->getBaseDirectory(),
|
||||
utility::concat(compilerFlags, sourceFilePath.wstr())
|
||||
));
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
XsdCppManualModule::XsdCppManualModule()
|
||||
: m_basePathForIncludes(L".")
|
||||
, m_sourceFileExtensions({L".cpp"})
|
||||
{
|
||||
}
|
||||
|
||||
bool XsdCppManualModule::init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!XsdAbstractModule::init(element, parent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element != nullptr)
|
||||
{
|
||||
|
||||
{
|
||||
const TiXmlElement* basePathForIncludesElement = element->FirstChildElement("basePathForIncludes");
|
||||
if (basePathForIncludesElement != nullptr)
|
||||
{
|
||||
const char* text = basePathForIncludesElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_basePathForIncludes = FilePath(utility::decodeFromUtf8(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"basePathForIncludes\" element of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
const TiXmlElement* sourceFileExtensionsElement = element->FirstChildElement("sourceFileExtensions");
|
||||
if (sourceFileExtensionsElement != nullptr)
|
||||
{
|
||||
const char* text = sourceFileExtensionsElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
m_sourceFileExtensions.clear();
|
||||
for (const std::wstring extension : utility::split<std::vector<std::wstring>>(utility::decodeFromUtf8(text), L","))
|
||||
{
|
||||
m_sourceFileExtensions.push_back(utility::trim(extension));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"sourceFileExtensions\" element of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* moduleCompilerOptionsElement : utility::getXmlChildElementsWithName(element, "moduleCompilerOptions"))
|
||||
{
|
||||
const char* text = moduleCompilerOptionsElement->GetText();
|
||||
if (text != nullptr)
|
||||
{
|
||||
for (const std::wstring& s : utility::splitToVector(utility::decodeFromUtf8(text), L' '))
|
||||
{
|
||||
m_moduleCompilerOptions.push_back(utility::trim(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_CPP_MANUAL_MODULE_H
|
||||
#define SONARGRAPH_XSD_CPP_MANUAL_MODULE_H
|
||||
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
#include "SonargraphXsdRootPathWithFiles.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdCppManualModule : public XsdAbstractModule
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::vector<std::wstring> getIncludeOptionPrefixes();
|
||||
static std::shared_ptr<XsdCppManualModule> create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
LanguageType getSupportedLanguage() const override;
|
||||
|
||||
std::set<FilePath> getAllSourcePaths() const override;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const override;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const override;
|
||||
|
||||
protected:
|
||||
XsdCppManualModule();
|
||||
bool init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
FilePath m_basePathForIncludes;
|
||||
std::vector<std::wstring> m_sourceFileExtensions;
|
||||
std::vector<std::wstring> m_moduleCompilerOptions;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_CPP_MANUAL_MODULE_H
|
||||
@@ -1,85 +0,0 @@
|
||||
#include "SonargraphXsdCppSystemSettings.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "utilitySonargraph.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdCppSystemSettings::getXsdTypeName()
|
||||
{
|
||||
return "xsdCppSystemSettings";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdCppSystemSettings> XsdCppSystemSettings::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdCppSystemSettings> systemExtension = std::shared_ptr<XsdCppSystemSettings>(new XsdCppSystemSettings());
|
||||
if (systemExtension->init(element))
|
||||
{
|
||||
return systemExtension;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdCppSystemSettings>();
|
||||
}
|
||||
|
||||
bool XsdCppSystemSettings::hasCompilerOptionsForId(Id id) const
|
||||
{
|
||||
return m_compilerOptionSets.find(id) != m_compilerOptionSets.end();
|
||||
}
|
||||
|
||||
std::vector<std::wstring> XsdCppSystemSettings::getCompilerOptionsForId(Id id) const
|
||||
{
|
||||
std::map<Id, std::vector<std::wstring>>::const_iterator it = m_compilerOptionSets.find(id);
|
||||
if (it != m_compilerOptionSets.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return std::vector<std::wstring>();
|
||||
}
|
||||
|
||||
bool XsdCppSystemSettings::init(const TiXmlElement* element)
|
||||
{
|
||||
XsdAbstractSystemExtension::init(element);
|
||||
|
||||
if (element != nullptr)
|
||||
{
|
||||
for (const TiXmlElement* compilerOptionSetElement : utility::getXmlChildElementsWithName(element, "compilerOptionSets"))
|
||||
{
|
||||
Id optionSetId = 0;
|
||||
{
|
||||
const char* value = compilerOptionSetElement->Attribute("id");
|
||||
if (value != nullptr && atoi(value) >= 0)
|
||||
{
|
||||
optionSetId = atoi(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"id\" attribute of compilerOptionSets of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const TiXmlElement* optionElement : utility::getXmlChildElementsWithName(compilerOptionSetElement, "option"))
|
||||
{
|
||||
const char* value = optionElement->GetText();
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_compilerOptionSets[optionSetId].push_back(utility::decodeFromUtf8(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"option\" attribute of compilerOptionSets of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_CPP_SYSTEM_SETTINGS_H
|
||||
#define SONARGRAPH_XSD_CPP_SYSTEM_SETTINGS_H
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "SonargraphXsdAbstractSystemExtension.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdCppSystemSettings : public XsdAbstractSystemExtension
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdCppSystemSettings> create(const TiXmlElement* element);
|
||||
|
||||
bool hasCompilerOptionsForId(Id id) const;
|
||||
std::vector<std::wstring> getCompilerOptionsForId(Id id) const;
|
||||
|
||||
protected:
|
||||
XsdCppSystemSettings() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
|
||||
private:
|
||||
std::map<Id, std::vector<std::wstring>> m_compilerOptionSets;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_CPP_SYSTEM_SETTINGS_H
|
||||
@@ -1,161 +0,0 @@
|
||||
#include "SonargraphXsdJavaModule.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "IndexerCommandJava.h"
|
||||
#include "LanguageType.h"
|
||||
#include "logging.h"
|
||||
#include "SonargraphSourceRootPath.h"
|
||||
#include "SonargraphSoftwareSystem.h"
|
||||
#include "SonargraphXsdRootPath.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "utility.h"
|
||||
#include "utilityFile.h"
|
||||
#include "utilitySonargraph.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdJavaModule::getXsdTypeName()
|
||||
{
|
||||
return "xsdJavaModule";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdJavaModule> XsdJavaModule::create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdJavaModule> module = std::shared_ptr<XsdJavaModule>(new XsdJavaModule());
|
||||
if (module->init(element, parent))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdJavaModule>();
|
||||
}
|
||||
|
||||
LanguageType XsdJavaModule::getSupportedLanguage() const
|
||||
{
|
||||
return LANGUAGE_JAVA;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdJavaModule::getAllSourcePaths() const
|
||||
{
|
||||
const FilePath baseDirectory = getSoftwareSystem() ? getSoftwareSystem()->getBaseDirectory() : FilePath();
|
||||
|
||||
std::set<FilePath> sourcePaths;
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
sourcePaths.insert(rootPath->getFilePath(baseDirectory));
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceRootPath> rootPath : m_sourceRootPaths)
|
||||
{
|
||||
sourcePaths.insert(rootPath->getFilePath(baseDirectory));
|
||||
}
|
||||
|
||||
return sourcePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdJavaModule::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
const std::vector<FilePathFilter> excludeFilters = getDerivedExcludeFilters();
|
||||
const std::vector<FilePathFilter> includeFilters = getDerivedIncludeFilters();
|
||||
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
|
||||
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(utility::getTopLevelPaths(getAllSourcePaths()), { L".java" }))
|
||||
{
|
||||
const FilePath sourceFilePath = fileInfo.path.getCanonical();
|
||||
|
||||
bool excludeMatches = false;
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (excludeMatches)
|
||||
{
|
||||
for (const FilePathFilter& includeFilter : includeFilters)
|
||||
{
|
||||
if (includeFilter.isMatching(sourceFilePath))
|
||||
{
|
||||
excludeMatches = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!excludeMatches)
|
||||
{
|
||||
sourceFilePaths.insert(sourceFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdJavaModule::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
return std::set<FilePath>();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdJavaModule::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
{
|
||||
std::wstring languageStandard = SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic();
|
||||
if (std::shared_ptr<const SourceGroupSettingsJavaSonargraph> settings =
|
||||
std::dynamic_pointer_cast<const SourceGroupSettingsJavaSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
languageStandard = settings->getJavaStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(L"Source group doesn't specify language standard. Falling back to \"" + languageStandard + L"\".");
|
||||
}
|
||||
|
||||
for (const FilePath& sourceFilePath : getAllSourceFilePathsCanonical())
|
||||
{
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandJava>(
|
||||
sourceFilePath,
|
||||
languageStandard,
|
||||
std::vector<FilePath>() // the classpath is set later... TODO: fix this hack
|
||||
));
|
||||
}
|
||||
}
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
bool XsdJavaModule::init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent)
|
||||
{
|
||||
if (!XsdAbstractModule::init(element, parent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element != nullptr)
|
||||
{
|
||||
for (const TiXmlElement* sourceRootPathElement : utility::getXmlChildElementsWithName(element, "sourceRootPath"))
|
||||
{
|
||||
if (std::shared_ptr<SourceRootPath> rootPath = SourceRootPath::create(sourceRootPathElement))
|
||||
{
|
||||
m_sourceRootPaths.push_back(rootPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"sourceRootPath\" element of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_JAVA_MODULE_H
|
||||
#define SONARGRAPH_XSD_JAVA_MODULE_H
|
||||
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class SourceRootPath;
|
||||
|
||||
class XsdJavaModule : public XsdAbstractModule
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdJavaModule> create(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
LanguageType getSupportedLanguage() const override;
|
||||
|
||||
std::set<FilePath> getAllSourcePaths() const override;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const override;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const override;
|
||||
|
||||
protected:
|
||||
XsdJavaModule() = default;
|
||||
bool init(const TiXmlElement* element, std::weak_ptr<SoftwareSystem> parent);
|
||||
|
||||
std::vector<std::shared_ptr<SourceRootPath>> m_sourceRootPaths;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_JAVA_MODULE_H
|
||||
@@ -1,77 +0,0 @@
|
||||
#include "SonargraphXsdRootPath.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "IndexerCommandJava.h"
|
||||
#include "logging.h"
|
||||
#include "SonargraphXsdAbstractModule.h"
|
||||
#include "SonargraphXsdRootPathWithFiles.h"
|
||||
#include "SonargraphXsdSourceRootPath.h"
|
||||
#include "utilitySonargraph.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdRootPath::getXsdTypeName()
|
||||
{
|
||||
return "xsdRootPath";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdRootPath> XsdRootPath::create(const TiXmlElement* element)
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPath = XsdRootPathWithFiles::create(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
if (std::shared_ptr<XsdSourceRootPath> rootPath = XsdSourceRootPath::create(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdRootPath> rootPath = std::shared_ptr<XsdRootPath>(new XsdRootPath());
|
||||
if (rootPath->init(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
}
|
||||
|
||||
return std::shared_ptr<XsdRootPath>();
|
||||
}
|
||||
|
||||
std::wstring XsdRootPath::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
FilePath XsdRootPath::getFilePath(const FilePath& baseDirectory) const
|
||||
{
|
||||
FilePath filePath(getName());
|
||||
if (filePath.isAbsolute())
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
return baseDirectory.getConcatenated(filePath);
|
||||
}
|
||||
|
||||
bool XsdRootPath::init(const TiXmlElement* element)
|
||||
{
|
||||
if (element != nullptr)
|
||||
{
|
||||
const char* value = element->Attribute("name");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_name = utility::decodeFromUtf8(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"name\" of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_ROOT_PATH_H
|
||||
#define SONARGRAPH_XSD_ROOT_PATH_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
class IndexerCommand;
|
||||
class SonargraphAbstractModule;
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdRootPath
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdRootPath> create(const TiXmlElement* element);
|
||||
|
||||
virtual ~XsdRootPath() = default;
|
||||
|
||||
std::wstring getName() const;
|
||||
|
||||
FilePath getFilePath(const FilePath& baseDirectory) const;
|
||||
|
||||
protected:
|
||||
XsdRootPath() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
|
||||
std::wstring m_name;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_ROOT_PATH_H
|
||||
@@ -1,112 +0,0 @@
|
||||
#include "SonargraphXsdRootPathWithFiles.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "utilitySonargraph.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
XsdRootPathWithFiles::SourceFile::SourceFile(std::wstring fileName, Id compilerOptionSetId)
|
||||
: fileName(fileName)
|
||||
, compilerOptionSetId(compilerOptionSetId)
|
||||
{
|
||||
}
|
||||
|
||||
FilePath XsdRootPathWithFiles::SourceFile::getFilePath(const FilePath& baseDirectory) const
|
||||
{
|
||||
FilePath filePath(fileName);
|
||||
if (filePath.isAbsolute())
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
return baseDirectory.getConcatenated(filePath).makeCanonical();
|
||||
}
|
||||
|
||||
|
||||
std::string XsdRootPathWithFiles::getXsdTypeName()
|
||||
{
|
||||
return "xsdRootPathWithFiles";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdRootPathWithFiles> XsdRootPathWithFiles::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath = std::shared_ptr<XsdRootPathWithFiles>(new XsdRootPathWithFiles());
|
||||
if (rootPath->init(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdRootPathWithFiles>();
|
||||
}
|
||||
|
||||
std::vector<XsdRootPathWithFiles::SourceFile> XsdRootPathWithFiles::getSourceFiles() const
|
||||
{
|
||||
return m_sourceFiles;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> XsdRootPathWithFiles::getExcludedDirectories() const
|
||||
{
|
||||
return m_excludedDirectories;
|
||||
}
|
||||
|
||||
bool XsdRootPathWithFiles::init(const TiXmlElement* element)
|
||||
{
|
||||
XsdRootPath::init(element);
|
||||
|
||||
if (element != nullptr)
|
||||
{
|
||||
for (const TiXmlElement* sourceFileElement : utility::getXmlChildElementsWithName(element, "sourceFile"))
|
||||
{
|
||||
std::wstring fileName;
|
||||
{
|
||||
const char* value = sourceFileElement->Attribute("fileName");
|
||||
if (value != nullptr)
|
||||
{
|
||||
fileName = utility::decodeFromUtf8(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"fileName\" attribute of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Id compilerOptionSetId;
|
||||
{
|
||||
int value;
|
||||
if (sourceFileElement->QueryIntAttribute("compilerOptionSetId", &value) == TIXML_SUCCESS && value >= 0)
|
||||
{
|
||||
compilerOptionSetId = Id(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"compilerOptionSetId\" attribute of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_sourceFiles.push_back(SourceFile(fileName, compilerOptionSetId));
|
||||
}
|
||||
for (const TiXmlElement* excludedDirectoryElement : utility::getXmlChildElementsWithName(element, "excludedDirectory"))
|
||||
{
|
||||
const char* value = excludedDirectoryElement->Attribute("dir");
|
||||
if (value != nullptr)
|
||||
{
|
||||
m_excludedDirectories.push_back(utility::decodeFromUtf8(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to parse \"dir\" attribute of Sonargraph " + getXsdTypeName() + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_ROOT_PATH_WITH_FILES_H
|
||||
#define SONARGRAPH_XSD_ROOT_PATH_WITH_FILES_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "SonargraphXsdRootPath.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdRootPathWithFiles : public XsdRootPath
|
||||
{
|
||||
public:
|
||||
struct SourceFile
|
||||
{
|
||||
SourceFile(std::wstring fileName, Id compilerOptionSetId);
|
||||
|
||||
FilePath getFilePath(const FilePath& baseDirectory) const;
|
||||
|
||||
std::wstring fileName;
|
||||
Id compilerOptionSetId;
|
||||
};
|
||||
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdRootPathWithFiles> create(const TiXmlElement* element);
|
||||
|
||||
std::vector<SourceFile> getSourceFiles() const;
|
||||
std::vector<std::wstring> getExcludedDirectories() const;
|
||||
|
||||
protected:
|
||||
XsdRootPathWithFiles() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
|
||||
std::vector<SourceFile> m_sourceFiles;
|
||||
std::vector<std::wstring> m_excludedDirectories;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_ROOT_PATH_WITH_FILES_H
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "SonargraphXsdSourceRootPath.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "utilitySonargraph.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityXml.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
std::string XsdSourceRootPath::getXsdTypeName()
|
||||
{
|
||||
return "xsdSourceRootPath";
|
||||
}
|
||||
|
||||
std::shared_ptr<XsdSourceRootPath> XsdSourceRootPath::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!utility::xmlElementHasAttribute(element, "xsi:type") || utility::sonargraphXmlElementIsType(element, getXsdTypeName()))
|
||||
{
|
||||
std::shared_ptr<XsdSourceRootPath> rootPath = std::shared_ptr<XsdSourceRootPath>(new XsdSourceRootPath());
|
||||
if (rootPath->init(element))
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
}
|
||||
return std::shared_ptr<XsdSourceRootPath>();
|
||||
}
|
||||
|
||||
bool XsdSourceRootPath::init(const TiXmlElement* element)
|
||||
{
|
||||
return XsdRootPath::init(element);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef SONARGRAPH_XSD_SOURCE_ROOT_PATH_H
|
||||
#define SONARGRAPH_XSD_SOURCE_ROOT_PATH_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "SonargraphXsdRootPath.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace Sonargraph
|
||||
{
|
||||
class XsdSourceRootPath : public XsdRootPath
|
||||
{
|
||||
public:
|
||||
static std::string getXsdTypeName();
|
||||
static std::shared_ptr<XsdSourceRootPath> create(const TiXmlElement* element);
|
||||
|
||||
protected:
|
||||
XsdSourceRootPath() = default;
|
||||
bool init(const TiXmlElement* element);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SONARGRAPH_XSD_SOURCE_ROOT_PATH_H
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "utilitySonargraph.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
bool sonargraphXmlElementIsType(const TiXmlElement *element, const std::string& typeName)
|
||||
{
|
||||
const char* value = element->Attribute("xsi:type");
|
||||
return (value != nullptr && value == "ns4:" + typeName);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef UTILITY_SONARGRAPH_H
|
||||
#define UTILITY_SONARGRAPH_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
namespace utility
|
||||
{
|
||||
bool sonargraphXmlElementIsType(const TiXmlElement *element, const std::string& typeName);
|
||||
}
|
||||
|
||||
#endif // UTILITY_SONARGRAPH_H
|
||||
@@ -88,8 +88,6 @@ add_files(
|
||||
project/SourceGroupCxxCodeblocks.h
|
||||
project/SourceGroupCxxEmpty.cpp
|
||||
project/SourceGroupCxxEmpty.h
|
||||
project/SourceGroupCxxSonargraph.cpp
|
||||
project/SourceGroupCxxSonargraph.h
|
||||
project/SourceGroupFactoryModuleCxx.cpp
|
||||
project/SourceGroupFactoryModuleCxx.h
|
||||
project/utilitySourceGroupCxx.cpp
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#include "SourceGroupCxxSonargraph.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "CxxIndexerCommandProvider.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SonargraphProject.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupCxxSonargraph::SourceGroupCxxSonargraph(std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupCxxSonargraph::prepareIndexing()
|
||||
{
|
||||
FilePath sonargraphProjectPath = m_settings->getSonargraphProjectPathExpandedAndAbsolute();
|
||||
if (!sonargraphProjectPath.empty() && !sonargraphProjectPath.exists())
|
||||
{
|
||||
std::wstring error = L"Can't refresh project. The referenced Sonargraph project does not exist anymore: "
|
||||
+ sonargraphProjectPath.wstr();
|
||||
MessageStatus(error, true).dispatch();
|
||||
Application::getInstance()->handleDialog(error, { L"Ok" });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCxxSonargraph::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()),
|
||||
std::vector<FilePathFilter>()
|
||||
);
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCxxSonargraph::getAllSourceFilePaths() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
{
|
||||
for (const FilePath& filePath : project->getAllSourceFilePathsCanonical())
|
||||
{
|
||||
if (filePath.exists())
|
||||
{
|
||||
sourceFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxSonargraph::getIndexerCommandProvider(const RefreshInfo& info) const
|
||||
{
|
||||
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
{
|
||||
for (std::shared_ptr<IndexerCommand> indexerCommand : project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()))
|
||||
{
|
||||
if (std::shared_ptr<IndexerCommandCxx> indexerCommandCxx = std::dynamic_pointer_cast<IndexerCommandCxx>(indexerCommand))
|
||||
{
|
||||
if (info.filesToIndex.find(indexerCommand->getSourceFilePath()) != info.filesToIndex.end())
|
||||
{
|
||||
provider->addCommand(indexerCommandCxx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxSonargraph::getIndexerCommands(const RefreshInfo& info) const
|
||||
{
|
||||
return getIndexerCommandProvider(info)->consumeAllCommands();
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupCxxSonargraph::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupCxxSonargraph::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef SOURCE_GROUP_CXX_SONARGRAPH_H
|
||||
#define SOURCE_GROUP_CXX_SONARGRAPH_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsCxxSonargraph;
|
||||
|
||||
class SourceGroupCxxSonargraph
|
||||
: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupCxxSonargraph(std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings);
|
||||
|
||||
bool prepareIndexing() override;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::set<FilePath> getAllSourceFilePaths() const override;
|
||||
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_CXX_SONARGRAPH_H
|
||||
@@ -3,12 +3,10 @@
|
||||
#include "SourceGroupCxxCdb.h"
|
||||
#include "SourceGroupCxxCodeblocks.h"
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
|
||||
bool SourceGroupFactoryModuleCxx::supports(SourceGroupType type) const
|
||||
{
|
||||
@@ -18,7 +16,6 @@ bool SourceGroupFactoryModuleCxx::supports(SourceGroupType type) const
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
@@ -45,9 +42,5 @@ std::shared_ptr<SourceGroup> SourceGroupFactoryModuleCxx::createSourceGroup(std:
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxEmpty(cxxSettings));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxSonargraph(cxxSettings));
|
||||
}
|
||||
return sourceGroup;
|
||||
}
|
||||
|
||||
@@ -154,8 +154,6 @@ add_files(
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathCxxPch.h
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.cpp
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.h
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathSonargraphProject.cpp
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathSonargraphProject.h
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathSourceGradle.cpp
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathSourceGradle.h
|
||||
qt/project_wizard/content/path/QtProjectWizardContentPathSourceMaven.cpp
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "QtProjectWizardContentPathCodeblocksProject.h"
|
||||
#include "QtProjectWizardContentPathCxxPch.h"
|
||||
#include "QtProjectWizardContentPathPythonEnvironment.h"
|
||||
#include "QtProjectWizardContentPathSonargraphProject.h"
|
||||
#include "QtProjectWizardContentPathSourceGradle.h"
|
||||
#include "QtProjectWizardContentPathSourceMaven.h"
|
||||
#include "QtProjectWizardContentPaths.h"
|
||||
@@ -46,11 +45,9 @@
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCdbVs.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "MessageLoadProject.h"
|
||||
#include "MessageStatus.h"
|
||||
@@ -279,45 +276,6 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph>> getSourceGroupWizardPages<SourceGroupSettingsCxxSonargraph>()
|
||||
{
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph>> pages;
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph> page("Sonargraph Project Path");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentCppStandard>(WIZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreator(
|
||||
WIZARD_CONTENT_CONTEXT_ALL,
|
||||
[](std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings, QtProjectWizardWindow* window)
|
||||
{
|
||||
return new QtProjectWizardContentPathSonargraphProject(settings, settings, settings, window);
|
||||
}
|
||||
);
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentPathsIndexedHeaders>(WIZARD_CONTENT_CONTEXT_ALL, std::string("Sonargraph project"));
|
||||
pages.push_back(page);
|
||||
}
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph> page("Include Paths");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentPathsHeaderSearch>(WIZARD_CONTENT_CONTEXT_SUMMARY, true);
|
||||
page.addContentCreatorSimple<QtProjectWizardContentPathsHeaderSearchGlobal>(WIZARD_CONTENT_CONTEXT_SUMMARY);
|
||||
pages.push_back(page);
|
||||
}
|
||||
if (utility::getOsType() == OS_MAC)
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph> page("Framework Search Paths");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentPathsFrameworkSearch>(WIZARD_CONTENT_CONTEXT_SUMMARY, true);
|
||||
page.addContentCreatorSimple<QtProjectWizardContentPathsFrameworkSearchGlobal>(WIZARD_CONTENT_CONTEXT_SUMMARY);
|
||||
pages.push_back(page);
|
||||
}
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsCxxSonargraph> page("Advanced (optional)");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentFlags>(WIZARD_CONTENT_CONTEXT_SUMMARY, true);
|
||||
pages.push_back(page);
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsCxxCdbVs>> getSourceGroupWizardPages<SourceGroupSettingsCxxCdbVs>()
|
||||
{
|
||||
@@ -352,7 +310,6 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsJavaEmpty>> getSourceGroupWizardPages<SourceGroupSettingsJavaEmpty>()
|
||||
{
|
||||
@@ -418,31 +375,6 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsJavaSonargraph>> getSourceGroupWizardPages<SourceGroupSettingsJavaSonargraph>()
|
||||
{
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsJavaSonargraph>> pages;
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsJavaSonargraph> page("Sonargraph Project Path");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentJavaStandard>(WIZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreator(
|
||||
WIZARD_CONTENT_CONTEXT_ALL,
|
||||
[](std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings, QtProjectWizardWindow* window)
|
||||
{
|
||||
return new QtProjectWizardContentPathSonargraphProject(settings, std::shared_ptr<SourceGroupSettingsCxxSonargraph>(), settings, window);
|
||||
}
|
||||
);
|
||||
pages.push_back(page);
|
||||
}
|
||||
{
|
||||
QtSourceGroupWizardPage<SourceGroupSettingsJavaSonargraph> page("Dependencies");
|
||||
page.addContentCreatorWithSettings<QtProjectWizardContentPathsClassJava>(WIZARD_CONTENT_CONTEXT_ALL);
|
||||
pages.push_back(page);
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizardPage<SourceGroupSettingsPythonEmpty>> getSourceGroupWizardPages<SourceGroupSettingsPythonEmpty>()
|
||||
@@ -874,10 +806,6 @@ void QtProjectWizard::selectedSourceGroupChanged(int index)
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCdbVs> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdbVs>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
@@ -894,10 +822,6 @@ void QtProjectWizard::selectedSourceGroupChanged(int index)
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
@@ -1107,13 +1031,6 @@ void QtProjectWizard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxCodeblocks>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::make_shared<SourceGroupSettingsCxxSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
addMsvcCompatibilityFlagsOnDemand(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdbVs> settings = std::make_shared<SourceGroupSettingsCxxCdbVs>(sourceGroupId, m_projectSettings.get());
|
||||
@@ -1138,12 +1055,6 @@ void QtProjectWizard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaGradle>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::make_shared<SourceGroupSettingsJavaSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::make_shared<SourceGroupSettingsPythonEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
|
||||
@@ -51,16 +51,13 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB, true));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_C_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB, true));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CPP_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_MAVEN));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_PYTHON].push_back(SourceGroupInfo(SOURCE_GROUP_PYTHON_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_CUSTOM].push_back(SourceGroupInfo(SOURCE_GROUP_CUSTOM_COMMAND));
|
||||
@@ -70,12 +67,10 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CPP_EMPTY] = L"empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_CDB] = L"cdb_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_VS] = L"vs_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_SONARGRAPH] = L"sonargraph_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_CODEBLOCKS] = L"cbp_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_EMPTY] = L"empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = L"mvn_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_GRADLE] = L"gradle_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_SONARGRAPH] = L"sonargraph_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_PYTHON_EMPTY] = L"empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CUSTOM_COMMAND] = L"empty_icon";
|
||||
|
||||
@@ -91,17 +86,12 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
"<p>Create a new Source Group from an existing Visual Studio Solution file.</p>"
|
||||
"<p><b>Note</b>: Requires a running Visual Studio instance with the "
|
||||
"<a href=\"https://sourcetrail.com/documentation/index.html#VisualStudio\">Sourcetrail Visual Studio Extension</a> installed.</p>";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_SONARGRAPH] =
|
||||
"<p>Create a new Source Group from an existing <a href=\"https://www.hello2morrow.com/products/sonargraph\">Sonargraph</a> "
|
||||
"project file.</p><p>Currently manual C/C++ Sonargraph modules are supported as well as Sonargraph modules that are based on CMake JSON Command files.</p>";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_CODEBLOCKS] =
|
||||
"<p>Create a new Source Group from an existing Code::Blocks project file.</p>"
|
||||
"<p><b>Note</b>: A \".cbp\" file will also get generated by the <b>Qt Creator</b> if a CMakeLists file is imported.</p>";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Source Group by defining which Java files will be indexed.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_SONARGRAPH] =
|
||||
"Create a new Source Group from an existing <a href=\"https://www.hello2morrow.com/products/sonargraph\">Sonargraph</a> project file.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_PYTHON_EMPTY] =
|
||||
"<p>Create a new Source Group by defining which Python files will be indexed. This Source Group type uses the "
|
||||
"<a href=\"https://github.com/CoatiSoftware/SourcetrailPythonIndexer\">SourcetrailPythonIndexer</a> " + pythonIndexerVersion + "in the "
|
||||
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
#include "QtProjectWizardContentPathSonargraphProject.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "QtProjectWizardContentPathsIndexedHeaders.h"
|
||||
#include "SonargraphProject.h"
|
||||
#include "SourceGroupCxxSonargraph.h"
|
||||
#include "SourceGroupJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
#include "utility.h"
|
||||
#include "utilityFile.h"
|
||||
|
||||
QtProjectWizardContentPathSonargraphProject::QtProjectWizardContentPathSonargraphProject(
|
||||
std::shared_ptr<SourceGroupSettings> settings,
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph,
|
||||
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settingsWithSonargraphProjectPath,
|
||||
QtProjectWizardWindow* window
|
||||
)
|
||||
: QtProjectWizardContentPath(window)
|
||||
, m_settings(settings)
|
||||
, m_settingsCxxSonargraph(settingsCxxSonargraph)
|
||||
, m_settingsWithSonargraphProjectPath(settingsWithSonargraphProjectPath)
|
||||
, m_filePaths([&]()
|
||||
{
|
||||
std::set<FilePath> allSourceFilePaths;
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupCxxSonargraph(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupJavaSonargraph(settings).getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
return utility::getAsRelativeIfShorter(
|
||||
utility::toVector(allSourceFilePaths),
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
)
|
||||
{
|
||||
setTitleString("Sonargraph Project (system.sonargraph)");
|
||||
setHelpString(
|
||||
"Select the Sonargraph file for the project. Sourcetrail will index your project based on the settings "
|
||||
"this file. It contains using all include paths and compiler flags required. The Sourcetrail project "
|
||||
"will stay up to date with changes in the Sonargraph project on every refresh.<br />"
|
||||
"<br />"
|
||||
"You can make use of environment variables with ${ENV_VAR}."
|
||||
);
|
||||
setFileEndings({ L".sonargraph" });
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPathSonargraphProject::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
QtProjectWizardContentPath::populate(layout, row);
|
||||
m_picker->setPickDirectory(false);
|
||||
m_picker->setFileFilter("Sonargraph Project (system.sonargraph)");
|
||||
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizardContentPathSonargraphProject::pickedPath);
|
||||
|
||||
QLabel* description = new QLabel(
|
||||
"Sourcetrail will use all settings from the Sonargraph project and stay up-to-date with changes on refresh.", this);
|
||||
description->setObjectName("description");
|
||||
description->setWordWrap(true);
|
||||
layout->addWidget(description, row, QtProjectWizardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
QLabel* title = createFormLabel("Source Files to Index");
|
||||
layout->addWidget(title, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->setRowStretch(row, 0);
|
||||
|
||||
m_fileCountLabel = new QLabel("");
|
||||
m_fileCountLabel->setWordWrap(true);
|
||||
layout->addWidget(m_fileCountLabel, row, QtProjectWizardWindow::BACK_COL, Qt::AlignTop);
|
||||
row++;
|
||||
|
||||
addFilesButton("show source files", layout, row);
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPathSonargraphProject::load()
|
||||
{
|
||||
m_picker->setText(QString::fromStdWString(m_settingsWithSonargraphProjectPath->getSonargraphProjectPath().wstr()));
|
||||
|
||||
m_filePaths.clear();
|
||||
|
||||
if (m_fileCountLabel)
|
||||
{
|
||||
m_fileCountLabel->setText("<b>" + QString::number(getFilePaths().size()) + "</b> source files were found in the Sonargraph project.");
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPathSonargraphProject::save()
|
||||
{
|
||||
m_settingsWithSonargraphProjectPath->setSonargraphProjectPath(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
|
||||
bool QtProjectWizardContentPathSonargraphProject::check()
|
||||
{
|
||||
if (!QtProjectWizardContentPath::check())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
|
||||
m_settingsWithSonargraphProjectPath->getSonargraphProjectPathExpandedAndAbsolute(), m_settings->getLanguage()
|
||||
))
|
||||
{
|
||||
if (sonargraphProject->getLoadedModuleCount() == 0)
|
||||
{
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromStdString(
|
||||
"The Sonargraph project file doesn't seem to contain any supported " +
|
||||
languageTypeToString(m_settings->getLanguage()) + " modules. Please " +
|
||||
"consider choosing another project file or removing this sourcegroup."
|
||||
));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
return msgBox.exec() == QMessageBox::Ok;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizardContentPathSonargraphProject::getFilePaths() const
|
||||
{
|
||||
return m_filePaths.getValue();
|
||||
}
|
||||
|
||||
QString QtProjectWizardContentPathSonargraphProject::getFileNamesTitle() const
|
||||
{
|
||||
return "Source Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizardContentPathSonargraphProject::getFileNamesDescription() const
|
||||
{
|
||||
return " source files will be indexed.";
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPathSonargraphProject::pickedPath()
|
||||
{
|
||||
m_window->saveContent();
|
||||
|
||||
if (m_settingsCxxSonargraph)
|
||||
{
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
for (const FilePath& path : QtProjectWizardContentPathsIndexedHeaders::getIndexedPathsDerivedFromSonargraphProject(m_settingsCxxSonargraph))
|
||||
{
|
||||
if (projectPath.contains(path))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getRelativeTo(projectPath)); // the relative path is always shorter than the absolute path
|
||||
}
|
||||
}
|
||||
m_settingsCxxSonargraph->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
|
||||
}
|
||||
m_window->loadContent();
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> QtProjectWizardContentPathSonargraphProject::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZARD_CONTENT_PATH_SONARGRAPH_PROJECT_H
|
||||
#define QT_PROJECT_WIZARD_CONTENT_PATH_SONARGRAPH_PROJECT_H
|
||||
|
||||
#include "QtProjectWizardContentPath.h"
|
||||
#include "SingleValueCache.h"
|
||||
|
||||
class SourceGroupSettingsCxxSonargraph;
|
||||
class SourceGroupSettingsWithSonargraphProjectPath;
|
||||
|
||||
class QtProjectWizardContentPathSonargraphProject
|
||||
: public QtProjectWizardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizardContentPathSonargraphProject(
|
||||
std::shared_ptr<SourceGroupSettings> settings,
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph,
|
||||
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settingsWithSonargraphProjectPath,
|
||||
QtProjectWizardWindow* window);
|
||||
|
||||
// QtProjectWizardContent implementation
|
||||
void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
void load() override;
|
||||
void save() override;
|
||||
bool check() override;
|
||||
|
||||
std::vector<FilePath> getFilePaths() const override;
|
||||
QString getFileNamesTitle() const override;
|
||||
QString getFileNamesDescription() const override;
|
||||
|
||||
private slots:
|
||||
void pickedPath();
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> m_settings;
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> m_settingsCxxSonargraph;
|
||||
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> m_settingsWithSonargraphProjectPath;
|
||||
QLabel* m_fileCountLabel;
|
||||
mutable SingleValueCache<std::vector<FilePath>> m_filePaths;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZARD_CONTENT_PATH_SONARGRAPH_PROJECT_H
|
||||
+2
-73
@@ -10,50 +10,11 @@
|
||||
#include "QtPathListDialog.h"
|
||||
#include "QtSelectPathsDialog.h"
|
||||
#include "QtTextEditDialog.h"
|
||||
#include "SonargraphProject.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "utility.h"
|
||||
#include "utilityFile.h"
|
||||
|
||||
std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPathsDerivedFromSonargraphProject(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings)
|
||||
{
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
{
|
||||
const FilePath sonargraphProjectPath = settings->getSonargraphProjectPathExpandedAndAbsolute();
|
||||
if (!sonargraphProjectPath.empty() && sonargraphProjectPath.exists())
|
||||
{
|
||||
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
|
||||
sonargraphProjectPath, settings->getLanguage()
|
||||
))
|
||||
{
|
||||
for (const FilePath& path : sonargraphProject->getAllSourceFilePathsCanonical())
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
utility::append(indexedHeaderPaths, sonargraphProject->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<FilePath> topLevelPaths;
|
||||
for (const FilePath& path : utility::getTopLevelPaths(indexedHeaderPaths))
|
||||
{
|
||||
if (path.exists())
|
||||
{
|
||||
topLevelPaths.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
return topLevelPaths;
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPathsDerivedFromCodeblocksProject(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings)
|
||||
{
|
||||
@@ -78,7 +39,7 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist.");
|
||||
LOG_WARNING("Unable to fetch indexed header paths. The provided Codeblocks project path does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,39 +173,7 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
|
||||
|
||||
if (!m_filesDialog)
|
||||
{
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
|
||||
{
|
||||
const FilePath sonargraphProjectPath = sonargraphSettings->getSonargraphProjectPathExpandedAndAbsolute();
|
||||
if (!sonargraphProjectPath.exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The provided Sonargraph project path does not exist.");
|
||||
msgBox.setDetailedText(QString::fromStdWString(sonargraphProjectPath.wstr()));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filesDialog = std::make_shared<QtSelectPathsDialog>(
|
||||
"Select from Include Paths",
|
||||
"The list contains all Include Paths found in the Sonargraph project. Red paths do not exist. Select the "
|
||||
"paths containing the header files you want to index with Sourcetrail.");
|
||||
m_filesDialog->setup();
|
||||
|
||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizardContentPathsIndexedHeaders::savedFilesDialog);
|
||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizardContentPathsIndexedHeaders::closedFilesDialog);
|
||||
|
||||
const FilePath projectPath = sonargraphSettings->getProjectDirectoryPath();
|
||||
|
||||
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
|
||||
utility::convert<FilePath, FilePath>(
|
||||
getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings),
|
||||
[&](const FilePath& path) { return utility::getAsRelativeIfShorter(path, projectPath); }
|
||||
),
|
||||
sonargraphSettings->getIndexedHeaderPaths(),
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
{
|
||||
const FilePath codeblocksProjectPath = codeblocksSettings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.exists())
|
||||
|
||||
-2
@@ -5,7 +5,6 @@
|
||||
|
||||
class SourceGroupSettingsCxxCdb;
|
||||
class SourceGroupSettingsCxxCodeblocks;
|
||||
class SourceGroupSettingsCxxSonargraph;
|
||||
|
||||
class QtProjectWizardContentPathsIndexedHeaders
|
||||
: public QtProjectWizardContentPaths
|
||||
@@ -13,7 +12,6 @@ class QtProjectWizardContentPathsIndexedHeaders
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromSonargraphProject(std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCodeblocksProject(std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCDB(std::shared_ptr<const SourceGroupSettingsCxxCdb> settings);
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ add_files(
|
||||
project/SourceGroupJavaGradle.h
|
||||
project/SourceGroupJavaMaven.cpp
|
||||
project/SourceGroupJavaMaven.h
|
||||
project/SourceGroupJavaSonargraph.cpp
|
||||
project/SourceGroupJavaSonargraph.h
|
||||
|
||||
utility/utilityJava.cpp
|
||||
utility/utilityJava.h
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "SourceGroupJavaGradle.h"
|
||||
#include "SourceGroupJavaMaven.h"
|
||||
#include "SourceGroupJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
|
||||
bool SourceGroupFactoryModuleJava::supports(SourceGroupType type) const
|
||||
{
|
||||
@@ -16,7 +14,6 @@ bool SourceGroupFactoryModuleJava::supports(SourceGroupType type) const
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
case SOURCE_GROUP_JAVA_MAVEN:
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
@@ -39,9 +36,5 @@ std::shared_ptr<SourceGroup> SourceGroupFactoryModuleJava::createSourceGroup(std
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupJavaMaven(javaSettings));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupJavaSonargraph(javaSettings));
|
||||
}
|
||||
return sourceGroup;
|
||||
}
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#include "SourceGroupJavaSonargraph.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "IndexerCommandJava.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "RefreshInfo.h"
|
||||
#include "SonargraphProject.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "utilityJava.h"
|
||||
|
||||
SourceGroupJavaSonargraph::SourceGroupJavaSonargraph(std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupJavaSonargraph::prepareIndexing()
|
||||
{
|
||||
if (!utility::prepareJavaEnvironmentAndDisplayOccurringErrors())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
FilePath sonargraphProjectPath = m_settings->getSonargraphProjectPathExpandedAndAbsolute();
|
||||
if (!sonargraphProjectPath.empty() && !sonargraphProjectPath.exists())
|
||||
{
|
||||
std::wstring error = L"Can't refresh project. The referenced Sonargraph project does not exist anymore: "
|
||||
+ sonargraphProjectPath.wstr();
|
||||
MessageStatus(error, true).dispatch();
|
||||
Application::getInstance()->handleDialog(error, { L"Ok" });
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupJavaSonargraph::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
std::set<FilePath> containedFilePaths;
|
||||
|
||||
const std::set<FilePath> indexedPaths = getAllSourceFilePaths();
|
||||
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupJavaSonargraph::getAllSourceFilePaths() const
|
||||
{
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
{
|
||||
// DONT CALL getIndexerCommands here because this would create an endless recursion due to hack...
|
||||
return project->getAllSourceFilePathsCanonical();
|
||||
}
|
||||
return std::set<FilePath>();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndexerCommands(const RefreshInfo& info) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
{
|
||||
for (std::shared_ptr<IndexerCommand> indexerCommand : project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()))
|
||||
{
|
||||
if (info.filesToIndex.find(indexerCommand->getSourceFilePath()) != info.filesToIndex.end())
|
||||
{
|
||||
indexerCommands.push_back(indexerCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!indexerCommands.empty())
|
||||
{
|
||||
// TODO: remove this hack once sourcegroup and sourcegroupsettings are merged
|
||||
const std::vector<FilePath> classPath = utility::getClassPath(
|
||||
m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths()
|
||||
);
|
||||
for (std::shared_ptr<IndexerCommand> indexerCommand : indexerCommands)
|
||||
{
|
||||
if (std::shared_ptr<IndexerCommandJava> javaIndexerCommand = std::dynamic_pointer_cast<IndexerCommandJava>(indexerCommand))
|
||||
{
|
||||
javaIndexerCommand->setClassPath(classPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupJavaSonargraph::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupJavaSonargraph::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef SOURCE_GROUP_JAVA_SONARGRAPH_H
|
||||
#define SOURCE_GROUP_JAVA_SONARGRAPH_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsJavaSonargraph;
|
||||
|
||||
class SourceGroupJavaSonargraph
|
||||
: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupJavaSonargraph(std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings);
|
||||
|
||||
bool prepareIndexing() override;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::set<FilePath> getAllSourceFilePaths() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsJavaSonargraph> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_JAVA_SONARGRAPH_H
|
||||
@@ -9,22 +9,18 @@
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupCxxCdb.h"
|
||||
#include "SourceGroupCxxCodeblocks.h"
|
||||
#include "SourceGroupCxxSonargraph.h"
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "SourceGroupJavaGradle.h"
|
||||
#include "SourceGroupJavaMaven.h"
|
||||
#include "SourceGroupJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "ProjectSettings.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "FileSystem.h"
|
||||
@@ -389,56 +385,6 @@ TEST_CASE("source group cxx cdb generates expected output")
|
||||
applicationSettings->setFrameworkSearchPaths(storedFrameworkSearchPaths);
|
||||
}
|
||||
|
||||
TEST_CASE("source group cxx sonargraph with cmake json modules generates expected output")
|
||||
{
|
||||
const std::wstring projectName = L"cxx_sonargraph_cmake_json";
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setIndexedHeaderPaths({ FilePath(L"test/indexed/header/path") });
|
||||
sourceGroupSettings->setSonargraphProjectPath(getInputDirectoryPath(projectName).concatenate(L"sonargraph/system.sonargraph"));
|
||||
|
||||
std::shared_ptr<ApplicationSettings> applicationSettings = ApplicationSettings::getInstance();
|
||||
|
||||
std::vector<FilePath> storedHeaderSearchPaths = applicationSettings->getHeaderSearchPaths();
|
||||
std::vector<FilePath> storedFrameworkSearchPaths = applicationSettings->getFrameworkSearchPaths();
|
||||
|
||||
applicationSettings->setHeaderSearchPaths({ FilePath(L"test/header/search/path") });
|
||||
applicationSettings->setFrameworkSearchPaths({ FilePath(L"test/framework/search/path") });
|
||||
|
||||
generateAndCompareExpectedOutput(projectName, std::make_shared<SourceGroupCxxSonargraph>(sourceGroupSettings));
|
||||
|
||||
applicationSettings->setHeaderSearchPaths(storedHeaderSearchPaths);
|
||||
applicationSettings->setFrameworkSearchPaths(storedFrameworkSearchPaths);
|
||||
}
|
||||
|
||||
TEST_CASE("source group cxx sonargraph with cpp manual modules generates expected output")
|
||||
{
|
||||
const std::wstring projectName = L"cxx_sonargraph_cpp_manual";
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setIndexedHeaderPaths({ FilePath(L"test/indexed/header/path") });
|
||||
sourceGroupSettings->setSonargraphProjectPath(getInputDirectoryPath(projectName).concatenate(L"/sonargraph/system.sonargraph"));
|
||||
|
||||
std::shared_ptr<ApplicationSettings> applicationSettings = ApplicationSettings::getInstance();
|
||||
|
||||
std::vector<FilePath> storedHeaderSearchPaths = applicationSettings->getHeaderSearchPaths();
|
||||
std::vector<FilePath> storedFrameworkSearchPaths = applicationSettings->getFrameworkSearchPaths();
|
||||
|
||||
applicationSettings->setHeaderSearchPaths({ FilePath(L"test/header/search/path") });
|
||||
applicationSettings->setFrameworkSearchPaths({ FilePath(L"test/framework/search/path") });
|
||||
|
||||
generateAndCompareExpectedOutput(projectName, std::make_shared<SourceGroupCxxSonargraph>(sourceGroupSettings));
|
||||
|
||||
applicationSettings->setHeaderSearchPaths(storedHeaderSearchPaths);
|
||||
applicationSettings->setFrameworkSearchPaths(storedFrameworkSearchPaths);
|
||||
}
|
||||
|
||||
TEST_CASE("sourcegroup java empty generates expected output")
|
||||
{
|
||||
const std::wstring projectName = L"java_empty";
|
||||
@@ -534,32 +480,6 @@ TEST_CASE("sourcegroup java maven generates expected output")
|
||||
applicationSettings->setJreSystemLibraryPaths(storedJreSystemLibraryPaths);
|
||||
}
|
||||
|
||||
TEST_CASE("sourcegroup java sonargraph with java modules generates expected output")
|
||||
{
|
||||
const std::wstring projectName = L"java_sonargraph";
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsJavaSonargraph> sourceGroupSettings =
|
||||
std::make_shared<SourceGroupSettingsJavaSonargraph>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setUseJreSystemLibrary(true);
|
||||
sourceGroupSettings->setClasspath({
|
||||
FilePath(L"test/classpath/file.jar"), FilePath(L"test/classpath/dir")
|
||||
});
|
||||
sourceGroupSettings->setSonargraphProjectPath(getInputDirectoryPath(projectName).concatenate(L"sonargraph/system.sonargraph"));
|
||||
|
||||
std::shared_ptr<ApplicationSettings> applicationSettings = ApplicationSettings::getInstance();
|
||||
|
||||
std::vector<FilePath> storedJreSystemLibraryPaths = applicationSettings->getJreSystemLibraryPaths();
|
||||
|
||||
applicationSettings->setJreSystemLibraryPaths({ FilePath(L"test/jre/system/library/path.jar") });
|
||||
|
||||
generateAndCompareExpectedOutput(projectName, std::make_shared<SourceGroupJavaSonargraph>(sourceGroupSettings));
|
||||
|
||||
applicationSettings->setJreSystemLibraryPaths(storedJreSystemLibraryPaths);
|
||||
}
|
||||
|
||||
TEST_CASE("source group custom command generates expected output")
|
||||
{
|
||||
const std::wstring projectName = L"custom_command";
|
||||
@@ -576,44 +496,6 @@ TEST_CASE("source group custom command generates expected output")
|
||||
generateAndCompareExpectedOutput(projectName, std::make_shared<SourceGroupCustomCommand>(sourceGroupSettings));
|
||||
}
|
||||
|
||||
// Special Tests
|
||||
|
||||
TEST_CASE("sourcegroup java sonargraph with cpp modules does not generate output")
|
||||
{
|
||||
const std::wstring projectName = L"cxx_sonargraph_cpp_manual";
|
||||
const FilePath sonargraphProjectFilePath(getInputDirectoryPath(projectName).concatenate(L"sonargraph/system.sonargraph"));
|
||||
|
||||
REQUIRE(sonargraphProjectFilePath.exists());
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsJavaSonargraph> sourceGroupSettings = std::make_shared<SourceGroupSettingsJavaSonargraph>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setSonargraphProjectPath(sonargraphProjectFilePath);
|
||||
|
||||
std::shared_ptr<TextAccess> output = generateExpectedOutput(projectName, std::make_shared<SourceGroupJavaSonargraph>(sourceGroupSettings));
|
||||
|
||||
REQUIRE(0 == output->getLineCount());
|
||||
}
|
||||
|
||||
TEST_CASE("sourcegroup cxx sonargraph with java modules does not generate output")
|
||||
{
|
||||
const std::wstring projectName = L"java_sonargraph";
|
||||
const FilePath sonargraphProjectFilePath(getInputDirectoryPath(projectName).concatenate(L"sonargraph/system.sonargraph"));
|
||||
|
||||
REQUIRE(sonargraphProjectFilePath.exists());
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setSonargraphProjectPath(sonargraphProjectFilePath);
|
||||
|
||||
std::shared_ptr<TextAccess> output = generateExpectedOutput(projectName, std::make_shared<SourceGroupCxxSonargraph>(sourceGroupSettings));
|
||||
|
||||
REQUIRE(0 == output->getLineCount());
|
||||
}
|
||||
|
||||
TEST_CASE("can destroy application instance")
|
||||
{
|
||||
Application::destroyInstance();
|
||||
|
||||
Reference in New Issue
Block a user