forked from qt-creator/qt-creator
Meson: Use setup functions for more plugin items
Change-Id: Ibbb2526d1db980389487e599ddf53e4785d97b5e Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -92,7 +92,7 @@ static FilePath machineFilesDir()
|
|||||||
return Core::ICore::userResourcePath("Meson-machine-files");
|
return Core::ICore::userResourcePath("Meson-machine-files");
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath MachineFileManager::machineFile(const Kit *kit)
|
static FilePath machineFile(const Kit *kit)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(kit, return {});
|
QTC_ASSERT(kit, return {});
|
||||||
auto baseName
|
auto baseName
|
||||||
@@ -101,6 +101,20 @@ FilePath MachineFileManager::machineFile(const Kit *kit)
|
|||||||
return machineFilesDir().pathAppended(baseName);
|
return machineFilesDir().pathAppended(baseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MachineFileManager
|
||||||
|
|
||||||
|
class MachineFileManager final : public QObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MachineFileManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addMachineFile(const Kit *kit);
|
||||||
|
void removeMachineFile(const Kit *kit);
|
||||||
|
void updateMachineFile(const Kit *kit);
|
||||||
|
void cleanupMachineFiles();
|
||||||
|
};
|
||||||
|
|
||||||
MachineFileManager::MachineFileManager()
|
MachineFileManager::MachineFileManager()
|
||||||
{
|
{
|
||||||
connect(KitManager::instance(), &KitManager::kitAdded,
|
connect(KitManager::instance(), &KitManager::kitAdded,
|
||||||
@@ -268,8 +282,7 @@ QStringList MesonBuildSystem::configArgs(bool isSetup)
|
|||||||
if (!isSetup || params.contains("--cross-file") || params.contains("--native-file"))
|
if (!isSetup || params.contains("--cross-file") || params.contains("--native-file"))
|
||||||
return m_pendingConfigArgs + bc->mesonConfigArgs();
|
return m_pendingConfigArgs + bc->mesonConfigArgs();
|
||||||
|
|
||||||
return QStringList{
|
return QStringList{QString("--native-file=%1").arg(machineFile(kit()).toString())}
|
||||||
QString("--native-file=%1").arg(MachineFileManager::machineFile(kit()).toString())}
|
|
||||||
+ m_pendingConfigArgs + bc->mesonConfigArgs();
|
+ m_pendingConfigArgs + bc->mesonConfigArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,4 +345,9 @@ void MesonBuildSystem::updateKit(ProjectExplorer::Kit *kit)
|
|||||||
m_parser.setQtVersion(m_kitData.qtVersion);
|
m_parser.setQtVersion(m_kitData.qtVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupMesonBuildSystem()
|
||||||
|
{
|
||||||
|
static MachineFileManager theMachineFileManager;
|
||||||
|
}
|
||||||
|
|
||||||
} // MesonProjectManager::Internal
|
} // MesonProjectManager::Internal
|
||||||
|
|||||||
@@ -17,20 +17,6 @@ namespace MesonProjectManager::Internal {
|
|||||||
|
|
||||||
class MesonBuildConfiguration;
|
class MesonBuildConfiguration;
|
||||||
|
|
||||||
class MachineFileManager final : public QObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MachineFileManager();
|
|
||||||
|
|
||||||
static Utils::FilePath machineFile(const ProjectExplorer::Kit *kit);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void addMachineFile(const ProjectExplorer::Kit *kit);
|
|
||||||
void removeMachineFile(const ProjectExplorer::Kit *kit);
|
|
||||||
void updateMachineFile(const ProjectExplorer::Kit *kit);
|
|
||||||
void cleanupMachineFiles();
|
|
||||||
};
|
|
||||||
|
|
||||||
class MesonBuildSystem final : public ProjectExplorer::BuildSystem
|
class MesonBuildSystem final : public ProjectExplorer::BuildSystem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -68,4 +54,6 @@ private:
|
|||||||
KitData m_kitData;
|
KitData m_kitData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setupMesonBuildSystem();
|
||||||
|
|
||||||
} // MesonProjectManager::Internal
|
} // MesonProjectManager::Internal
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ const char MESON_INFO[] = "meson-info.json";
|
|||||||
const char MESON_TOOL_MANAGER[] = "MesonProjectManager.Tools";
|
const char MESON_TOOL_MANAGER[] = "MesonProjectManager.Tools";
|
||||||
const char MESON_BUILD_STEP_ID[] = "MesonProjectManager.BuildStep";
|
const char MESON_BUILD_STEP_ID[] = "MesonProjectManager.BuildStep";
|
||||||
|
|
||||||
|
const char MESON_RUNCONFIG_ID[] = "MesonProjectManager.MesonRunConfiguration";
|
||||||
|
|
||||||
namespace Targets {
|
namespace Targets {
|
||||||
const char all[] = "all";
|
const char all[] = "all";
|
||||||
const char clean[] = "clean";
|
const char clean[] = "clean";
|
||||||
|
|||||||
@@ -10,17 +10,13 @@
|
|||||||
#include "toolssettingsaccessor.h"
|
#include "toolssettingsaccessor.h"
|
||||||
#include "toolssettingspage.h"
|
#include "toolssettingspage.h"
|
||||||
|
|
||||||
#include <debugger/debuggerruncontrol.h>
|
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectmanager.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/runcontrol.h>
|
|
||||||
|
|
||||||
#include <utils/fsengine/fileiconprovider.h>
|
#include <utils/fsengine/fileiconprovider.h>
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
@@ -29,11 +25,7 @@ namespace MesonProjectManager::Internal {
|
|||||||
class MesonProjectPluginPrivate
|
class MesonProjectPluginPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MesonRunConfigurationFactory m_runConfigurationFactory;
|
|
||||||
MesonActionsManager m_actions;
|
MesonActionsManager m_actions;
|
||||||
MachineFileManager m_machineFilesManager;
|
|
||||||
SimpleTargetRunnerFactory m_mesonRunWorkerFactory{{m_runConfigurationFactory.runConfigurationId()}};
|
|
||||||
SimpleDebugRunnerFactory m_mesonDebugRunWorkerFactory{{m_runConfigurationFactory.runConfigurationId()}};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MesonProjectPlugin final : public ExtensionSystem::IPlugin
|
class MesonProjectPlugin final : public ExtensionSystem::IPlugin
|
||||||
@@ -55,10 +47,15 @@ private:
|
|||||||
setupToolsSettingsPage();
|
setupToolsSettingsPage();
|
||||||
setupToolsSettingsAccessor();
|
setupToolsSettingsAccessor();
|
||||||
|
|
||||||
|
setupMesonBuildSystem();
|
||||||
setupMesonBuildConfiguration();
|
setupMesonBuildConfiguration();
|
||||||
setupNinjaBuildStep();
|
setupNinjaBuildStep();
|
||||||
|
|
||||||
|
setupMesonRunConfiguration();
|
||||||
|
setupMesonRunAndDebugWorkers();
|
||||||
|
|
||||||
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
|
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
|
||||||
|
|
||||||
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
|
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
|
||||||
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
|
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,15 @@
|
|||||||
|
|
||||||
#include <projectexplorer/buildsystem.h>
|
#include <projectexplorer/buildsystem.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
#include <projectexplorer/runcontrol.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
@@ -75,11 +79,29 @@ public:
|
|||||||
UseDyldSuffixAspect useDyldSuffix{this};
|
UseDyldSuffixAspect useDyldSuffix{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
MesonRunConfigurationFactory::MesonRunConfigurationFactory()
|
// MesonRunConfigurationFactory
|
||||||
|
|
||||||
|
class MesonRunConfigurationFactory final : public RunConfigurationFactory
|
||||||
{
|
{
|
||||||
registerRunConfiguration<MesonRunConfiguration>("MesonProjectManager.MesonRunConfiguration");
|
public:
|
||||||
addSupportedProjectType(Constants::Project::ID);
|
MesonRunConfigurationFactory()
|
||||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
{
|
||||||
|
registerRunConfiguration<MesonRunConfiguration>(Constants::MESON_RUNCONFIG_ID);
|
||||||
|
addSupportedProjectType(Constants::Project::ID);
|
||||||
|
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupMesonRunConfiguration()
|
||||||
|
{
|
||||||
|
static MesonRunConfigurationFactory theMesonRunConfigurationFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupMesonRunAndDebugWorkers()
|
||||||
|
{
|
||||||
|
using namespace Debugger;
|
||||||
|
static SimpleTargetRunnerFactory theMesonRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
|
||||||
|
static SimpleDebugRunnerFactory theMesonDebugRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // MesonProjectManager::Internal
|
} // MesonProjectManager::Internal
|
||||||
|
|||||||
@@ -3,14 +3,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
|
||||||
|
|
||||||
namespace MesonProjectManager::Internal {
|
namespace MesonProjectManager::Internal {
|
||||||
|
|
||||||
class MesonRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
|
void setupMesonRunConfiguration();
|
||||||
{
|
void setupMesonRunAndDebugWorkers();
|
||||||
public:
|
|
||||||
MesonRunConfigurationFactory();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // MesonProjectManager::Internal
|
} // MesonProjectManager::Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user