forked from qt-creator/qt-creator
Meson: Use setup functions for a few plugin items
Change-Id: I849698315cd8c03ab44317d90dd3754dcfe46146 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -351,32 +351,39 @@ BuildInfo createBuildInfo(MesonBuildType type)
|
||||
return bInfo;
|
||||
}
|
||||
|
||||
MesonBuildConfigurationFactory::MesonBuildConfigurationFactory()
|
||||
{
|
||||
registerBuildConfiguration<MesonBuildConfiguration>(Constants::MESON_BUILD_CONFIG_ID);
|
||||
setSupportedProjectType(Constants::Project::ID);
|
||||
setSupportedProjectMimeTypeName(Constants::Project::MIMETYPE);
|
||||
setBuildGenerator(
|
||||
[](const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath, bool forSetup) {
|
||||
QList<ProjectExplorer::BuildInfo> result;
|
||||
// MesonBuildConfigurationFactory
|
||||
|
||||
Utils::FilePath path = forSetup
|
||||
? Project::projectDirectory(projectPath)
|
||||
: projectPath;
|
||||
for (const auto &bType : {MesonBuildType::debug,
|
||||
MesonBuildType::release,
|
||||
MesonBuildType::debugoptimized,
|
||||
MesonBuildType::minsize}) {
|
||||
auto bInfo = createBuildInfo(bType);
|
||||
if (forSetup)
|
||||
bInfo.buildDirectory = shadowBuildDirectory(projectPath,
|
||||
k,
|
||||
bInfo.typeName,
|
||||
bInfo.buildType);
|
||||
result << bInfo;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
class MesonBuildConfigurationFactory final : public BuildConfigurationFactory
|
||||
{
|
||||
public:
|
||||
MesonBuildConfigurationFactory()
|
||||
{
|
||||
registerBuildConfiguration<MesonBuildConfiguration>(Constants::MESON_BUILD_CONFIG_ID);
|
||||
setSupportedProjectType(Constants::Project::ID);
|
||||
setSupportedProjectMimeTypeName(Constants::Project::MIMETYPE);
|
||||
setBuildGenerator(
|
||||
[](const Kit *k, const FilePath &projectPath, bool forSetup) {
|
||||
QList<BuildInfo> result;
|
||||
for (const MesonBuildType bType : {MesonBuildType::debug,
|
||||
MesonBuildType::release,
|
||||
MesonBuildType::debugoptimized,
|
||||
MesonBuildType::minsize}) {
|
||||
BuildInfo bInfo = createBuildInfo(bType);
|
||||
if (forSetup)
|
||||
bInfo.buildDirectory = shadowBuildDirectory(projectPath,
|
||||
k,
|
||||
bInfo.typeName,
|
||||
bInfo.buildType);
|
||||
result << bInfo;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
void setupMesonBuildConfiguration()
|
||||
{
|
||||
static MesonBuildConfigurationFactory theMesonBuildConfigurationFactory;
|
||||
}
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -39,10 +39,6 @@ private:
|
||||
QString m_parameters;
|
||||
};
|
||||
|
||||
class MesonBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory
|
||||
{
|
||||
public:
|
||||
MesonBuildConfigurationFactory();
|
||||
};
|
||||
void setupMesonBuildConfiguration();
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -29,10 +29,6 @@ namespace MesonProjectManager::Internal {
|
||||
class MesonProjectPluginPrivate
|
||||
{
|
||||
public:
|
||||
ToolsSettingsPage m_toolslSettingsPage;
|
||||
ToolsSettingsAccessor m_toolsSettings;
|
||||
MesonBuildStepFactory m_buildStepFactory;
|
||||
MesonBuildConfigurationFactory m_buildConfigurationFactory;
|
||||
MesonRunConfigurationFactory m_runConfigurationFactory;
|
||||
MesonActionsManager m_actions;
|
||||
MachineFileManager m_machineFilesManager;
|
||||
@@ -56,6 +52,12 @@ private:
|
||||
{
|
||||
d = new MesonProjectPluginPrivate;
|
||||
|
||||
setupToolsSettingsPage();
|
||||
setupToolsSettingsAccessor();
|
||||
|
||||
setupMesonBuildConfiguration();
|
||||
setupNinjaBuildStep();
|
||||
|
||||
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
|
||||
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "ninjabuildstep.h"
|
||||
|
||||
#include "mesonbuildconfiguration.h"
|
||||
#include "mesonbuildsystem.h"
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "mesonprojectmanagertr.h"
|
||||
@@ -27,8 +26,7 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
const char TARGETS_KEY[] = "MesonProjectManager.BuildStep.BuildTargets";
|
||||
const char TOOL_ARGUMENTS_KEY[] = "MesonProjectManager.BuildStep.AdditionalArguments";
|
||||
@@ -182,13 +180,6 @@ void NinjaBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
||||
});
|
||||
}
|
||||
|
||||
MesonBuildStepFactory::MesonBuildStepFactory()
|
||||
{
|
||||
registerStep<NinjaBuildStep>(Constants::MESON_BUILD_STEP_ID);
|
||||
setSupportedProjectType(Constants::Project::ID);
|
||||
setDisplayName(Tr::tr("Meson Build"));
|
||||
}
|
||||
|
||||
void NinjaBuildStep::setBuildTarget(const QString &targetName)
|
||||
{
|
||||
m_targetName = targetName;
|
||||
@@ -213,5 +204,22 @@ void NinjaBuildStep::fromMap(const Store &map)
|
||||
return AbstractProcessStep::fromMap(map);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
// NinjaBuildStepFactory
|
||||
|
||||
class NinjaBuildStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
NinjaBuildStepFactory()
|
||||
{
|
||||
registerStep<NinjaBuildStep>(Constants::MESON_BUILD_STEP_ID);
|
||||
setSupportedProjectType(Constants::Project::ID);
|
||||
setDisplayName(Tr::tr("Meson Build"));
|
||||
}
|
||||
};
|
||||
|
||||
void setupNinjaBuildStep()
|
||||
{
|
||||
static NinjaBuildStepFactory theNinjaBuildStepFactory;
|
||||
}
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
class NinjaBuildStep final : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
@@ -39,11 +38,6 @@ private:
|
||||
NinjaParser *m_ninjaParser = nullptr;
|
||||
};
|
||||
|
||||
class MesonBuildStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
MesonBuildStepFactory();
|
||||
};
|
||||
void setupNinjaBuildStep();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "toolssettingsaccessor.h"
|
||||
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "mesonprojectmanagertr.h"
|
||||
#include "mesontools.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/settingsaccessor.h>
|
||||
#include <utils/store.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
@@ -20,14 +20,22 @@
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
static Key entryName(int index)
|
||||
{
|
||||
return numberedKey(Constants::ToolsSettings::ENTRY_KEY, index);
|
||||
}
|
||||
|
||||
class ToolsSettingsAccessor final : public UpgradingSettingsAccessor
|
||||
{
|
||||
public:
|
||||
ToolsSettingsAccessor();
|
||||
|
||||
void saveMesonTools(const std::vector<MesonTools::Tool_t> &tools);
|
||||
std::vector<MesonTools::Tool_t> loadMesonTools();
|
||||
};
|
||||
|
||||
ToolsSettingsAccessor::ToolsSettingsAccessor()
|
||||
{
|
||||
setDocType("QtCreatorMesonTools");
|
||||
@@ -81,5 +89,9 @@ std::vector<MesonTools::Tool_t> ToolsSettingsAccessor::loadMesonTools()
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
void setupToolsSettingsAccessor()
|
||||
{
|
||||
static ToolsSettingsAccessor theToolSettingsAccessor;
|
||||
}
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -3,21 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesontools.h"
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
#include <utils/settingsaccessor.h>
|
||||
void setupToolsSettingsAccessor();
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class ToolsSettingsAccessor final : public Utils::UpgradingSettingsAccessor
|
||||
{
|
||||
public:
|
||||
ToolsSettingsAccessor();
|
||||
|
||||
void saveMesonTools(const std::vector<MesonTools::Tool_t> &tools);
|
||||
std::vector<MesonTools::Tool_t> loadMesonTools();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "toolsmodel.h"
|
||||
#include "tooltreeitem.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
@@ -119,13 +121,21 @@ void ToolsSettingsWidget::currentMesonToolChanged(const QModelIndex &newCurrent)
|
||||
m_removeButton->setEnabled(m_currentItem && !m_currentItem->isAutoDetected());
|
||||
}
|
||||
|
||||
|
||||
ToolsSettingsPage::ToolsSettingsPage()
|
||||
class ToolsSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
setId(Constants::SettingsPage::TOOLS_ID);
|
||||
setDisplayName(Tr::tr("Tools"));
|
||||
setCategory(Constants::SettingsPage::CATEGORY);
|
||||
setWidgetCreator([]() { return new ToolsSettingsWidget; });
|
||||
public:
|
||||
ToolsSettingsPage()
|
||||
{
|
||||
setId(Constants::SettingsPage::TOOLS_ID);
|
||||
setDisplayName(Tr::tr("Tools"));
|
||||
setCategory(Constants::SettingsPage::CATEGORY);
|
||||
setWidgetCreator([]() { return new ToolsSettingsWidget; });
|
||||
}
|
||||
};
|
||||
|
||||
void setupToolsSettingsPage()
|
||||
{
|
||||
static ToolsSettingsPage theToolsSettingsPage;
|
||||
}
|
||||
|
||||
} // namespace MesonProjectManager
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
class ToolsSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
ToolsSettingsPage();
|
||||
};
|
||||
void setupToolsSettingsPage();
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user