2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 Alexis Jeandet.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
#include "mesonprojectplugin.h"
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2022-10-06 16:58:18 +02:00
|
|
|
#include "machinefilemanager.h"
|
|
|
|
|
#include "mesonactionsmanager.h"
|
|
|
|
|
#include "mesonbuildconfiguration.h"
|
|
|
|
|
#include "mesonproject.h"
|
|
|
|
|
#include "mesonrunconfiguration.h"
|
|
|
|
|
#include "mesontoolkitaspect.h"
|
|
|
|
|
#include "ninjabuildstep.h"
|
|
|
|
|
#include "ninjatoolkitaspect.h"
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
#include "toolssettingsaccessor.h"
|
|
|
|
|
#include "toolssettingspage.h"
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
2022-06-22 15:43:33 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2020-05-01 18:20:56 +02:00
|
|
|
#include <projectexplorer/projectmanager.h>
|
|
|
|
|
#include <projectexplorer/runcontrol.h>
|
|
|
|
|
|
2022-05-31 11:16:44 +02:00
|
|
|
#include <utils/fsengine/fileiconprovider.h>
|
|
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
using namespace Core;
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
namespace MesonProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class MesonProjectPluginPrivate : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MesonProjectPluginPrivate()
|
|
|
|
|
{
|
|
|
|
|
MesonTools::setTools(m_toolsSettings.loadMesonTools(ICore::dialogParent()));
|
|
|
|
|
connect(ICore::instance(),
|
|
|
|
|
&ICore::saveSettingsRequested,
|
|
|
|
|
this,
|
|
|
|
|
&MesonProjectPluginPrivate::saveAll);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~MesonProjectPluginPrivate() {}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
GeneralSettingsPage m_generalSettingsPage;
|
|
|
|
|
ToolsSettingsPage m_toolslSettingsPage;
|
|
|
|
|
ToolsSettingsAccessor m_toolsSettings;
|
|
|
|
|
MesonToolKitAspect m_mesonKitAspect;
|
|
|
|
|
NinjaToolKitAspect m_ninjaKitAspect;
|
|
|
|
|
MesonBuildStepFactory m_buildStepFactory;
|
|
|
|
|
MesonBuildConfigurationFactory m_buildConfigurationFactory;
|
|
|
|
|
MesonRunConfigurationFactory m_runConfigurationFactory;
|
|
|
|
|
MesonActionsManager m_actions;
|
|
|
|
|
MachineFileManager m_machineFilesManager;
|
|
|
|
|
RunWorkerFactory
|
|
|
|
|
m_mesonRunWorkerFactory{RunWorkerFactory::make<ProjectExplorer::SimpleTargetRunner>(),
|
|
|
|
|
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
2020-06-12 07:50:52 +02:00
|
|
|
{m_runConfigurationFactory.runConfigurationId()}};
|
2020-05-01 18:20:56 +02:00
|
|
|
void saveAll()
|
|
|
|
|
{
|
|
|
|
|
m_toolsSettings.saveMesonTools(MesonTools::tools(), ICore::dialogParent());
|
2022-07-08 10:48:04 +02:00
|
|
|
Settings::instance()->writeSettings(ICore::settings());
|
2020-05-01 18:20:56 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MesonProjectPlugin::~MesonProjectPlugin()
|
|
|
|
|
{
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MesonProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(errorMessage)
|
|
|
|
|
|
|
|
|
|
d = new MesonProjectPluginPrivate;
|
|
|
|
|
|
|
|
|
|
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
|
|
|
|
|
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
|
|
|
|
|
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
|
2022-07-08 10:48:04 +02:00
|
|
|
Settings::instance()->readSettings(ICore::settings());
|
2020-05-01 18:20:56 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace MesonProjectManager
|
|
|
|
|
|
|
|
|
|
#include "mesonprojectplugin.moc"
|