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:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user