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:
mlangkabel
2019-04-02 15:54:17 +02:00
parent 5d672fafc4
commit 045a3a4e50
34 changed files with 450 additions and 29 deletions
@@ -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;
}