logic: Added SourceGroupCustomCommand to use with SourcetrailDB binaries
* Added new Source Group type SourceGroupCustomCommand to UI and ProjectSettings * The Source Group executes a specified command on every source file * The variables $SOURCE_PATH, $PROJECT_PATH, $DB_PATH, $STORAGE_VERSION can be passed * The commands are executed after all other source groups finished indexing * The command is executed with working directory set to project directory * Errors during command execution are shown as status update and in the Status View * SourceGroupCustomCommand cannot be partially cleared, when one file needs clearing the project must be fully re-indexed
This commit is contained in:
@@ -378,7 +378,7 @@ FilePath Application::migrateProjectSettings(const FilePath& projectSettingsFile
|
||||
if (projectSettingsFilePath.extension() == L".coatiproject")
|
||||
{
|
||||
MessageStatus(L"Migrating deprecated project file extension \".coatiproject\" to new file extension \".srctrlprj\"").dispatch();
|
||||
const FilePath newSettingsPath = projectSettingsFilePath.replaceExtension(Project::PROJECT_FILE_EXTENSION);
|
||||
const FilePath newSettingsPath = projectSettingsFilePath.replaceExtension(ProjectSettings::PROJECT_FILE_EXTENSION);
|
||||
{
|
||||
FileSystem::rename(projectSettingsFilePath, newSettingsPath);
|
||||
const FilePath oldDbPath = projectSettingsFilePath.replaceExtension(L"coatidb");
|
||||
|
||||
@@ -174,6 +174,8 @@ add_files(
|
||||
data/indexer/IndexerBase.h
|
||||
data/indexer/IndexerCommand.cpp
|
||||
data/indexer/IndexerCommand.h
|
||||
data/indexer/IndexerCommandCustom.cpp
|
||||
data/indexer/IndexerCommandCustom.h
|
||||
data/indexer/IndexerCommandProvider.cpp
|
||||
data/indexer/IndexerCommandProvider.h
|
||||
data/indexer/IndexerCommandType.cpp
|
||||
@@ -185,6 +187,8 @@ add_files(
|
||||
data/indexer/MemoryIndexerCommandProvider.h
|
||||
data/indexer/TaskBuildIndex.cpp
|
||||
data/indexer/TaskBuildIndex.h
|
||||
data/indexer/TaskExecuteCustomCommands.cpp
|
||||
data/indexer/TaskExecuteCustomCommands.h
|
||||
data/indexer/TaskFillIndexerCommandQueue.cpp
|
||||
data/indexer/TaskFillIndexerCommandQueue.h
|
||||
|
||||
@@ -298,10 +302,14 @@ add_files(
|
||||
project/RefreshInfoGenerator.cpp
|
||||
project/SourceGroup.cpp
|
||||
project/SourceGroup.h
|
||||
project/SourceGroupCustomCommand.cpp
|
||||
project/SourceGroupCustomCommand.h
|
||||
project/SourceGroupFactory.cpp
|
||||
project/SourceGroupFactory.h
|
||||
project/SourceGroupFactoryModule.cpp
|
||||
project/SourceGroupFactoryModule.h
|
||||
project/SourceGroupFactoryModuleCustom.cpp
|
||||
project/SourceGroupFactoryModuleCustom.h
|
||||
|
||||
settings/migration/SettingsMigration.cpp
|
||||
settings/migration/SettingsMigration.h
|
||||
@@ -325,12 +333,15 @@ add_files(
|
||||
settings/Settings.h
|
||||
settings/SourceGroupSettings.cpp
|
||||
settings/SourceGroupSettings.h
|
||||
settings/SourceGroupSettingsBase.h
|
||||
settings/SourceGroupSettingsCxx.cpp
|
||||
settings/SourceGroupSettingsCxx.h
|
||||
settings/SourceGroupSettingsCEmpty.cpp
|
||||
settings/SourceGroupSettingsCEmpty.h
|
||||
settings/SourceGroupSettingsCppEmpty.cpp
|
||||
settings/SourceGroupSettingsCppEmpty.h
|
||||
settings/SourceGroupSettingsCustomCommand.cpp
|
||||
settings/SourceGroupSettingsCustomCommand.h
|
||||
settings/SourceGroupSettingsCxxCdb.cpp
|
||||
settings/SourceGroupSettingsCxxCdb.h
|
||||
settings/SourceGroupSettingsCxxCdbVs.cpp
|
||||
|
||||
@@ -52,6 +52,11 @@ void DialogView::updateIndexingDialog(
|
||||
{
|
||||
}
|
||||
|
||||
void DialogView::updateCustomIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths)
|
||||
{
|
||||
}
|
||||
|
||||
DatabasePolicy DialogView::finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted)
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing);
|
||||
virtual void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
|
||||
virtual void updateCustomIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
|
||||
virtual DatabasePolicy finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#include "IndexerCommandCustom.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
IndexerCommandType IndexerCommandCustom::getStaticIndexerCommandType()
|
||||
{
|
||||
return INDEXER_COMMAND_CUSTOM;
|
||||
}
|
||||
|
||||
IndexerCommandCustom::IndexerCommandCustom(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::wstring& customCommand
|
||||
)
|
||||
: IndexerCommand(sourceFilePath)
|
||||
, m_customCommand(customCommand)
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandType IndexerCommandCustom::getIndexerCommandType() const
|
||||
{
|
||||
return getStaticIndexerCommandType();
|
||||
}
|
||||
|
||||
size_t IndexerCommandCustom::getByteSize(size_t stringSize) const
|
||||
{
|
||||
size_t size = IndexerCommand::getByteSize(stringSize);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
const std::wstring& IndexerCommandCustom::getCustomCommand() const
|
||||
{
|
||||
return m_customCommand;
|
||||
}
|
||||
|
||||
QJsonObject IndexerCommandCustom::doSerialize() const
|
||||
{
|
||||
QJsonObject jsonObject = IndexerCommand::doSerialize();
|
||||
|
||||
{
|
||||
jsonObject["custom_command"] = QString::fromStdWString(m_customCommand);
|
||||
}
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef INDEXER_COMMAND_CUSTOM_H
|
||||
#define INDEXER_COMMAND_CUSTOM_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "IndexerCommand.h"
|
||||
|
||||
class IndexerCommandCustom
|
||||
: public IndexerCommand
|
||||
{
|
||||
public:
|
||||
static IndexerCommandType getStaticIndexerCommandType();
|
||||
|
||||
IndexerCommandCustom(const FilePath& sourceFilePath, const std::wstring& customCommand);
|
||||
|
||||
IndexerCommandType getIndexerCommandType() const override;
|
||||
size_t getByteSize(size_t stringSize) const override;
|
||||
|
||||
const std::wstring& getCustomCommand() const;
|
||||
|
||||
protected:
|
||||
QJsonObject doSerialize() const override;
|
||||
|
||||
private:
|
||||
std::wstring m_customCommand;
|
||||
};
|
||||
|
||||
#endif // INDEXER_COMMAND_CXXL_H
|
||||
@@ -8,6 +8,8 @@ std::string indexerCommandTypeToString(IndexerCommandType type)
|
||||
return "indexer_command_cxx";
|
||||
case INDEXER_COMMAND_JAVA:
|
||||
return "indexer_command_java";
|
||||
case INDEXER_COMMAND_CUSTOM:
|
||||
return "indexer_command_custom";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -18,6 +20,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_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_CUSTOM
|
||||
};
|
||||
|
||||
std::string indexerCommandTypeToString(IndexerCommandType type);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "TaskExecuteCustomCommands.h"
|
||||
|
||||
#include "Blackboard.h"
|
||||
#include "DialogView.h"
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "IndexerCommandProvider.h"
|
||||
#include "MessageIndexingStatus.h"
|
||||
#include "MessageShowStatus.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "utility.h"
|
||||
#include "utilityApp.h"
|
||||
#include "utilityString.h"
|
||||
|
||||
TaskExecuteCustomCommands::TaskExecuteCustomCommands(
|
||||
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider, std::shared_ptr<DialogView> dialogView, const FilePath& projectDirectory
|
||||
)
|
||||
: m_indexerCommandProvider(std::move(indexerCommandProvider))
|
||||
, m_dialogView(dialogView)
|
||||
, m_projectDirectory(projectDirectory)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskExecuteCustomCommands::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
m_dialogView->hideUnknownProgressDialog();
|
||||
m_start = utility::durationStart();
|
||||
}
|
||||
|
||||
Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (m_interrupted)
|
||||
{
|
||||
return STATE_SUCCESS;
|
||||
}
|
||||
|
||||
int sourceFileCount = m_indexerCommandProvider->size();
|
||||
int indexedSourceFileCount = 0;
|
||||
m_dialogView->updateCustomIndexingDialog(0, 0, sourceFileCount, { });
|
||||
|
||||
while (!m_interrupted && m_indexerCommandProvider->size())
|
||||
{
|
||||
std::shared_ptr<IndexerCommandCustom> indexerCommand =
|
||||
std::dynamic_pointer_cast<IndexerCommandCustom>(m_indexerCommandProvider->consumeCommand());
|
||||
if (indexerCommand)
|
||||
{
|
||||
FilePath sourcePath = indexerCommand->getSourceFilePath();
|
||||
m_dialogView->updateCustomIndexingDialog(indexedSourceFileCount + 1, indexedSourceFileCount, sourceFileCount, { sourcePath });
|
||||
MessageIndexingStatus(true, indexedSourceFileCount * 100 / sourceFileCount).dispatch();
|
||||
LOG_INFO_STREAM(<< "Execute command \"" << utility::encodeToUtf8(indexerCommand->getCustomCommand()) << "\"");
|
||||
|
||||
std::wstring processOutput;
|
||||
int result = utility::executeProcessAndGetExitCode(indexerCommand->getCustomCommand(), {}, m_projectDirectory, -1, &processOutput);
|
||||
|
||||
if (processOutput.size() > 3 || result != 0)
|
||||
{
|
||||
if (result == 0)
|
||||
{
|
||||
LOG_INFO_STREAM(<< "process return 0:\n" << utility::encodeToUtf8(processOutput));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "process returned " << result << ":\n" << utility::encodeToUtf8(processOutput));
|
||||
MessageShowStatus().dispatch();
|
||||
MessageStatus(L"command <" + indexerCommand->getCustomCommand() + L"> returned " +
|
||||
std::to_wstring(result) + L": " + processOutput, true, false, true).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
indexedSourceFileCount++;
|
||||
blackboard->update<int>("indexed_source_file_count", [=](int count) { return count + 1; });
|
||||
}
|
||||
}
|
||||
|
||||
return STATE_SUCCESS;
|
||||
}
|
||||
|
||||
void TaskExecuteCustomCommands::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
float duration = utility::duration(m_start);
|
||||
blackboard->update<float>("index_time", [duration](float currentDuration) { return currentDuration + duration; });
|
||||
}
|
||||
|
||||
void TaskExecuteCustomCommands::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskExecuteCustomCommands::handleMessage(MessageIndexingInterrupted* message)
|
||||
{
|
||||
LOG_INFO("Interrupting custom command execution.");
|
||||
|
||||
m_interrupted = true;
|
||||
|
||||
m_dialogView->showUnknownProgressDialog(L"Interrupting Indexing", L"Waiting for running\ncommand to finish");
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef TASK_EXECUTE_CUSTOM_COMMANDS_H
|
||||
#define TASK_EXECUTE_CUSTOM_COMMANDS_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "Task.h"
|
||||
#include "TimeStamp.h"
|
||||
#include "MessageIndexingInterrupted.h"
|
||||
#include "MessageListener.h"
|
||||
|
||||
class DialogView;
|
||||
class IndexerCommandProvider;
|
||||
|
||||
class TaskExecuteCustomCommands
|
||||
: public Task
|
||||
, public MessageListener<MessageIndexingInterrupted>
|
||||
{
|
||||
public:
|
||||
TaskExecuteCustomCommands(
|
||||
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
|
||||
std::shared_ptr<DialogView> dialogView,
|
||||
const FilePath& projectDirectory);
|
||||
|
||||
private:
|
||||
void doEnter(std::shared_ptr<Blackboard> blackboard) override;
|
||||
TaskState doUpdate(std::shared_ptr<Blackboard> blackboard) override;
|
||||
void doExit(std::shared_ptr<Blackboard> blackboard) override;
|
||||
void doReset(std::shared_ptr<Blackboard> blackboard) override;
|
||||
|
||||
void handleMessage(MessageIndexingInterrupted* message) override;
|
||||
|
||||
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
|
||||
std::shared_ptr<DialogView> m_dialogView;
|
||||
const FilePath m_projectDirectory;
|
||||
|
||||
TimeStamp m_start;
|
||||
bool m_interrupted = false;
|
||||
};
|
||||
|
||||
#endif // TASK_EXECUTE_CUSTOM_COMMANDS_H
|
||||
@@ -37,7 +37,8 @@ Task::TaskState TaskParseWrapper::doUpdate(std::shared_ptr<Blackboard> blackboar
|
||||
|
||||
void TaskParseWrapper::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
blackboard->set("index_time", utility::duration(m_start));
|
||||
float duration = utility::duration(m_start);
|
||||
blackboard->update<float>("index_time", [duration](float currentDuration) { return currentDuration + duration; });
|
||||
}
|
||||
|
||||
void TaskParseWrapper::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
@@ -44,6 +44,11 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
size_t SqliteIndexStorage::getStorageVersion()
|
||||
{
|
||||
return s_storageVersion;
|
||||
}
|
||||
|
||||
SqliteIndexStorage::SqliteIndexStorage(const FilePath& dbFilePath)
|
||||
: SqliteStorage(dbFilePath.getCanonical())
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@ class SqliteIndexStorage
|
||||
: public SqliteStorage
|
||||
{
|
||||
public:
|
||||
static size_t getStorageVersion();
|
||||
|
||||
enum StorageModeType
|
||||
{
|
||||
STORAGE_MODE_READ = 1,
|
||||
|
||||
+77
-23
@@ -3,7 +3,9 @@
|
||||
#include "DialogView.h"
|
||||
#include "CombinedIndexerCommandProvider.h"
|
||||
#include "IndexerCommand.h"
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "TaskBuildIndex.h"
|
||||
#include "TaskExecuteCustomCommands.h"
|
||||
#include "TaskFillIndexerCommandQueue.h"
|
||||
#include "TaskParseWrapper.h"
|
||||
#include "PersistentStorage.h"
|
||||
@@ -43,11 +45,6 @@
|
||||
#include "utilityFile.h"
|
||||
#include "utilityString.h"
|
||||
|
||||
const std::wstring Project::PROJECT_FILE_EXTENSION = L".srctrlprj";
|
||||
const std::wstring Project::BOOKMARK_DB_FILE_EXTENSION = L".srctrlbm";
|
||||
const std::wstring Project::INDEX_DB_FILE_EXTENSION = L".srctrldb";
|
||||
const std::wstring Project::TEMP_INDEX_DB_FILE_EXTENSION = L".srctrldb_tmp";
|
||||
|
||||
Project::Project(std::shared_ptr<ProjectSettings> settings, StorageCache* storageCache, const std::string& appUUID, bool hasGUI)
|
||||
: m_settings(settings)
|
||||
, m_storageCache(storageCache)
|
||||
@@ -124,10 +121,11 @@ void Project::load(std::shared_ptr<DialogView> dialogView)
|
||||
}
|
||||
|
||||
const FilePath projectSettingsPath = m_settings->getFilePath();
|
||||
const FilePath dbPath = m_settings->getDBFilePath();
|
||||
const FilePath tempDbPath = m_settings->getTempDBFilePath();
|
||||
const FilePath bookmarkDbPath = m_settings->getBookmarkDBFilePath();
|
||||
|
||||
{
|
||||
const FilePath dbPath = projectSettingsPath.replaceExtension(INDEX_DB_FILE_EXTENSION);
|
||||
const FilePath tempDbPath = projectSettingsPath.replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
if (tempDbPath.exists())
|
||||
{
|
||||
if (dbPath.exists())
|
||||
@@ -160,10 +158,7 @@ void Project::load(std::shared_ptr<DialogView> dialogView)
|
||||
}
|
||||
}
|
||||
|
||||
m_storage = std::make_shared<PersistentStorage>(
|
||||
projectSettingsPath.replaceExtension(INDEX_DB_FILE_EXTENSION),
|
||||
projectSettingsPath.replaceExtension(BOOKMARK_DB_FILE_EXTENSION)
|
||||
);
|
||||
m_storage = std::make_shared<PersistentStorage>(dbPath, bookmarkDbPath);
|
||||
|
||||
bool canLoad = false;
|
||||
|
||||
@@ -399,7 +394,7 @@ RefreshInfo Project::getRefreshInfo(RefreshMode mode) const
|
||||
}
|
||||
}
|
||||
|
||||
void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> dialogView)
|
||||
void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogView)
|
||||
{
|
||||
if (m_refreshStage == RefreshStageType::INDEXING)
|
||||
{
|
||||
@@ -423,6 +418,45 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
|
||||
return;
|
||||
}
|
||||
|
||||
if (info.mode != REFRESH_ALL_FILES && (info.filesToClear.size() || info.nonIndexedFilesToClear.size()))
|
||||
{
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
|
||||
{
|
||||
if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED && !sourceGroup->allowsPartialClearing())
|
||||
{
|
||||
bool abortIndexing = false;
|
||||
for (const FilePath& sourcePath : utility::concat(info.filesToClear, info.nonIndexedFilesToClear))
|
||||
{
|
||||
if (sourceGroup->containsSourceFilePath(sourcePath))
|
||||
{
|
||||
abortIndexing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (abortIndexing)
|
||||
{
|
||||
if (dialogView->confirm(
|
||||
"<p>This project contains a source group of type \"" + sourceGroupTypeToString(sourceGroup->getType()) + "\" "
|
||||
"that cannot be partially cleared. Do you want to re-index the whole project instead?</p>",
|
||||
{ "Full Re-Index", "Cancel" }
|
||||
) == 1)
|
||||
{
|
||||
MessageStatus(L"Cannot partially clear project. Indexing aborted.").dispatch();
|
||||
m_refreshStage = RefreshStageType::NONE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = getRefreshInfo(REFRESH_ALL_FILES);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageStatus(L"Preparing Indexing", false, true).dispatch();
|
||||
MessageErrorCountClear().dispatch();
|
||||
|
||||
@@ -432,8 +466,8 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
|
||||
m_storageCache->clear();
|
||||
m_storageCache->setSubject(m_storage);
|
||||
|
||||
const FilePath indexDbFilePath = m_storage->getIndexDbFilePath();
|
||||
const FilePath tempIndexDbFilePath = indexDbFilePath.replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
const FilePath indexDbFilePath = m_settings->getDBFilePath();
|
||||
const FilePath tempIndexDbFilePath = m_settings->getTempDBFilePath();
|
||||
|
||||
if (info.mode != REFRESH_ALL_FILES)
|
||||
{
|
||||
@@ -460,15 +494,29 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
|
||||
tempStorage->updateVersion();
|
||||
|
||||
std::unique_ptr<CombinedIndexerCommandProvider> indexerCommandProvider = std::make_unique<CombinedIndexerCommandProvider>();
|
||||
std::unique_ptr<CombinedIndexerCommandProvider> customIndexerCommandProvider = std::make_unique<CombinedIndexerCommandProvider>();
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
|
||||
{
|
||||
if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
|
||||
{
|
||||
indexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
|
||||
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND)
|
||||
{
|
||||
customIndexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
indexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!info.filesToIndex.empty())
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<int>>(
|
||||
"source_file_count", indexerCommandProvider->size() + customIndexerCommandProvider->size()));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("indexed_source_file_count", 0));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("interrupted_indexing", false));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<float>>("index_time", 0.0f));
|
||||
|
||||
if (indexerCommandProvider->size())
|
||||
{
|
||||
int indexerThreadCount = ApplicationSettings::getInstance()->getIndexerThreadCount();
|
||||
if (indexerThreadCount <= 0)
|
||||
@@ -480,12 +528,10 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
|
||||
}
|
||||
}
|
||||
|
||||
indexerThreadCount = std::min<int>(indexerThreadCount, info.filesToIndex.size());
|
||||
indexerThreadCount = std::min<int>(indexerThreadCount, indexerCommandProvider->size());
|
||||
|
||||
std::shared_ptr<StorageProvider> storageProvider = std::make_shared<StorageProvider>();
|
||||
// add tasks for setting some variables on the blackboard that are used during indexing
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("source_file_count", indexerCommandProvider->size()));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("indexed_source_file_count", 0));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("indexer_threads_started", false));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("indexer_threads_stopped", false));
|
||||
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("indexer_command_queue_started", false));
|
||||
@@ -567,6 +613,14 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
}
|
||||
|
||||
if (customIndexerCommandProvider->size())
|
||||
{
|
||||
taskSequential->addTask(
|
||||
std::make_shared<TaskExecuteCustomCommands>(
|
||||
std::move(customIndexerCommandProvider), dialogView, getProjectSettingsFilePath().getParentDirectory())
|
||||
);
|
||||
}
|
||||
|
||||
taskSequential->addTask(std::make_shared<TaskFinishParsing>(tempStorage, dialogView));
|
||||
|
||||
taskSequential->addTask(std::make_shared<TaskGroupSelector>()->addChildTasks(
|
||||
@@ -604,9 +658,9 @@ void Project::swapToTempStorage(std::shared_ptr<DialogView> dialogView)
|
||||
{
|
||||
LOG_INFO("Switching to temporary indexing data");
|
||||
|
||||
const FilePath indexDbFilePath = m_storage->getIndexDbFilePath();
|
||||
const FilePath tempIndexDbFilePath = indexDbFilePath.replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
const FilePath bookmarkDbFilePath = m_storage->getBookmarkDbFilePath();
|
||||
const FilePath indexDbFilePath = m_settings->getDBFilePath();
|
||||
const FilePath tempIndexDbFilePath = m_settings->getTempDBFilePath();
|
||||
const FilePath bookmarkDbFilePath = m_settings->getBookmarkDBFilePath();
|
||||
|
||||
m_storage.reset();
|
||||
|
||||
@@ -652,7 +706,7 @@ bool Project::swapToTempStorageFile(const FilePath& indexDbFilePath, const FileP
|
||||
|
||||
void Project::discardTempStorage()
|
||||
{
|
||||
const FilePath tempIndexDbPath = m_storage->getIndexDbFilePath().replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
const FilePath tempIndexDbPath = m_settings->getTempDBFilePath();
|
||||
if (tempIndexDbPath.exists())
|
||||
{
|
||||
LOG_INFO("Discarding temporary indexing data");
|
||||
|
||||
@@ -19,11 +19,6 @@ class StorageCache;
|
||||
class Project
|
||||
{
|
||||
public:
|
||||
static const std::wstring PROJECT_FILE_EXTENSION;
|
||||
static const std::wstring BOOKMARK_DB_FILE_EXTENSION;
|
||||
static const std::wstring INDEX_DB_FILE_EXTENSION;
|
||||
static const std::wstring TEMP_INDEX_DB_FILE_EXTENSION;
|
||||
|
||||
Project(std::shared_ptr<ProjectSettings> settings, StorageCache* storageCache, const std::string& appUUID, bool hasGUI);
|
||||
virtual ~Project();
|
||||
|
||||
@@ -42,7 +37,7 @@ public:
|
||||
|
||||
RefreshInfo getRefreshInfo(RefreshMode mode) const;
|
||||
|
||||
void buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> dialogView);
|
||||
void buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogView);
|
||||
|
||||
private:
|
||||
enum ProjectStateType
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "MemoryIndexerCommandProvider.h"
|
||||
#include "SourceGroupSettings.h"
|
||||
#include "FilePath.h"
|
||||
#include "FilePathFilter.h"
|
||||
|
||||
std::shared_ptr<IndexerCommandProvider> SourceGroup::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
@@ -29,6 +30,11 @@ bool SourceGroup::prepareIndexing()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SourceGroup::allowsPartialClearing() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::filterToContainedSourceFilePath(const std::set<FilePath>& sourceFilePaths) const
|
||||
{
|
||||
std::set<FilePath> filteredSourceFilePaths;
|
||||
@@ -46,3 +52,50 @@ bool SourceGroup::containsSourceFilePath(const FilePath& sourceFilePath) const
|
||||
{
|
||||
return !filterToContainedSourceFilePath({ sourceFilePath }).empty();
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::filterToContainedFilePaths(
|
||||
const std::set<FilePath>& filePaths,
|
||||
const std::set<FilePath>& indexedFilePaths,
|
||||
const std::set<FilePath>& indexedFileOrDirectoryPaths,
|
||||
const std::vector<FilePathFilter>& excludeFilters) const
|
||||
{
|
||||
std::set<FilePath> containedFilePaths;
|
||||
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
bool isInIndexedPaths = false;
|
||||
|
||||
for (const FilePath& indexedFileOrDirectoryPath : indexedFileOrDirectoryPaths)
|
||||
{
|
||||
if (indexedFileOrDirectoryPath == filePath || indexedFileOrDirectoryPath.contains(filePath))
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInIndexedPaths && indexedFilePaths.find(filePath) != indexedFilePaths.end())
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(filePath))
|
||||
{
|
||||
isInIndexedPaths = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
class IndexerCommand;
|
||||
class IndexerCommandProvider;
|
||||
class FilePath;
|
||||
class FilePathFilter;
|
||||
class SourceGroupSettings;
|
||||
|
||||
class SourceGroup
|
||||
@@ -20,6 +21,8 @@ public:
|
||||
virtual ~SourceGroup() = default;
|
||||
|
||||
virtual bool prepareIndexing();
|
||||
virtual bool allowsPartialClearing() const;
|
||||
|
||||
virtual std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const = 0;
|
||||
virtual std::set<FilePath> getAllSourceFilePaths() const = 0;
|
||||
virtual std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const;
|
||||
@@ -34,6 +37,12 @@ public:
|
||||
protected:
|
||||
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0;
|
||||
virtual std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const = 0;
|
||||
|
||||
std::set<FilePath> filterToContainedFilePaths(
|
||||
const std::set<FilePath>& filePaths,
|
||||
const std::set<FilePath>& indexedFilePaths,
|
||||
const std::set<FilePath>& indexedFileOrDirectoryPaths,
|
||||
const std::vector<FilePathFilter>& excludeFilters) const;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_H
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
|
||||
#include "FileManager.h"
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "ProjectSettings.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SqliteIndexStorage.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupCustomCommand::SourceGroupCustomCommand(std::shared_ptr<SourceGroupSettingsCustomCommand> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupCustomCommand::allowsPartialClearing() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCustomCommand::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> SourceGroupCustomCommand::getAllSourceFilePaths() const
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
m_settings->getSourcePathsExpandedAndAbsolute(),
|
||||
m_settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
m_settings->getSourceExtensions()
|
||||
);
|
||||
return fileManager.getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
std::wstring customCommand = m_settings->getCustomCommand();
|
||||
|
||||
customCommand = utility::replace(customCommand, L"$PROJECT_PATH", L'\"' + m_settings->getProjectSettings()->getProjectFilePath().wstr() + L'\"');
|
||||
customCommand = utility::replace(customCommand, L"$DB_PATH", L'\"' + m_settings->getProjectSettings()->getTempDBFilePath().wstr() + L'\"');
|
||||
customCommand = utility::replace(customCommand, L"$STORAGE_VERSION", L'\"' + std::to_wstring(SqliteIndexStorage::getStorageVersion()) + L'\"');
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (const FilePath& sourcePath: getAllSourceFilePaths())
|
||||
{
|
||||
if (filesToIndex.find(sourcePath) != filesToIndex.end())
|
||||
{
|
||||
std::wstring command = utility::replace(customCommand, L"$SOURCE_PATH", L'\"' + sourcePath.wstr() + L'\"');
|
||||
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(sourcePath, command));
|
||||
}
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupCustomCommand::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupCustomCommand::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef SOURCE_GROUP_CUSTOM_COMMAND_H
|
||||
#define SOURCE_GROUP_CUSTOM_COMMAND_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsCustomCommand;
|
||||
|
||||
class SourceGroupCustomCommand: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupCustomCommand(std::shared_ptr<SourceGroupSettingsCustomCommand> settings);
|
||||
|
||||
bool allowsPartialClearing() const 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 std::set<FilePath>& filesToIndex) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_CUSTOM_COMMAND_H
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "SourceGroupFactoryModuleCustom.h"
|
||||
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
|
||||
bool SourceGroupFactoryModuleCustom::supports(SourceGroupType type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroup> SourceGroupFactoryModuleCustom::createSourceGroup(std::shared_ptr<SourceGroupSettings> settings) const
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup;
|
||||
if (std::shared_ptr<SourceGroupSettingsCustomCommand> customSettings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCustomCommand(customSettings));
|
||||
}
|
||||
return sourceGroup;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef SOURCE_GROUP_FACTORY_MODULE_CUSTOM_H
|
||||
#define SOURCE_GROUP_FACTORY_MODULE_CUSTOM_H
|
||||
|
||||
#include "SourceGroupFactoryModule.h"
|
||||
|
||||
class SourceGroupFactoryModuleCustom
|
||||
: 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_CUSTOM_H
|
||||
@@ -10,6 +10,8 @@ std::string languageTypeToString(LanguageType t)
|
||||
return "C++";
|
||||
case LANGUAGE_JAVA:
|
||||
return "Java";
|
||||
case LANGUAGE_CUSTOM:
|
||||
return "Custom";
|
||||
case LANGUAGE_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
@@ -30,6 +32,10 @@ LanguageType stringToLanguageType(std::string s)
|
||||
{
|
||||
return LANGUAGE_JAVA;
|
||||
}
|
||||
else if (s == "Custom")
|
||||
{
|
||||
return LANGUAGE_CUSTOM;
|
||||
}
|
||||
return LANGUAGE_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -57,6 +63,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return LANGUAGE_CUSTOM;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ enum LanguageType
|
||||
LANGUAGE_CPP,
|
||||
LANGUAGE_C,
|
||||
LANGUAGE_JAVA,
|
||||
LANGUAGE_CUSTOM,
|
||||
LANGUAGE_UNKNOWN
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "ProjectSettings.h"
|
||||
|
||||
#include "Project.h"
|
||||
#include "SettingsMigrationDeleteKey.h"
|
||||
#include "SettingsMigrationLambda.h"
|
||||
#include "SettingsMigrationMoveKey.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
@@ -17,6 +17,11 @@
|
||||
#include "utilityString.h"
|
||||
#include "utilityUuid.h"
|
||||
|
||||
const std::wstring ProjectSettings::PROJECT_FILE_EXTENSION = L".srctrlprj";
|
||||
const std::wstring ProjectSettings::BOOKMARK_DB_FILE_EXTENSION = L".srctrlbm";
|
||||
const std::wstring ProjectSettings::INDEX_DB_FILE_EXTENSION = L".srctrldb";
|
||||
const std::wstring ProjectSettings::TEMP_INDEX_DB_FILE_EXTENSION = L".srctrldb_tmp";
|
||||
|
||||
const size_t ProjectSettings::VERSION = 7;
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
@@ -115,7 +120,22 @@ FilePath ProjectSettings::getProjectFilePath() const
|
||||
|
||||
void ProjectSettings::setProjectFilePath(std::wstring projectName, const FilePath& projectFileLocation)
|
||||
{
|
||||
setFilePath(projectFileLocation.getConcatenated(L"/" + projectName + Project::PROJECT_FILE_EXTENSION));
|
||||
setFilePath(projectFileLocation.getConcatenated(L"/" + projectName + PROJECT_FILE_EXTENSION));
|
||||
}
|
||||
|
||||
FilePath ProjectSettings::getDBFilePath() const
|
||||
{
|
||||
return getFilePath().replaceExtension(INDEX_DB_FILE_EXTENSION);
|
||||
}
|
||||
|
||||
FilePath ProjectSettings::getTempDBFilePath() const
|
||||
{
|
||||
return getFilePath().replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
}
|
||||
|
||||
FilePath ProjectSettings::getBookmarkDBFilePath() const
|
||||
{
|
||||
return getFilePath().replaceExtension(BOOKMARK_DB_FILE_EXTENSION);
|
||||
}
|
||||
|
||||
std::wstring ProjectSettings::getProjectName() const
|
||||
@@ -172,6 +192,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_CUSTOM_COMMAND:
|
||||
settings = std::make_shared<SourceGroupSettingsCustomCommand>(id, this);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
@@ -356,7 +379,7 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
case LANGUAGE_JAVA:
|
||||
languageName = "java";
|
||||
break;
|
||||
case LANGUAGE_UNKNOWN:
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ class ProjectSettings
|
||||
: public Settings
|
||||
{
|
||||
public:
|
||||
static const std::wstring PROJECT_FILE_EXTENSION;
|
||||
static const std::wstring BOOKMARK_DB_FILE_EXTENSION;
|
||||
static const std::wstring INDEX_DB_FILE_EXTENSION;
|
||||
static const std::wstring TEMP_INDEX_DB_FILE_EXTENSION;
|
||||
|
||||
static const size_t VERSION;
|
||||
static LanguageType getLanguageOfProject(const FilePath& filePath);
|
||||
|
||||
@@ -31,6 +36,10 @@ public:
|
||||
FilePath getProjectFilePath() const;
|
||||
void setProjectFilePath(std::wstring projectName, const FilePath& projectFileLocation);
|
||||
|
||||
FilePath getDBFilePath() const;
|
||||
FilePath getTempDBFilePath() const;
|
||||
FilePath getBookmarkDBFilePath() const;
|
||||
|
||||
std::wstring getProjectName() const;
|
||||
FilePath getProjectDirectoryPath() const;
|
||||
|
||||
|
||||
@@ -88,6 +88,11 @@ void SourceGroupSettings::setStatus(SourceGroupStatusType status)
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettings::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettings::getProjectDirectoryPath() const
|
||||
{
|
||||
return m_projectSettings->getProjectDirectoryPath();
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
#include <vector>
|
||||
|
||||
#include "LanguageType.h"
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
#include "SourceGroupStatusType.h"
|
||||
#include "SourceGroupType.h"
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettings
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
static const size_t s_version;
|
||||
@@ -40,7 +41,9 @@ public:
|
||||
SourceGroupStatusType getStatus() const;
|
||||
void setStatus(SourceGroupStatusType status);
|
||||
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
FilePath getProjectDirectoryPath() const;
|
||||
|
||||
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
||||
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_BASE_H
|
||||
#define SOURCE_GROUP_SETTINGS_BASE_H
|
||||
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
virtual ~SourceGroupSettingsBase() = default;
|
||||
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_BASE_H
|
||||
@@ -51,11 +51,6 @@ bool SourceGroupSettingsCEmpty::equals(std::shared_ptr<SourceGroupSettings> othe
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return { L".c" };
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,14 +51,9 @@ bool SourceGroupSettingsCppEmpty::equals(std::shared_ptr<SourceGroupSettings> ot
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCppEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCppEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
return {
|
||||
L".cpp",
|
||||
L".cxx",
|
||||
L".cc"
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "FilePath.h"
|
||||
|
||||
SourceGroupSettingsCustomCommand::SourceGroupSettingsCustomCommand(
|
||||
const std::string& id, const ProjectSettings* projectSettings
|
||||
)
|
||||
: SourceGroupSettings(id, SOURCE_GROUP_CUSTOM_COMMAND, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCustomCommand::createCopy() const
|
||||
{
|
||||
return std::make_shared<SourceGroupSettingsCustomCommand>(*this);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCustomCommand::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
|
||||
setCustomCommand(config->getValueOrDefault(key + "/custom_command", std::wstring()));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCustomCommand::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
|
||||
config->setValue(key + "/custom_command", getCustomCommand());
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsCustomCommand::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> otherCustom =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(other);
|
||||
|
||||
return (
|
||||
otherCustom &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherCustom) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherCustom) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherCustom)
|
||||
);
|
||||
}
|
||||
|
||||
const std::wstring& SourceGroupSettingsCustomCommand::getCustomCommand() const
|
||||
{
|
||||
return m_customCommand;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCustomCommand::setCustomCommand(const std::wstring& customCommand)
|
||||
{
|
||||
m_customCommand = customCommand;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCustomCommand::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
|
||||
#define SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
|
||||
|
||||
#include "SourceGroupSettings.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsCustomCommand
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCustomCommand(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;
|
||||
|
||||
const std::wstring& getCustomCommand() const;
|
||||
void setCustomCommand(const std::wstring& customCommand);
|
||||
|
||||
private:
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
std::wstring m_customCommand;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
|
||||
@@ -65,8 +65,3 @@ void SourceGroupSettingsCxxCdb::setCompilationDatabasePath(const FilePath& compi
|
||||
{
|
||||
m_compilationDatabasePath = compilationDatabasePath;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxCdb::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ public:
|
||||
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
|
||||
FilePath m_compilationDatabasePath;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void SourceGroupSettingsCxxCodeblocks::load(std::shared_ptr<const ConfigManager>
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
|
||||
|
||||
setCodeblocksProjectPath(config->getValueOrDefault(key + "/codeblocks_project_path", FilePath(L"")));
|
||||
}
|
||||
|
||||
@@ -74,11 +74,6 @@ void SourceGroupSettingsCxxCodeblocks::setCodeblocksProjectPath(const FilePath&
|
||||
m_codeblocksProjectPath = compilationDatabasePath;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxCodeblocks::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCxxCodeblocks::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
void setCodeblocksProjectPath(const FilePath& compilationDatabasePath);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
FilePath m_codeblocksProjectPath;
|
||||
|
||||
@@ -44,8 +44,3 @@ bool SourceGroupSettingsCxxSonargraph::equals(std::shared_ptr<SourceGroupSetting
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherCxxSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxSonargraph::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ public:
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
|
||||
@@ -41,8 +41,3 @@ bool SourceGroupSettingsJavaEmpty::equals(std::shared_ptr<SourceGroupSettings> o
|
||||
SourceGroupSettingsWithClasspath::equals(otherJava)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@ public:
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
|
||||
|
||||
@@ -90,8 +90,3 @@ void SourceGroupSettingsJavaGradle::setShouldIndexGradleTests(bool value)
|
||||
{
|
||||
m_shouldIndexGradleTests = value;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaGradle::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ public:
|
||||
void setShouldIndexGradleTests(bool value);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
|
||||
FilePath m_gradleProjectFilePath;
|
||||
FilePath m_gradleDependenciesDirectory;
|
||||
bool m_shouldIndexGradleTests;
|
||||
|
||||
@@ -90,8 +90,3 @@ void SourceGroupSettingsJavaMaven::setShouldIndexMavenTests(bool value)
|
||||
{
|
||||
m_shouldIndexMavenTests = value;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaMaven::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ public:
|
||||
void setShouldIndexMavenTests(bool value);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
|
||||
FilePath m_mavenProjectFilePath;
|
||||
FilePath m_mavenDependenciesDirectory;
|
||||
bool m_shouldIndexMavenTests;
|
||||
|
||||
@@ -44,8 +44,3 @@ bool SourceGroupSettingsJavaSonargraph::equals(std::shared_ptr<SourceGroupSettin
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherJavaSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaSonargraph::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ public:
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCStandard
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
static std::wstring getDefaultCStandardStatic();
|
||||
@@ -28,7 +30,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::wstring getDefaultCStandard() const;
|
||||
|
||||
std::wstring m_cStandard;
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithClasspath
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithClasspath();
|
||||
@@ -30,8 +31,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
|
||||
std::vector<FilePath> m_classpath;
|
||||
bool m_useJreSystemLibrary;
|
||||
};
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCppStandard
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
static std::wstring getDefaultCppStandardStatic();
|
||||
@@ -28,7 +30,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::wstring getDefaultCppStandard() const;
|
||||
|
||||
std::wstring m_cppStandard;
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCxxCrossCompilationOptions
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
static std::vector<std::wstring> getAvailableArchTypes();
|
||||
@@ -43,8 +45,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
|
||||
bool m_targetOptionsEnabled;
|
||||
std::wstring m_targetArch;
|
||||
std::wstring m_targetVendor;
|
||||
|
||||
@@ -5,28 +5,29 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class FilePathFilter;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithExcludeFilters
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithExcludeFilters();
|
||||
virtual ~SourceGroupSettingsWithExcludeFilters() = default;
|
||||
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithExcludeFilters> other) const;
|
||||
|
||||
std::vector<std::wstring> getExcludeFilterStrings() const;
|
||||
std::vector<FilePathFilter> getExcludeFiltersExpandedAndAbsolute() const;
|
||||
void setExcludeFilterStrings(const std::vector<std::wstring>& excludeFilters);
|
||||
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::vector<FilePathFilter> getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const;
|
||||
|
||||
std::vector<std::wstring> m_excludeFilters;
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithIndexedHeaderPaths
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithIndexedHeaderPaths();
|
||||
@@ -26,8 +28,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
|
||||
std::vector<FilePath> m_indexedHeaderPaths;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithJavaStandard
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
static std::wstring getDefaultJavaStandardStatic();
|
||||
@@ -28,7 +30,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::wstring getDefaultJavaStandard() const;
|
||||
|
||||
std::wstring m_javaStandard;
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
#include "FilePath.h"
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithSonargraphProjectPath
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithSonargraphProjectPath();
|
||||
@@ -26,8 +27,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
|
||||
FilePath m_sonargraphProjectPath;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,27 +5,28 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithSourceExtensions
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithSourceExtensions();
|
||||
virtual ~SourceGroupSettingsWithSourceExtensions() = default;
|
||||
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const;
|
||||
|
||||
std::vector<std::wstring> getSourceExtensions() const;
|
||||
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
|
||||
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||
|
||||
std::vector<std::wstring> m_sourceExtensions;
|
||||
|
||||
@@ -5,16 +5,18 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroupSettingsBase.h"
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithSourcePaths
|
||||
: virtual public SourceGroupSettingsBase
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithSourcePaths();
|
||||
virtual ~SourceGroupSettingsWithSourcePaths() = default;
|
||||
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const;
|
||||
|
||||
std::vector<FilePath> getSourcePaths() const;
|
||||
@@ -26,8 +28,6 @@ protected:
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
|
||||
std::vector<FilePath> m_sourcePaths;
|
||||
};
|
||||
|
||||
|
||||
@@ -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_CUSTOM_COMMAND:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
@@ -54,6 +56,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
return "Java Source Group from Gradle";
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return "Java from Sonargraph";
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
@@ -102,6 +106,10 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_JAVA_SONARGRAPH;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CUSTOM_COMMAND))
|
||||
{
|
||||
return SOURCE_GROUP_CUSTOM_COMMAND;
|
||||
}
|
||||
|
||||
return SOURCE_GROUP_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ enum SourceGroupType
|
||||
SOURCE_GROUP_JAVA_MAVEN,
|
||||
SOURCE_GROUP_JAVA_GRADLE,
|
||||
SOURCE_GROUP_JAVA_SONARGRAPH,
|
||||
SOURCE_GROUP_CUSTOM_COMMAND,
|
||||
SOURCE_GROUP_UNKNOWN
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <set>
|
||||
|
||||
#include <boost/date_time.hpp>
|
||||
#include <boost/date_time/c_local_time_adjustor.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "utilityString.h"
|
||||
@@ -196,6 +197,7 @@ TimeStamp FileSystem::getLastWriteTime(const FilePath& filePath)
|
||||
{
|
||||
std::time_t t = boost::filesystem::last_write_time(filePath.getPath());
|
||||
lastWriteTime = boost::posix_time::from_time_t(t);
|
||||
lastWriteTime = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(lastWriteTime);
|
||||
}
|
||||
return TimeStamp(lastWriteTime);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ public:
|
||||
{
|
||||
return "MessageIndexingInterrupted";
|
||||
}
|
||||
|
||||
MessageIndexingInterrupted()
|
||||
{
|
||||
setSendAsTask(false);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INDEXING_INTERRUPTED_H
|
||||
|
||||
Reference in New Issue
Block a user