logic: Added "Empty Python" Sourcegroup to project setup
The respective release of the SourcetrailPythonIndexer project is automatically downloaded from GitHub when the setup script is executed.
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@
|
||||
#include "SourceGroupFactory.h"
|
||||
#include "SourceGroupFactoryModuleCxx.h"
|
||||
#include "SourceGroupFactoryModuleJava.h"
|
||||
#include "SourceGroupFactoryModulePython.h"
|
||||
#include "SourceGroupFactoryModuleCustom.h"
|
||||
#include "QtNetworkFactory.h"
|
||||
#include "QtApplication.h"
|
||||
@@ -46,7 +47,6 @@ void setupLogging()
|
||||
LogManager* logManager = LogManager::getInstance().get();
|
||||
|
||||
std::shared_ptr<ConsoleLogger> consoleLogger = std::make_shared<ConsoleLogger>();
|
||||
// consoleLogger->setLogLevel(Logger::LOG_WARNINGS | Logger::LOG_ERRORS);
|
||||
consoleLogger->setLogLevel(Logger::LOG_ALL);
|
||||
logManager->addLogger(consoleLogger);
|
||||
|
||||
@@ -186,10 +186,11 @@ void addLanguagePackages()
|
||||
{
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCxx>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleJava>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModulePython>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCustom>());
|
||||
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageJava>());
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageCxx>());
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageJava>());
|
||||
}
|
||||
|
||||
QCoreApplication* createApplication(int &argc, char *argv[], bool noGUI = false)
|
||||
|
||||
@@ -360,6 +360,8 @@ add_files(
|
||||
settings/SourceGroupSettingsJavaMaven.h
|
||||
settings/SourceGroupSettingsJavaSonargraph.cpp
|
||||
settings/SourceGroupSettingsJavaSonargraph.h
|
||||
settings/SourceGroupSettingsPythonEmpty.cpp
|
||||
settings/SourceGroupSettingsPythonEmpty.h
|
||||
settings/SourceGroupSettingsWithClasspath.cpp
|
||||
settings/SourceGroupSettingsWithClasspath.h
|
||||
settings/SourceGroupSettingsWithCppStandard.cpp
|
||||
|
||||
@@ -8,6 +8,8 @@ std::string indexerCommandTypeToString(IndexerCommandType type)
|
||||
return "indexer_command_cxx";
|
||||
case INDEXER_COMMAND_JAVA:
|
||||
return "indexer_command_java";
|
||||
case INDEXER_COMMAND_PYTHON:
|
||||
return "indexer_command_python";
|
||||
case INDEXER_COMMAND_CUSTOM:
|
||||
return "indexer_command_custom";
|
||||
default:
|
||||
@@ -20,6 +22,7 @@ IndexerCommandType stringToIndexerCommandType(const std::string& s)
|
||||
{
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_CXX)) return INDEXER_COMMAND_CXX;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_JAVA)) return INDEXER_COMMAND_JAVA;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_PYTHON)) return INDEXER_COMMAND_PYTHON;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_CUSTOM)) return INDEXER_COMMAND_CUSTOM;
|
||||
return INDEXER_COMMAND_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ enum IndexerCommandType
|
||||
INDEXER_COMMAND_UNKNOWN,
|
||||
INDEXER_COMMAND_CXX,
|
||||
INDEXER_COMMAND_JAVA,
|
||||
INDEXER_COMMAND_PYTHON,
|
||||
INDEXER_COMMAND_CUSTOM
|
||||
};
|
||||
|
||||
|
||||
@@ -499,7 +499,8 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
|
||||
{
|
||||
if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
|
||||
{
|
||||
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND)
|
||||
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND ||
|
||||
sourceGroup->getType() == SOURCE_GROUP_PYTHON_EMPTY)
|
||||
{
|
||||
customIndexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ std::string languageTypeToString(LanguageType t)
|
||||
return "C++";
|
||||
case LANGUAGE_JAVA:
|
||||
return "Java";
|
||||
case LANGUAGE_PYTHON:
|
||||
return "Python";
|
||||
case LANGUAGE_CUSTOM:
|
||||
return "Custom";
|
||||
case LANGUAGE_UNKNOWN:
|
||||
@@ -20,19 +22,23 @@ std::string languageTypeToString(LanguageType t)
|
||||
|
||||
LanguageType stringToLanguageType(std::string s)
|
||||
{
|
||||
if (s == "C")
|
||||
if (s == languageTypeToString(LANGUAGE_C))
|
||||
{
|
||||
return LANGUAGE_C;
|
||||
}
|
||||
else if (s == "C++")
|
||||
else if (s == languageTypeToString(LANGUAGE_CPP))
|
||||
{
|
||||
return LANGUAGE_CPP;
|
||||
}
|
||||
else if (s == "Java")
|
||||
else if (s == languageTypeToString(LANGUAGE_JAVA))
|
||||
{
|
||||
return LANGUAGE_JAVA;
|
||||
}
|
||||
else if (s == "Custom")
|
||||
else if (s == languageTypeToString(LANGUAGE_PYTHON))
|
||||
{
|
||||
return LANGUAGE_PYTHON;
|
||||
}
|
||||
else if (s == languageTypeToString(LANGUAGE_CUSTOM))
|
||||
{
|
||||
return LANGUAGE_CUSTOM;
|
||||
}
|
||||
@@ -63,6 +69,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return LANGUAGE_PYTHON;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return LANGUAGE_CUSTOM;
|
||||
default:
|
||||
|
||||
@@ -10,6 +10,7 @@ enum LanguageType
|
||||
LANGUAGE_CPP,
|
||||
LANGUAGE_C,
|
||||
LANGUAGE_JAVA,
|
||||
LANGUAGE_PYTHON,
|
||||
LANGUAGE_CUSTOM,
|
||||
LANGUAGE_UNKNOWN
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityUuid.h"
|
||||
@@ -196,6 +197,9 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
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;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
settings = std::make_shared<SourceGroupSettingsCustomCommand>(id, this);
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "FilePath.h"
|
||||
|
||||
SourceGroupSettingsPythonEmpty::SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettings(id, SOURCE_GROUP_PYTHON_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsPythonEmpty::createCopy() const
|
||||
{
|
||||
return std::make_shared<SourceGroupSettingsPythonEmpty>(*this);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsPythonEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsPythonEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(other);
|
||||
|
||||
return (
|
||||
otherJava &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherJava)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsPythonEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".py"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
|
||||
#include "SourceGroupSettings.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsPythonEmpty
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings);
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> createCopy() const override;
|
||||
|
||||
void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
@@ -24,6 +24,8 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
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:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
@@ -56,6 +58,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
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:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
@@ -106,6 +110,10 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_JAVA_SONARGRAPH;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_PYTHON_EMPTY))
|
||||
{
|
||||
return SOURCE_GROUP_PYTHON_EMPTY;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CUSTOM_COMMAND))
|
||||
{
|
||||
return SOURCE_GROUP_CUSTOM_COMMAND;
|
||||
|
||||
@@ -15,6 +15,7 @@ enum SourceGroupType
|
||||
SOURCE_GROUP_JAVA_MAVEN,
|
||||
SOURCE_GROUP_JAVA_GRADLE,
|
||||
SOURCE_GROUP_JAVA_SONARGRAPH,
|
||||
SOURCE_GROUP_PYTHON_EMPTY,
|
||||
SOURCE_GROUP_CUSTOM_COMMAND,
|
||||
SOURCE_GROUP_UNKNOWN
|
||||
};
|
||||
|
||||
@@ -32,6 +32,11 @@ FilePath ResourcePaths::getJavaPath()
|
||||
return AppPath::getAppPath().concatenate(L"data/java/");
|
||||
}
|
||||
|
||||
FilePath ResourcePaths::getPythonPath()
|
||||
{
|
||||
return AppPath::getAppPath().concatenate(L"data/python/");
|
||||
}
|
||||
|
||||
FilePath ResourcePaths::getCxxCompilerHeaderPath()
|
||||
{
|
||||
return AppPath::getAppPath().concatenate(L"data/cxx/include/").getCanonical();
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
static FilePath getFontsPath();
|
||||
static FilePath getGuiPath();
|
||||
static FilePath getJavaPath();
|
||||
static FilePath getPythonPath();
|
||||
static FilePath getCxxCompilerHeaderPath();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
|
||||
#include "CxxIndexerCommandProvider.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "CxxIndexerCommandProvider.h"
|
||||
#include "FileManager.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsWithCppStandard.h"
|
||||
#include "SourceGroupSettingsWithCStandard.h"
|
||||
#include "FileManager.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "MessageLoadProject.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "ResourcePaths.h"
|
||||
@@ -404,6 +405,22 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty>> getSourceGroupWizzardPages<SourceGroupSettingsPythonEmpty>()
|
||||
{
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty>> pages;
|
||||
{
|
||||
QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty> page("Indexed Paths", 750, 600);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsSource>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsExclude>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentExtensions>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
pages.push_back(page);
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsCustomCommand>> getSourceGroupWizzardPages<SourceGroupSettingsCustomCommand>()
|
||||
{
|
||||
@@ -656,7 +673,7 @@ void QtProjectWizzard::executeSourceGroupSetup(std::shared_ptr<SettingsType> set
|
||||
settings,
|
||||
std::bind(&QtProjectWizzard::cancelSourceGroup, this),
|
||||
std::bind(&QtProjectWizzard::createSourceGroup, this, std::placeholders::_1)
|
||||
);
|
||||
);
|
||||
|
||||
for (const QtSourceGroupWizzardPage<SettingsType>& page : getSourceGroupWizzardPages<SettingsType>())
|
||||
{
|
||||
@@ -842,6 +859,10 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
@@ -1100,6 +1121,12 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::make_shared<SourceGroupSettingsPythonEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
executeSourceGroupSetup<SourceGroupSettingsPythonEmpty>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::make_shared<SourceGroupSettingsCustomCommand>(sourceGroupId, m_projectSettings.get());
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "SourceGroupSettingsWithClasspath.h"
|
||||
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
@@ -261,6 +263,10 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
|
||||
{
|
||||
allSourceFilePaths = SourceGroupJavaEmpty(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupPythonEmpty(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupCustomCommand(settings).getAllSourceFilePaths();
|
||||
|
||||
@@ -47,6 +47,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
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));
|
||||
|
||||
// define which icons should be used for which kind of source group
|
||||
@@ -60,6 +61,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
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";
|
||||
|
||||
// define descriptions for each kind of Source Group
|
||||
@@ -85,6 +87,8 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
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] = "Create a new Sourcetrail Source Group by defining which Python files will be indexed. Note "
|
||||
"that this Source Group type uses the <a href=\"https://github.com/CoatiSoftware/SourcetrailPythonIndexer\">SourcetrailPythonIndexer</a> in the background.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CUSTOM_COMMAND] = "Create a new Source Group executing a custom command on each source file. "
|
||||
"This Source Group type can be used on <a href=\"https://github.com/CoatiSoftware/SourcetrailDB\">SourcetrailDB</a> binaries that add "
|
||||
"custom language support to Sourcetrail.<br /><br />Current Database Version: " + std::to_string(SqliteIndexStorage::getStorageVersion());
|
||||
|
||||
@@ -8,9 +8,9 @@ IndexerJava::~IndexerJava()
|
||||
}
|
||||
|
||||
void IndexerJava::doIndex(
|
||||
std::shared_ptr<IndexerCommandJava> indexerCommand,
|
||||
std::shared_ptr<ParserClientImpl> parserClient,
|
||||
std::shared_ptr<IndexerStateInfo> m_indexerStateInfo
|
||||
std::shared_ptr<IndexerCommandJava> indexerCommand,
|
||||
std::shared_ptr<ParserClientImpl> parserClient,
|
||||
std::shared_ptr<IndexerStateInfo> m_indexerStateInfo
|
||||
){
|
||||
JavaParser(parserClient, m_indexerStateInfo).buildIndex(indexerCommand);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
add_files(
|
||||
LIB_PYTHON
|
||||
|
||||
project/SourceGroupFactoryModulePython.h
|
||||
project/SourceGroupFactoryModulePython.cpp
|
||||
project/SourceGroupPythonEmpty.h
|
||||
project/SourceGroupPythonEmpty.cpp
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "SourceGroupFactoryModulePython.h"
|
||||
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
|
||||
bool SourceGroupFactoryModulePython::supports(SourceGroupType type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroup> SourceGroupFactoryModulePython::createSourceGroup(std::shared_ptr<SourceGroupSettings> settings) const
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup;
|
||||
if (std::shared_ptr<SourceGroupSettingsPythonEmpty> pythonSettings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupPythonEmpty(pythonSettings));
|
||||
}
|
||||
return sourceGroup;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
#define SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
|
||||
#include "SourceGroupFactoryModule.h"
|
||||
|
||||
class SourceGroupFactoryModulePython: public SourceGroupFactoryModule
|
||||
{
|
||||
public:
|
||||
bool supports(SourceGroupType type) const override;
|
||||
std::shared_ptr<SourceGroup> createSourceGroup(std::shared_ptr<SourceGroupSettings> settings) const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
@@ -0,0 +1,66 @@
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
|
||||
#include "FileManager.h"
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "ProjectSettings.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "SqliteIndexStorage.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupPythonEmpty::SourceGroupPythonEmpty(std::shared_ptr<SourceGroupSettingsPythonEmpty> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupPythonEmpty::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
std::set<FilePath>(),
|
||||
utility::toSet(m_settings->getSourcePathsExpandedAndAbsolute()),
|
||||
m_settings->getExcludeFiltersExpandedAndAbsolute()
|
||||
);
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupPythonEmpty::getAllSourceFilePaths() const
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
m_settings->getSourcePathsExpandedAndAbsolute(),
|
||||
m_settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
m_settings->getSourceExtensions()
|
||||
);
|
||||
return fileManager.getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (const FilePath& sourceFilePath : getAllSourceFilePaths())
|
||||
{
|
||||
if (filesToIndex.find(sourceFilePath) != filesToIndex.end())
|
||||
{
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
|
||||
L"\"" + ResourcePaths::getPythonPath().wstr() + L"SourcetrailPythonIndexer\" --source-file-path=%{SOURCE_FILE_PATH} --database-file-path=%{DATABASE_FILE_PATH}",
|
||||
m_settings->getProjectSettings()->getProjectFilePath(),
|
||||
m_settings->getProjectSettings()->getTempDBFilePath(),
|
||||
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
|
||||
sourceFilePath,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupPythonEmpty::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupPythonEmpty::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
#define SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsPythonEmpty;
|
||||
|
||||
class SourceGroupPythonEmpty: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupPythonEmpty(std::shared_ptr<SourceGroupSettingsPythonEmpty> settings);
|
||||
|
||||
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 std::set<FilePath>& filesToIndex) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
Reference in New Issue
Block a user