logic: added Gradle project setup (issue #379)
* added implementation for Gradle project setup (icon is still missing) * refactored project loading/saving and SourceGroupSettings * removed long deprecated Cxx UseSourcePathsForHeaderSearch option fortune cookie message = There is true and sincere friendship between you and your friends.
This commit is contained in:
@@ -16,12 +16,14 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentProjectData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceGroupData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentVS.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsJava.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsJavaEmpty.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
@@ -85,8 +87,8 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve
|
||||
|
||||
cancelSourceGroup();
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxx> sourceGroupSettings =
|
||||
std::make_shared<SourceGroupSettingsCxx>(utility::getUuidString(), SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdb> sourceGroupSettings =
|
||||
std::make_shared<SourceGroupSettingsCxxCdb>(utility::getUuidString(), m_projectSettings.get());
|
||||
sourceGroupSettings->setCompilationDatabasePath(filePath);
|
||||
sourceGroupSettings->setSourcePaths(headerPaths);
|
||||
m_newSourceGroupSettings = sourceGroupSettings;
|
||||
@@ -388,51 +390,39 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
summary->addContent(content);
|
||||
summary->addSpace();
|
||||
|
||||
if (group->getType() == SOURCE_GROUP_JAVA_EMPTY || group->getType() == SOURCE_GROUP_JAVA_MAVEN)
|
||||
if (std::shared_ptr<SourceGroupSettingsJava> settingsJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(group))
|
||||
{
|
||||
bool isMaven = false;
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJava>(group);
|
||||
if (javaSettings)
|
||||
{
|
||||
isMaven = javaSettings->getMavenProjectFilePathExpandedAndAbsolute().exists();
|
||||
}
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addSpace();
|
||||
|
||||
if (isMaven)
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathSourceMaven(group, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(group, this));
|
||||
}
|
||||
else
|
||||
if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settingsJavaEmpty = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathsClassJava(group, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaGradle> settingsJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathSourceGradle(group, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathDependenciesGradle(group, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaMaven> settingsJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathSourceMaven(group, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(group, this));
|
||||
}
|
||||
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(group, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
|
||||
}
|
||||
else
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxx> settingsCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(group))
|
||||
{
|
||||
const bool isCDB = group->getType() == SOURCE_GROUP_CXX_CDB;
|
||||
|
||||
if (isCDB)
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathCDB(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentCDBSource(group, this));
|
||||
summary->addSpace();
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(group, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else
|
||||
bool isCDB = false;
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> settingsCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addSpace();
|
||||
@@ -443,16 +433,20 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(group, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> settingsCxxCdb = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(group))
|
||||
{
|
||||
isCDB = true;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathCDB(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentCDBSource(group, this));
|
||||
summary->addSpace();
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(group, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(group, this, isCDB));
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(group);
|
||||
if (!isCDB && cxxSettings && cxxSettings->getHasDefinedUseSourcePathsForHeaderSearch())
|
||||
{
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentSimple(group, this));
|
||||
}
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(this));
|
||||
summary->addSpace();
|
||||
|
||||
@@ -526,15 +520,26 @@ void QtProjectWizzard::duplicateSelectedSourceGroup()
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> oldSourceGroup = m_allSourceGroupSettings[m_sourceGroupList->currentRow()];
|
||||
std::shared_ptr<SourceGroupSettings> newSourceGroup;
|
||||
|
||||
if (oldSourceGroup->getType() == SOURCE_GROUP_JAVA_EMPTY || oldSourceGroup->getType() == SOURCE_GROUP_JAVA_MAVEN)
|
||||
std::shared_ptr<SourceGroupSettings> newSourceGroup;
|
||||
switch (oldSourceGroup->getType())
|
||||
{
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJava>(*dynamic_cast<SourceGroupSettingsJava*>(oldSourceGroup.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxx>(*dynamic_cast<SourceGroupSettingsCxx*>(oldSourceGroup.get()));
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJavaEmpty>(*dynamic_cast<SourceGroupSettingsJavaEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_MAVEN:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJavaMaven>(*dynamic_cast<SourceGroupSettingsJavaMaven*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJavaGradle>(*dynamic_cast<SourceGroupSettingsJavaGradle*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxEmpty>(*dynamic_cast<SourceGroupSettingsCxxEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCdb>(*dynamic_cast<SourceGroupSettingsCxxCdb*>(oldSourceGroup.get()));
|
||||
break;
|
||||
}
|
||||
|
||||
newSourceGroup->setId(utility::getUuidString());
|
||||
@@ -613,7 +618,7 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
{
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxEmpty>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
if (applicationSettingsContainVisualStudioHeaderSearchPaths())
|
||||
{
|
||||
std::vector<std::string> flags;
|
||||
@@ -625,22 +630,25 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
emptySourceGroup();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCDB();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
m_newSourceGroupSettings =
|
||||
std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCDBVS();
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJava>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJavaEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroup();
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_MAVEN:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJava>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJavaMaven>(sourceGroupId, m_projectSettings.get());
|
||||
sourcePathsJavaMaven();
|
||||
break;
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJavaGradle>(sourceGroupId, m_projectSettings.get());
|
||||
sourcePathsJavaGradle();
|
||||
break;
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
@@ -786,7 +794,7 @@ void QtProjectWizzard::sourcePathsJava()
|
||||
|
||||
void QtProjectWizzard::sourcePathsJavaMaven()
|
||||
{
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_newSourceGroupSettings)->setMavenDependenciesDirectory(
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_newSourceGroupSettings)->setMavenDependenciesDirectory(
|
||||
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/" + m_newSourceGroupSettings->getId() + "/maven")
|
||||
);
|
||||
|
||||
@@ -803,6 +811,25 @@ void QtProjectWizzard::sourcePathsJavaMaven()
|
||||
window->updateSubTitle("Indexed Paths");
|
||||
}
|
||||
|
||||
void QtProjectWizzard::sourcePathsJavaGradle()
|
||||
{
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_newSourceGroupSettings)->setGradleDependenciesDirectory(
|
||||
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/" + m_newSourceGroupSettings->getId() + "/gradle")
|
||||
);
|
||||
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathSourceGradle(m_newSourceGroupSettings, window));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentPathDependenciesGradle(m_newSourceGroupSettings, window));
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::advancedSettingsJava);
|
||||
window->updateSubTitle("Indexed Paths");
|
||||
}
|
||||
|
||||
void QtProjectWizzard::advancedSettingsCxx()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
|
||||
@@ -97,6 +97,7 @@ private slots:
|
||||
|
||||
void sourcePathsJava();
|
||||
void sourcePathsJavaMaven();
|
||||
void sourcePathsJavaGradle();
|
||||
|
||||
void advancedSettingsCxx();
|
||||
void advancedSettingsJava();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
|
||||
|
||||
#include "data/indexer/IndexerCommandCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource(
|
||||
@@ -35,14 +35,12 @@ void QtProjectWizzardContentCDBSource::load()
|
||||
const FilePath projectPath = m_settings->getProjectFileLocation();
|
||||
std::vector<FilePath> excludePaths = m_settings->getExcludePathsExpandedAndAbsolute();
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
|
||||
if (cxxSettings)
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
|
||||
{
|
||||
FilePath cdbPath = cxxSettings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
if (!cdbPath.empty() && cdbPath.exists())
|
||||
{
|
||||
std::vector<FilePath> filePaths =
|
||||
IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
|
||||
std::vector<FilePath> filePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
|
||||
|
||||
for (FilePath& path : filePaths)
|
||||
{
|
||||
|
||||
+7
-8
@@ -4,8 +4,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QtProjectWizzardContentCrossCompilationOptions::QtProjectWizzardContentCrossCompilationOptions(
|
||||
@@ -61,7 +60,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
|
||||
QLabel* label = new QLabel("Architecture:");
|
||||
|
||||
m_arch = new QComboBox();
|
||||
std::vector<std::string> archTypes = SourceGroupSettingsCxx::getAvailableArchTypes();
|
||||
std::vector<std::string> archTypes = SourceGroupSettingsCxxEmpty::getAvailableArchTypes();
|
||||
std::sort(archTypes.begin(), archTypes.end());
|
||||
for (size_t i = 0; i < archTypes.size(); i++)
|
||||
{
|
||||
@@ -77,7 +76,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
|
||||
QLabel* label = new QLabel("Vendor:");
|
||||
|
||||
m_vendor = new QComboBox();
|
||||
std::vector<std::string> vendorTypes = SourceGroupSettingsCxx::getAvailableVendorTypes();
|
||||
std::vector<std::string> vendorTypes = SourceGroupSettingsCxxEmpty::getAvailableVendorTypes();
|
||||
std::sort(vendorTypes.begin() + 1, vendorTypes.end());
|
||||
for (size_t i = 0; i < vendorTypes.size(); i++)
|
||||
{
|
||||
@@ -92,7 +91,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
|
||||
QLabel* label = new QLabel("OS:");
|
||||
|
||||
m_sys = new QComboBox();
|
||||
std::vector<std::string> osTypes = SourceGroupSettingsCxx::getAvailableOsTypes();
|
||||
std::vector<std::string> osTypes = SourceGroupSettingsCxxEmpty::getAvailableOsTypes();
|
||||
std::sort(osTypes.begin() + 1, osTypes.end());
|
||||
for (size_t i = 0; i < osTypes.size(); i++)
|
||||
{
|
||||
@@ -107,7 +106,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
|
||||
QLabel* label = new QLabel("Environment:");
|
||||
|
||||
m_abi = new QComboBox();
|
||||
std::vector<std::string> environmentTypes = SourceGroupSettingsCxx::getAvailableEnvironmentTypes();
|
||||
std::vector<std::string> environmentTypes = SourceGroupSettingsCxxEmpty::getAvailableEnvironmentTypes();
|
||||
std::sort(environmentTypes.begin() + 1, environmentTypes.end());
|
||||
for (size_t i = 0; i < environmentTypes.size(); i++)
|
||||
{
|
||||
@@ -129,7 +128,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
|
||||
|
||||
void QtProjectWizzardContentCrossCompilationOptions::load()
|
||||
{
|
||||
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings))
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(m_sourceGroupSettings))
|
||||
{
|
||||
m_useTargetOptions->setChecked(cxxSettings->getTargetOptionsEnabled());
|
||||
m_arch->setCurrentText(QString::fromStdString(cxxSettings->getTargetArch()));
|
||||
@@ -143,7 +142,7 @@ void QtProjectWizzardContentCrossCompilationOptions::load()
|
||||
|
||||
void QtProjectWizzardContentCrossCompilationOptions::save()
|
||||
{
|
||||
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings))
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(m_sourceGroupSettings))
|
||||
{
|
||||
cxxSettings->setTargetOptionsEnabled(m_useTargetOptions->isChecked());
|
||||
cxxSettings->setTargetArch(m_arch->currentText().toStdString());
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
#include "qt/element/QtLocationPicker.h"
|
||||
#include "qt/view/QtDialogView.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsJava.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
#include "utility/utilityGradle.h"
|
||||
#include "utility/utilityMaven.h"
|
||||
|
||||
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
|
||||
@@ -140,21 +142,21 @@ void QtProjectWizzardContentPathCDB::populate(QGridLayout* layout, int& row)
|
||||
|
||||
void QtProjectWizzardContentPathCDB::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
|
||||
if (cxxSettings)
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdb> settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdString(cxxSettings->getCompilationDatabasePath().str()));
|
||||
m_picker->setText(QString::fromStdString(settings->getCompilationDatabasePath().str()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathCDB::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
|
||||
if (cxxSettings)
|
||||
std::shared_ptr<SourceGroupSettingsCxxCdb> m_settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
|
||||
if (m_settings)
|
||||
{
|
||||
cxxSettings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdString()));
|
||||
m_settings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,30 +202,30 @@ void QtProjectWizzardContentPathSourceMaven::populate(QGridLayout* layout, int&
|
||||
|
||||
void QtProjectWizzardContentPathSourceMaven::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
|
||||
if (javaSettings)
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdString(javaSettings->getMavenProjectFilePath().str()));
|
||||
m_shouldIndexTests->setChecked(javaSettings->getShouldIndexMavenTests());
|
||||
m_picker->setText(QString::fromStdString(settings->getMavenProjectFilePath().str()));
|
||||
m_shouldIndexTests->setChecked(settings->getShouldIndexMavenTests());
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathSourceMaven::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
|
||||
if (javaSettings)
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
javaSettings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdString()));
|
||||
javaSettings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
|
||||
settings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames() const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
|
||||
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
|
||||
const FilePath mavenProjectRoot = javaSettings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
|
||||
const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
|
||||
|
||||
std::vector<std::string> list;
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
@@ -251,7 +253,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
||||
const std::vector<FilePath> sourceDirectories = utility::mavenGetAllDirectoriesFromEffectivePom(
|
||||
mavenPath,
|
||||
mavenProjectRoot,
|
||||
javaSettings->getShouldIndexMavenTests()
|
||||
settings->getShouldIndexMavenTests()
|
||||
);
|
||||
|
||||
FileManager fileManager;
|
||||
@@ -277,6 +279,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDependenciesMaven(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
@@ -292,18 +295,149 @@ QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDepende
|
||||
|
||||
void QtProjectWizzardContentPathDependenciesMaven::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
|
||||
if (javaSettings)
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdString(javaSettings->getMavenDependenciesDirectory().str()));
|
||||
m_picker->setText(QString::fromStdString(settings->getMavenDependenciesDirectory().str()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathDependenciesMaven::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
|
||||
if (javaSettings)
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
javaSettings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathSourceGradle::QtProjectWizzardContentPathSourceGradle(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPath(settings, window)
|
||||
{
|
||||
setTitleString("Gradle Project File (build.gradle)");
|
||||
setHelpString(
|
||||
"Enter the path to the main build.gradle file of your Gradle project.<br />"
|
||||
"<br />"
|
||||
"You can make use of environment variables with ${ENV_VAR}."
|
||||
);
|
||||
setFileEndings({ ".gradle" });
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathSourceGradle::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
QtProjectWizzardContentPath::populate(layout, row);
|
||||
m_picker->setPickDirectory(false);
|
||||
m_picker->setFileFilter("Gradle Build File (build.gradle)");
|
||||
|
||||
QPushButton* filesButton = addFilesButton("show source files", nullptr, row);
|
||||
m_shouldIndexTests = new QCheckBox("Should Index Tests");
|
||||
|
||||
QHBoxLayout* hlayout = new QHBoxLayout();
|
||||
hlayout->setContentsMargins(0, 0, 0, 0);
|
||||
hlayout->addWidget(m_shouldIndexTests);
|
||||
hlayout->addStretch();
|
||||
hlayout->addWidget(filesButton);
|
||||
|
||||
layout->addLayout(hlayout, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathSourceGradle::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdString(settings->getGradleProjectFilePath().str()));
|
||||
m_shouldIndexTests->setChecked(settings->getShouldIndexGradleTests());
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathSourceGradle::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setGradleProjectFilePath(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setShouldIndexGradleTests(m_shouldIndexTests->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> QtProjectWizzardContentPathSourceGradle::getFileNames() const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
|
||||
const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory();
|
||||
|
||||
std::vector<std::string> list;
|
||||
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
|
||||
ScopedFunctor scopedFunctor([&dialogView]() {
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
});
|
||||
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
{
|
||||
dialogView->showUnknownProgressDialog("Preparing Project", "Gradle\nFetching Source Directories");
|
||||
const std::vector<FilePath> sourceDirectories = utility::gradleGetAllSourceDirectories(
|
||||
gradleProjectRoot,
|
||||
settings->getShouldIndexGradleTests()
|
||||
);
|
||||
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
sourceDirectories,
|
||||
m_settings->getExcludePathsExpandedAndAbsolute(),
|
||||
m_settings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectFileLocation();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
{
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path = path.relativeTo(projectPath);
|
||||
}
|
||||
|
||||
list.push_back(path.str());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathDependenciesGradle::QtProjectWizzardContentPathDependenciesGradle(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPath(settings, window)
|
||||
{
|
||||
setTitleString("Intermediate Dependencies Directory");
|
||||
setHelpString(
|
||||
"This directory is used to temporarily download and store the dependencies (e.g. .jar files) of the Gradle project while it is indexed.<br />"
|
||||
"<br />"
|
||||
"You can make use of environment variables with ${ENV_VAR}."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathDependenciesGradle::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdString(settings->getGradleDependenciesDirectory().str()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathDependenciesGradle::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setGradleDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,37 @@ public:
|
||||
virtual void save() override;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathSourceGradle
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathSourceGradle(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
virtual std::vector<std::string> getFileNames() const override;
|
||||
|
||||
private:
|
||||
QCheckBox* m_shouldIndexTests;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathDependenciesGradle
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathDependenciesGradle(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PATH_H
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "qt/view/QtDialogView.h"
|
||||
#include "qt/window/QtSelectPathsDialog.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsJava.h"
|
||||
#include "utility/CompilationDatabase.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
@@ -269,7 +269,7 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
|
||||
|
||||
if (!m_filesDialog)
|
||||
{
|
||||
FilePath cdbPath = dynamic_cast<SourceGroupSettingsCxx*>(m_settings.get())->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
FilePath cdbPath = dynamic_cast<SourceGroupSettingsCxxCdb*>(m_settings.get())->getCompilationDatabasePathExpandedAndAbsolute(); // TODO: remove this cast
|
||||
if (!cdbPath.exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
|
||||
@@ -35,6 +35,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_MAVEN));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
|
||||
|
||||
// define which icons should be used for which kind of source group
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_C_EMPTY] = "empty_icon";
|
||||
@@ -43,6 +44,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_VS] = "vs_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_EMPTY] = "empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = "mvn_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_GRADLE] = "empty_icon"; // Todo: make and use gradle icon here
|
||||
|
||||
// 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.";
|
||||
@@ -54,7 +56,8 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
"<b>Note: Requires a running Visual Studio instance with the "
|
||||
"<a href=\"https://sourcetrail.com/documentation/index.html#VisualStudio\">Visual Studio plugin</a> installed.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Sourcetrail Source Group by defining which Java files will be indexed.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project.";
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout();
|
||||
vlayout->setContentsMargins(0, 30, 0, 0);
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
|
||||
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_settings(settings)
|
||||
, m_checkBox(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
m_title = createFormLabel("Lazy Include Search (deprecated)");
|
||||
layout->addWidget(m_title, row, QtProjectWizzardWindow::FRONT_COL);
|
||||
|
||||
m_checkBox = new QCheckBox("Search included files within the project paths");
|
||||
layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL);
|
||||
|
||||
addHelpButton(
|
||||
"If enabled Sourcetrail also uses the project paths and their subdirectories when resolving #include directives.<br />"
|
||||
"<br />"
|
||||
"Use this option when you know that the project is self contained but don't know which paths to "
|
||||
"specify as include paths.<br />"
|
||||
"<br />"
|
||||
"<b>Warning</b>: This slows down indexing speed.<br />"
|
||||
"<br />"
|
||||
"<b>Deprecated</b>: This option will be removed in future versions.", layout, row);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::load()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
|
||||
if (cxxSettings)
|
||||
{
|
||||
m_checkBox->setChecked(cxxSettings->getUseSourcePathsForHeaderSearch());
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
|
||||
if (cxxSettings)
|
||||
{
|
||||
cxxSettings->setUseSourcePathsForHeaderSearch(m_checkBox->isChecked());
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QButtonGroup;
|
||||
class SourceGroupSettings;
|
||||
|
||||
class QtProjectWizzardContentSimple
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentSimple(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> m_settings;
|
||||
|
||||
QCheckBox* m_checkBox;
|
||||
QLabel* m_title;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
Reference in New Issue
Block a user