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:
@@ -134,7 +134,8 @@ QCheckBox:disabled {
|
||||
|
||||
#menuButton {
|
||||
background: white;
|
||||
border: none;
|
||||
border: 2px solid #CFD2E0;
|
||||
border-right: none;
|
||||
border-radius: 8px;
|
||||
border-bottom-right-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
SourceFilePath: "src/a.txt"
|
||||
Custom Command: "echo "Hello World""
|
||||
SourceFilePath: "src/b.txt"
|
||||
Custom Command: "echo "Hello World""
|
||||
SourceFilePath: "src/included/a.txt"
|
||||
Custom Command: "echo "Hello World""
|
||||
@@ -0,0 +1 @@
|
||||
.
|
||||
@@ -0,0 +1 @@
|
||||
.
|
||||
@@ -0,0 +1 @@
|
||||
.
|
||||
@@ -0,0 +1 @@
|
||||
.
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "SourceGroupFactory.h"
|
||||
#include "SourceGroupFactoryModuleCxx.h"
|
||||
#include "SourceGroupFactoryModuleJava.h"
|
||||
#include "SourceGroupFactoryModuleCustom.h"
|
||||
#include "QtNetworkFactory.h"
|
||||
#include "QtApplication.h"
|
||||
#include "QtCoreApplication.h"
|
||||
@@ -184,6 +185,7 @@ void addLanguagePackages()
|
||||
{
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCxx>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleJava>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCustom>());
|
||||
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageJava>());
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageCxx>());
|
||||
|
||||
@@ -15,10 +15,10 @@ void setupLogging(const FilePath& logFilePath)
|
||||
{
|
||||
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);
|
||||
// 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);
|
||||
|
||||
std::shared_ptr<FileLogger> fileLogger = std::make_shared<FileLogger>();
|
||||
fileLogger->setLogFilePath(logFilePath);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -76,7 +76,7 @@ add_files(
|
||||
data/parser/cxx/PreprocessorCallbacks.h
|
||||
data/parser/cxx/utilityClang.cpp
|
||||
data/parser/cxx/utilityClang.h
|
||||
|
||||
|
||||
project/SourceGroupCxxCdb.cpp
|
||||
project/SourceGroupCxxCdb.h
|
||||
project/SourceGroupCxxCodeblocks.cpp
|
||||
@@ -106,9 +106,7 @@ add_files(
|
||||
utility/IncludeDirective.h
|
||||
utility/IncludeProcessing.cpp
|
||||
utility/IncludeProcessing.h
|
||||
utility/utilitySourceGroupCxx.cpp
|
||||
utility/utilitySourceGroupCxx.h
|
||||
|
||||
|
||||
LanguagePackageCxx.cpp
|
||||
LanguagePackageCxx.h
|
||||
)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "ApplicationSettings.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "utility.h"
|
||||
#include "utilitySourceGroupCxx.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxCdb::SourceGroupCxxCdb(std::shared_ptr<SourceGroupSettingsCxxCdb> settings)
|
||||
@@ -40,7 +39,7 @@ bool SourceGroupCxxCdb::prepareIndexing()
|
||||
|
||||
std::set<FilePath> SourceGroupCxxCdb::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return utility::filterToContainedFilePaths(
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()),
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "MessageStatus.h"
|
||||
#include "CodeblocksProject.h"
|
||||
#include "utility.h"
|
||||
#include "utilitySourceGroupCxx.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxCodeblocks::SourceGroupCxxCodeblocks(std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings)
|
||||
@@ -39,7 +38,7 @@ bool SourceGroupCxxCodeblocks::prepareIndexing()
|
||||
|
||||
std::set<FilePath> SourceGroupCxxCodeblocks::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return utility::filterToContainedFilePaths(
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()),
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "SourceGroupSettingsWithCStandard.h"
|
||||
#include "FileManager.h"
|
||||
#include "utility.h"
|
||||
#include "utilitySourceGroupCxx.h"
|
||||
|
||||
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings)
|
||||
: m_settings(settings)
|
||||
@@ -33,7 +32,7 @@ std::set<FilePath> SourceGroupCxxEmpty::filterToContainedFilePaths(const std::se
|
||||
excludeFilters = settings->getExcludeFiltersExpandedAndAbsolute();
|
||||
}
|
||||
|
||||
return utility::filterToContainedFilePaths(
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
std::set<FilePath>(),
|
||||
utility::toSet(indexedPaths),
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "MessageStatus.h"
|
||||
#include "SonargraphProject.h"
|
||||
#include "utility.h"
|
||||
#include "utilitySourceGroupCxx.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxSonargraph::SourceGroupCxxSonargraph(std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings)
|
||||
@@ -39,7 +38,7 @@ bool SourceGroupCxxSonargraph::prepareIndexing()
|
||||
|
||||
std::set<FilePath> SourceGroupCxxSonargraph::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return utility::filterToContainedFilePaths(
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()),
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#include "utilitySourceGroupCxx.h"
|
||||
|
||||
std::set<FilePath> utility::filterToContainedFilePaths(
|
||||
const std::set<FilePath>& filePaths,
|
||||
const std::set<FilePath>& indexedFilePaths,
|
||||
const std::set<FilePath>& indexedFileOrDirectoryPaths,
|
||||
const std::vector<FilePathFilter>& excludeFilters)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef UTILITY_SOURCE_GROUP_CXX_H
|
||||
#define UTILITY_SOURCE_GROUP_CXX_H
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "FilePathFilter.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
std::set<FilePath> filterToContainedFilePaths(
|
||||
const std::set<FilePath>& filePaths,
|
||||
const std::set<FilePath>& indexedFilePaths,
|
||||
const std::set<FilePath>& indexedFileOrDirectoryPaths,
|
||||
const std::vector<FilePathFilter>& excludeFilters);
|
||||
}
|
||||
|
||||
#endif // UTILITY_SOURCE_GROUP_CXX_H
|
||||
@@ -203,6 +203,8 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCustomCommand.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCustomCommand.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
|
||||
|
||||
@@ -266,6 +266,23 @@ void QtDialogView::updateIndexingDialog(
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::updateCustomIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths)
|
||||
{
|
||||
updateIndexingDialog(startedFileCount, finishedFileCount, totalFileCount, sourcePaths);
|
||||
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
if (window && window->getType() == QtIndexingDialog::DIALOG_INDEXING)
|
||||
{
|
||||
window->updateTitle("Executing Commands");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DatabasePolicy QtDialogView::finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted)
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing) override;
|
||||
void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
|
||||
void updateCustomIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
|
||||
DatabasePolicy finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted) override;
|
||||
|
||||
@@ -124,6 +124,11 @@ void QtStatusView::addStatus(const std::vector<Status>& status)
|
||||
QString statusType = (s.type == StatusType::STATUS_ERROR ? "ERROR" : "INFO");
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::TYPE, new QStandardItem(statusType));
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::STATUS, new QStandardItem(QString::fromStdWString(s.message)));
|
||||
|
||||
if (s.type == StatusType::STATUS_ERROR)
|
||||
{
|
||||
m_model->item(rowNumber, STATUSVIEW_COLUMN::TYPE)->setForeground(QBrush(Qt::red));
|
||||
}
|
||||
}
|
||||
|
||||
m_table->updateRows();
|
||||
|
||||
@@ -294,6 +294,14 @@ void QtIndexingDialog::setupProgress(bool hideable)
|
||||
finishSetup();
|
||||
}
|
||||
|
||||
void QtIndexingDialog::updateTitle(const QString& title)
|
||||
{
|
||||
if (m_title)
|
||||
{
|
||||
m_title->setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
void QtIndexingDialog::updateMessage(const QString& message)
|
||||
{
|
||||
if (m_messageLabel)
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
void setupUnknownProgress(bool hideable);
|
||||
void setupProgress(bool hideable);
|
||||
|
||||
void updateTitle(const QString& title);
|
||||
void updateMessage(const QString& message);
|
||||
std::wstring getMessage() const;
|
||||
void updateProgress(size_t progress);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "QtProjectWizzardContentCppStandard.h"
|
||||
#include "QtProjectWizzardContentCrossCompilationOptions.h"
|
||||
#include "QtProjectWizzardContentCStandard.h"
|
||||
#include "QtProjectWizzardContentCustomCommand.h"
|
||||
#include "QtProjectWizzardContentExtensions.h"
|
||||
#include "QtProjectWizzardContentFlags.h"
|
||||
#include "QtProjectWizzardContentJavaStandard.h"
|
||||
@@ -25,6 +26,7 @@
|
||||
#include "QtSourceGroupWizzardPage.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCdbVs.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
@@ -116,7 +118,7 @@ namespace
|
||||
{
|
||||
QtSourceGroupWizzardPage<SourceGroupSettingsCEmpty> page("Framework Search Paths");
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsFrameworkSearch>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorSimple<QtProjectWizzardContentPathsFrameworkSearchGlobal>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorSimple<QtProjectWizzardContentPathsFrameworkSearchGlobal>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
pages.push_back(page);
|
||||
}
|
||||
{
|
||||
@@ -148,7 +150,7 @@ namespace
|
||||
{
|
||||
QtSourceGroupWizzardPage<SourceGroupSettingsCppEmpty> page("Include Paths");
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsHeaderSearch>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorSimple<QtProjectWizzardContentPathsHeaderSearchGlobal>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorSimple<QtProjectWizzardContentPathsHeaderSearchGlobal>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
pages.push_back(page);
|
||||
}
|
||||
if (utility::getOsType() == OS_MAC)
|
||||
@@ -402,6 +404,21 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsCustomCommand>> getSourceGroupWizzardPages<SourceGroupSettingsCustomCommand>()
|
||||
{
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsCustomCommand>> pages;
|
||||
{
|
||||
QtSourceGroupWizzardPage<SourceGroupSettingsCustomCommand> page("Indexed Paths");
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentCustomCommand>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
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 <typename SettingsType>
|
||||
void fillSummary(QtProjectWizzardContentGroup* summary, std::shared_ptr<SettingsType> settings, QtProjectWizzardWindow* window)
|
||||
{
|
||||
@@ -476,7 +493,7 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath)
|
||||
std::make_shared<SourceGroupSettingsCxxCdbVs>(utility::getUuidString(), m_projectSettings.get());
|
||||
sourceGroupSettings->setCompilationDatabasePath(filePath);
|
||||
|
||||
executeSoureGroupSetup<SourceGroupSettingsCxxCdbVs>(sourceGroupSettings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxCdbVs>(sourceGroupSettings);
|
||||
}
|
||||
|
||||
void QtProjectWizzard::editProject(const FilePath& settingsPath)
|
||||
@@ -633,7 +650,7 @@ void QtProjectWizzard::handlePrevious()
|
||||
}
|
||||
|
||||
template <typename SettingsType>
|
||||
void QtProjectWizzard::executeSoureGroupSetup(std::shared_ptr<SettingsType> settings)
|
||||
void QtProjectWizzard::executeSourceGroupSetup(std::shared_ptr<SettingsType> settings)
|
||||
{
|
||||
std::shared_ptr<QtSourceGroupWizzard<SettingsType>> wizzard = std::make_shared<QtSourceGroupWizzard<SettingsType>>(
|
||||
settings,
|
||||
@@ -825,6 +842,10 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
|
||||
setContent(summary);
|
||||
|
||||
@@ -1003,46 +1024,46 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCEmpty> settings = std::make_shared<SourceGroupSettingsCEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
addMsvcCompatibilityFlagsOnDemand(settings);
|
||||
executeSoureGroupSetup<SourceGroupSettingsCEmpty>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCEmpty>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCppEmpty> settings = std::make_shared<SourceGroupSettingsCppEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
addMsvcCompatibilityFlagsOnDemand(settings);
|
||||
executeSoureGroupSetup<SourceGroupSettingsCppEmpty>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCppEmpty>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdb> settings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
|
||||
executeSoureGroupSetup<SourceGroupSettingsCxxCdb>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxCdb>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(sourceGroupId, m_projectSettings.get());
|
||||
addMsvcCompatibilityFlagsOnDemand(settings);
|
||||
executeSoureGroupSetup<SourceGroupSettingsCxxCodeblocks>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxCodeblocks>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::make_shared<SourceGroupSettingsCxxSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
addMsvcCompatibilityFlagsOnDemand(settings);
|
||||
executeSoureGroupSetup<SourceGroupSettingsCxxSonargraph>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdbVs> settings = std::make_shared<SourceGroupSettingsCxxCdbVs>(sourceGroupId, m_projectSettings.get());
|
||||
executeSoureGroupSetup<SourceGroupSettingsCxxCdbVs>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsCxxCdbVs>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaEmpty> settings = std::make_shared<SourceGroupSettingsJavaEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
executeSoureGroupSetup<SourceGroupSettingsJavaEmpty>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaEmpty>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_MAVEN:
|
||||
@@ -1056,7 +1077,7 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
L"/maven"
|
||||
)
|
||||
);
|
||||
executeSoureGroupSetup<SourceGroupSettingsJavaMaven>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaMaven>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
@@ -1070,13 +1091,19 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
L"/gradle"
|
||||
)
|
||||
);
|
||||
executeSoureGroupSetup<SourceGroupSettingsJavaGradle>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaGradle>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::make_shared<SourceGroupSettingsJavaSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
executeSoureGroupSetup<SourceGroupSettingsJavaSonargraph>(settings);
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::make_shared<SourceGroupSettingsCustomCommand>(sourceGroupId, m_projectSettings.get());
|
||||
executeSourceGroupSetup<SourceGroupSettingsCustomCommand>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
|
||||
private:
|
||||
template <typename SettingsType>
|
||||
void executeSoureGroupSetup(std::shared_ptr<SettingsType> settings);
|
||||
void executeSourceGroupSetup(std::shared_ptr<SettingsType> settings);
|
||||
|
||||
QtProjectWizzardWindow* createWindowWithContent(
|
||||
std::function<QtProjectWizzardContent*(QtProjectWizzardWindow*)> func);
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#include "QtProjectWizzardContentCustomCommand.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "ProjectSettings.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SqliteIndexStorage.h"
|
||||
|
||||
QtProjectWizzardContentCustomCommand::QtProjectWizzardContentCustomCommand(
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> settings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_settings(settings)
|
||||
, m_customCommand(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCustomCommand::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
QLabel* nameLabel = createFormLabel("Custom Command");
|
||||
addHelpButton(
|
||||
"Custom Command",
|
||||
"<p>Specify the commandline call that will be executed for each source file in this Source Group. "
|
||||
"You can use the following variables, $SOURCE_PATH is mandatory.</p>"
|
||||
"<ul>"
|
||||
"<li><b>$SOURCE_PATH</b> - Path to each source file (mandatory)</li>"
|
||||
"<li><b>$PROJECT_PATH</b> - Path to project file: \"" +
|
||||
QString::fromStdWString(m_settings->getProjectSettings()->getProjectFilePath().wstr()) + "\"</li>"
|
||||
"<li><b>$DB_PATH</b> - Path to database file: \"" +
|
||||
QString::fromStdWString(m_settings->getProjectSettings()->getTempDBFilePath().wstr()) + "\"</li>"
|
||||
"<li><b>$STORAGE_VERSION</b> - Storage version used by this Sourcetrail version: \"" +
|
||||
QString::number(SqliteIndexStorage::getStorageVersion()) + "\"</li>"
|
||||
"</ul>",
|
||||
layout, row
|
||||
);
|
||||
|
||||
m_customCommand = new QLineEdit();
|
||||
m_customCommand->setObjectName("name");
|
||||
m_customCommand->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
|
||||
layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_customCommand, row, QtProjectWizzardWindow::BACK_COL);
|
||||
layout->setRowMinimumHeight(row, 30);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCustomCommand::load()
|
||||
{
|
||||
m_customCommand->setText(QString::fromStdWString(m_settings->getCustomCommand()));
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCustomCommand::save()
|
||||
{
|
||||
m_settings->setCustomCommand(m_customCommand->text().toStdWString());
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentCustomCommand::check()
|
||||
{
|
||||
if (m_customCommand->text().isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please enter a custom command.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_customCommand->text().toStdWString().find(L"$SOURCE_PATH") == std::wstring::npos)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The variable $SOURCE_PATH is missing in the custom command.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_CUSTOM_COMMAND_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_CUSTOM_COMMAND_H
|
||||
|
||||
#include "QtProjectWizzardContent.h"
|
||||
|
||||
class QLineEdit;
|
||||
class SourceGroupSettingsCustomCommand;
|
||||
|
||||
class QtProjectWizzardContentCustomCommand
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCustomCommand(
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> settings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> m_settings;
|
||||
|
||||
QLineEdit* m_customCommand;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_CUSTOM_COMMAND_H
|
||||
@@ -8,12 +8,14 @@
|
||||
|
||||
#include "DialogView.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "QtDialogView.h"
|
||||
#include "QtPathListDialog.h"
|
||||
#include "QtSelectPathsDialog.h"
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsCxx.h"
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
@@ -252,6 +254,10 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
|
||||
{
|
||||
allSourceFilePaths = SourceGroupJavaEmpty(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupCustomCommand(settings).getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
return utility::getAsRelativeIfShorter(
|
||||
utility::toVector(allSourceFilePaths),
|
||||
|
||||
@@ -42,6 +42,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_MAVEN));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_CUSTOM].push_back(SourceGroupInfo(SOURCE_GROUP_CUSTOM_COMMAND));
|
||||
|
||||
// define which icons should be used for which kind of source group
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_C_EMPTY] = L"empty_icon";
|
||||
@@ -54,6 +55,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_CUSTOM_COMMAND] = L"empty_icon";
|
||||
|
||||
// define descriptions for each kind of Source Group
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_C_EMPTY] = "Create a new Sourcetrail Source Group by defining which C files will be indexed.";
|
||||
@@ -78,9 +80,12 @@ 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_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";
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout();
|
||||
vlayout->setContentsMargins(0, 30, 0, 0);
|
||||
vlayout->setContentsMargins(0, 10, 0, 0);
|
||||
vlayout->setSpacing(10);
|
||||
|
||||
m_languages = new QButtonGroup();
|
||||
|
||||
@@ -96,7 +96,8 @@ int utility::executeProcessAndGetExitCode(
|
||||
const std::wstring& commandPath,
|
||||
const std::vector<std::wstring>& commandArguments,
|
||||
const FilePath& workingDirectory,
|
||||
const int timeout
|
||||
const int timeout,
|
||||
std::wstring* processOutput
|
||||
){
|
||||
QProcess process;
|
||||
|
||||
@@ -124,7 +125,14 @@ int utility::executeProcessAndGetExitCode(
|
||||
}
|
||||
|
||||
int exitCode = process.exitCode();
|
||||
|
||||
if (processOutput != nullptr)
|
||||
{
|
||||
*processOutput = utility::trim(QString(process.readAll()).toStdWString());
|
||||
}
|
||||
|
||||
process.close();
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace utility
|
||||
const std::wstring& commandPath,
|
||||
const std::vector<std::wstring>& commandArguments,
|
||||
const FilePath& workingDirectory = FilePath(),
|
||||
const int timeout = 30000
|
||||
const int timeout = 30000,
|
||||
std::wstring* processOutput = nullptr
|
||||
);
|
||||
|
||||
void killRunningProcesses();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "IndexerCommandJava.h"
|
||||
#include "JavaEnvironmentFactory.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "SourceGroupCxxCdb.h"
|
||||
#include "SourceGroupCxxCodeblocks.h"
|
||||
#include "SourceGroupCxxSonargraph.h"
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "SourceGroupJavaGradle.h"
|
||||
#include "SourceGroupJavaMaven.h"
|
||||
@@ -18,6 +20,7 @@
|
||||
#include "SourceGroupSettingsCxxCdb.h"
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
@@ -389,6 +392,22 @@ public:
|
||||
applicationSettings->setJreSystemLibraryPaths(storedJreSystemLibraryPaths);
|
||||
}
|
||||
|
||||
void test_source_group_custom_command_generates_expected_output()
|
||||
{
|
||||
const std::wstring projectName = L"custom_command";
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.setProjectFilePath(L"non_existent_project", getInputDirectoryPath(projectName));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> sourceGroupSettings = std::make_shared<SourceGroupSettingsCustomCommand>("fake_id", &projectSettings);
|
||||
sourceGroupSettings->setCustomCommand(L"echo \"Hello World\"");
|
||||
sourceGroupSettings->setSourcePaths({ getInputDirectoryPath(projectName).concatenate(L"/src") });
|
||||
sourceGroupSettings->setSourceExtensions({ L".txt" });
|
||||
sourceGroupSettings->setExcludeFilterStrings({ L"**/excluded/**" });
|
||||
|
||||
generateAndCompareExpectedOutput(projectName, std::make_shared<SourceGroupCustomCommand>(sourceGroupSettings));
|
||||
}
|
||||
|
||||
// Special Tests
|
||||
|
||||
void test_sourcegroup_java_sonargraph_with_cpp_modules_does_not_generate_output()
|
||||
@@ -546,6 +565,10 @@ private:
|
||||
{
|
||||
return indexerCommandJavaToString(indexerCommandJava, baseDirectory);
|
||||
}
|
||||
if (std::shared_ptr<const IndexerCommandCustom> indexerCommandCustom = std::dynamic_pointer_cast<const IndexerCommandCustom>(indexerCommand))
|
||||
{
|
||||
return indexerCommandCustomToString(indexerCommandCustom, baseDirectory);
|
||||
}
|
||||
return L"Unsupported indexer command type: " + utility::decodeFromUtf8(indexerCommandTypeToString(indexerCommand->getIndexerCommandType()));
|
||||
}
|
||||
return L"No IndexerCommand provided.";
|
||||
@@ -586,4 +609,12 @@ private:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring indexerCommandCustomToString(std::shared_ptr<const IndexerCommandCustom> indexerCommand, const FilePath& baseDirectory)
|
||||
{
|
||||
std::wstring result;
|
||||
result += L"SourceFilePath: \"" + indexerCommand->getSourceFilePath().getRelativeTo(baseDirectory).wstr() + L"\"\n";
|
||||
result += L"\tCustom Command: \"" + indexerCommand->getCustomCommand() + L"\"\n";
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get absolute path to parent directory of script
|
||||
MY_PATH=`dirname "$0"`
|
||||
if [[ "${MY_PATH}" != *\\* ]]
|
||||
then
|
||||
cd $MY_PATH
|
||||
MY_PATH=`pwd`
|
||||
fi
|
||||
MY_PATH="${MY_PATH//\\//}"
|
||||
|
||||
SRC_PATH=$MY_PATH/data
|
||||
WORKING_COPY_PATH=$MY_PATH/working_copy
|
||||
|
||||
mkdir -p $WORKING_COPY_PATH
|
||||
|
||||
cp -a $SRC_PATH/. $WORKING_COPY_PATH
|
||||
|
||||
echo "Setup Complete"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get absolute path to parent directory of script
|
||||
MY_PATH=`dirname "$0"`
|
||||
if [[ "${MY_PATH}" != *\\* ]]
|
||||
then
|
||||
cd $MY_PATH
|
||||
MY_PATH=`pwd`
|
||||
fi
|
||||
MY_PATH="${MY_PATH//\\//}"
|
||||
|
||||
WORKING_COPY_PATH=$MY_PATH/working_copy
|
||||
|
||||
rm -rf $WORKING_COPY_PATH
|
||||
|
||||
echo "Teardown Complete"
|
||||
@@ -0,0 +1,38 @@
|
||||
* Run "1_setup.sh"
|
||||
* Start up Sourcetrail
|
||||
* Click "New Project"
|
||||
* Enter a project name
|
||||
* Set "./working_copy" as project location
|
||||
* Click "Add Source Group"
|
||||
* Select "Custom" -> "Custom Command Source Group"
|
||||
* Click "Next"
|
||||
* Click "Next"
|
||||
* Add "python add.py $PROJECT_PATH $DB_PATH $STORAGE_VERSION $SOURCE_PATH" to "Custom Command"
|
||||
* Add "./src" to "Files & Directories to Index"
|
||||
* Add "**excl.txt" to "Excluded Files & Directories"
|
||||
* Add ".txt" to "Source File Extensions"
|
||||
* Click "Next"
|
||||
* Click "Create"
|
||||
* Validate "All files" is the only option selectable
|
||||
* Validate "source files to index" shows "3"
|
||||
* Click "Start"
|
||||
* Validate Project indexed without error
|
||||
* Click "OK"
|
||||
* Validate "out.txt" contains 3 lines:
|
||||
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/a.txt
|
||||
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/b.txt
|
||||
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/c.txt
|
||||
* Press "Refresh" button
|
||||
* Validate "Updated files" is selected
|
||||
* Validate "source files to index" shows "3" again
|
||||
* Click "Cancel"
|
||||
* Click "Edit Project"
|
||||
* Change "Custom Command" to "pyt add.py"
|
||||
* Click "Next"
|
||||
* Validate "Warning appears that $SOURCE_PATH is not defined in command"
|
||||
* Change "Custom Command" to "pyt add.py $SOURCE_PATH"
|
||||
* Click "Refresh" button
|
||||
* Click "Start"
|
||||
* Validate "Log View appears showing errors that command execution failed".
|
||||
* Close Sourcetrail
|
||||
* Run "2_teardown.sh"
|
||||
@@ -0,0 +1,6 @@
|
||||
import sys
|
||||
# import time
|
||||
# time.sleep(1)
|
||||
|
||||
with open("out.txt", "a") as myfile:
|
||||
myfile.write(sys.argv[1] + ' ' + sys.argv[2] + ' ' + sys.argv[3] + ' ' + sys.argv[4] + '\n')
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user