forked from qt-creator/qt-creator
ProjectExplorer: Re-work setup runworker factories
This combines two of the previous three paths to create run workers, and refers to RunConfigurations by id, not by type where possible to decrease coupling between the classes. Only allow "type of run configuration" and "type of device" as the only possible kind of restriction and require a uniform RunWorker constructor signature. Adapt user code to fit that pattern. Change-Id: I5a6d49c9a144785fd0235d7586f244b56f67b366 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -88,23 +88,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class QmlPreviewRunWorkerFactory : public RunWorkerFactory
|
||||
class AndroidQmlPreviewWorker : public AndroidQmlToolingSupport
|
||||
{
|
||||
public:
|
||||
QmlPreviewRunWorkerFactory()
|
||||
{
|
||||
addSupportedRunMode(QML_PREVIEW_RUN_MODE);
|
||||
setProducer([](RunControl *runControl) -> RunWorker * {
|
||||
const Runnable runnable = runControl->runConfiguration()->runnable();
|
||||
return new AndroidQmlToolingSupport(runControl, runnable.executable.toString());
|
||||
});
|
||||
addConstraint([](RunConfiguration *runConfig) {
|
||||
return runConfig->isEnabled()
|
||||
&& runConfig->id().name().startsWith("QmlProjectManager.QmlRunConfiguration")
|
||||
&& DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit())
|
||||
== Android::Constants::ANDROID_DEVICE_TYPE;
|
||||
});
|
||||
}
|
||||
AndroidQmlPreviewWorker(RunControl *runControl)
|
||||
: AndroidQmlToolingSupport(runControl,
|
||||
runControl->runConfiguration()->runnable().executable.toString())
|
||||
{}
|
||||
};
|
||||
|
||||
class AndroidPluginPrivate : public QObject
|
||||
@@ -151,14 +141,32 @@ public:
|
||||
AndroidManifestEditorFactory manifestEditorFactory;
|
||||
AndroidRunConfigurationFactory runConfigFactory;
|
||||
|
||||
SimpleRunWorkerFactory<AndroidRunSupport, AndroidRunConfiguration> runWorkerFactory;
|
||||
SimpleRunWorkerFactory<AndroidDebugSupport, AndroidRunConfiguration>
|
||||
debugWorkerFactory{DEBUG_RUN_MODE};
|
||||
SimpleRunWorkerFactory<AndroidQmlToolingSupport, AndroidRunConfiguration>
|
||||
profilerWorkerFactory{QML_PROFILER_RUN_MODE};
|
||||
SimpleRunWorkerFactory<AndroidQmlToolingSupport, AndroidRunConfiguration>
|
||||
qmlPreviewWorkerFactory{QML_PREVIEW_RUN_MODE};
|
||||
QmlPreviewRunWorkerFactory qmlPreviewWorkerFactory2;
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidRunSupport>(),
|
||||
{NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidDebugSupport>(),
|
||||
{DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory profilerWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidQmlToolingSupport>(),
|
||||
{QML_PROFILER_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidQmlToolingSupport>(),
|
||||
{QML_PREVIEW_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory2{
|
||||
RunWorkerFactory::make<AndroidQmlPreviewWorker>(),
|
||||
{QML_PREVIEW_RUN_MODE},
|
||||
{"QmlProjectManager.QmlRunConfiguration"},
|
||||
{Android::Constants::ANDROID_DEVICE_TYPE}
|
||||
};
|
||||
|
||||
AndroidBuildApkStepFactory buildApkStepFactory;
|
||||
AndroidGdbServerKitAspect gdbServerKitAspect;
|
||||
|
@@ -63,6 +63,12 @@ public:
|
||||
BareMetalCustomRunConfigurationFactory customRunConfigurationFactory;
|
||||
GdbServerProvidersSettingsPage gdbServerProviderSettinsPage;
|
||||
GdbServerProviderManager gdbServerProviderManager;
|
||||
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<BareMetalDebugSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE, ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigurationFactory.id(), customRunConfigurationFactory.id()}
|
||||
};
|
||||
};
|
||||
|
||||
// BareMetalPlugin
|
||||
@@ -78,19 +84,6 @@ bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorStr
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
d = new BareMetalPluginPrivate;
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfig) {
|
||||
const QByteArray idStr = runConfig->id().name();
|
||||
const bool res = idStr.startsWith(BareMetalRunConfiguration::IdPrefix)
|
||||
|| idStr == BareMetalCustomRunConfiguration::Id;
|
||||
return res;
|
||||
};
|
||||
|
||||
RunControl::registerWorker<BareMetalDebugSupport>
|
||||
(ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<BareMetalDebugSupport>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -180,6 +180,36 @@ public:
|
||||
QdbDeployStepFactory<RemoteLinux::GenericDirectUploadStep>
|
||||
m_directUploadStepFactory;
|
||||
|
||||
const QList<Core::Id> supportedRunConfigs {
|
||||
m_runConfigFactory.id(),
|
||||
"QmlProjectManager.QmlRunConfiguration"
|
||||
};
|
||||
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceRunSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
|
||||
DeviceDetector m_deviceDetector;
|
||||
};
|
||||
|
||||
@@ -195,28 +225,6 @@ bool QdbPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
|
||||
d = new QdbPluginPrivate;
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfiguration) {
|
||||
const Core::Id devType = DeviceTypeKitAspect::deviceTypeId(
|
||||
runConfiguration->target()->kit());
|
||||
|
||||
if (devType != Qdb::Constants::QdbLinuxOsType)
|
||||
return false;
|
||||
|
||||
const Core::Id id = runConfiguration->id();
|
||||
return runConfiguration->isEnabled()
|
||||
&& (id.name().startsWith(Constants::QdbRunConfigurationPrefix)
|
||||
|| id.name().startsWith("QmlProjectManager.QmlRunConfiguration"));
|
||||
};
|
||||
|
||||
RunControl::registerWorker<QdbDeviceRunSupport>
|
||||
(ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<QdbDeviceDebugSupport>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<QdbDeviceQmlProfilerSupport>
|
||||
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<QdbDeviceQmlPreviewSupport>
|
||||
(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE, constraint);
|
||||
|
||||
registerFlashAction(this);
|
||||
|
||||
return true;
|
||||
|
@@ -610,6 +610,7 @@ private:
|
||||
QHash<unsigned, QString> m_debugInfoTasks;
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebuggerPluginPrivate
|
||||
@@ -776,6 +777,18 @@ public:
|
||||
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, tr("Debugger")};
|
||||
|
||||
DebuggerKitAspect debuggerKitAspect;
|
||||
|
||||
RunWorkerFactory debuggerWorkerFactory{
|
||||
RunWorkerFactory::make<DebuggerRunTool>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{}, // All local run configs?
|
||||
{PE::DESKTOP_DEVICE_TYPE}
|
||||
};
|
||||
|
||||
// FIXME: Needed?
|
||||
// QString mainScript = runConfig->property("mainScript").toString();
|
||||
// const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
|
||||
// return isDebuggableScript;
|
||||
};
|
||||
|
||||
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
|
||||
@@ -2086,23 +2099,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
}
|
||||
}
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfig) {
|
||||
Runnable runnable = runConfig->runnable();
|
||||
if (runnable.device && runnable.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return true;
|
||||
|
||||
if (DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return true;
|
||||
|
||||
QString mainScript = runConfig->property("mainScript").toString();
|
||||
const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
|
||||
return isDebuggableScript;
|
||||
};
|
||||
|
||||
RunControl::registerWorker<DebuggerRunTool>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
|
||||
|
||||
DebuggerMainWindow::ensureMainWindowExists();
|
||||
}
|
||||
|
||||
|
@@ -95,12 +95,21 @@ public:
|
||||
IosDsymBuildStepFactory dsymBuildStepFactory;
|
||||
IosDeployConfigurationFactory deployConfigurationFactory;
|
||||
|
||||
SimpleRunWorkerFactory<Internal::IosRunSupport, IosRunConfiguration>
|
||||
runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
|
||||
SimpleRunWorkerFactory<Internal::IosDebugSupport, IosRunConfiguration>
|
||||
debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE};
|
||||
SimpleRunWorkerFactory<Internal::IosQmlProfilerSupport, IosRunConfiguration>
|
||||
qmlProfilerWorkerFactory{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE};
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<IosRunSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<IosDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<IosQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
};
|
||||
};
|
||||
|
||||
IosPlugin::~IosPlugin()
|
||||
|
@@ -67,7 +67,11 @@ public:
|
||||
NimEditorFactory editorFactory;
|
||||
NimBuildConfigurationFactory buildConfigFactory;
|
||||
NimRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, NimRunConfiguration> runWorkerFactory;
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
NimCompilerBuildStepFactory buildStepFactory;
|
||||
NimCompilerCleanStepFactory cleanStepFactory;
|
||||
NimCodeStyleSettingsPage codeStyleSettingsPage;
|
||||
|
@@ -69,12 +69,13 @@ public:
|
||||
|
||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE,
|
||||
[](RunControl *runControl){ return new PerfProfilerRunner(runControl); });
|
||||
|
||||
auto constraint = [](RunConfiguration *) { return true; };
|
||||
RunControl::registerWorker<PerfProfilerRunner>
|
||||
(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, constraint);
|
||||
}
|
||||
|
||||
RunWorkerFactory profilerWorkerFactory{
|
||||
RunWorkerFactory::make<PerfProfilerRunner>(),
|
||||
{ProjectExplorer::Constants::PERFPROFILER_RUN_MODE}
|
||||
};
|
||||
|
||||
PerfOptionsPage optionsPage;
|
||||
PerfProfilerTool profilerTool;
|
||||
};
|
||||
|
@@ -565,8 +565,11 @@ public:
|
||||
CurrentProjectFind m_curretProjectFind;
|
||||
|
||||
CustomExecutableRunConfigurationFactory m_customExecutableRunConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, CustomExecutableRunConfiguration>
|
||||
m_customExecutableRunWorkerFactory;
|
||||
RunWorkerFactory m_customExecutableRunWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{Constants::NORMAL_RUN_MODE},
|
||||
{m_customExecutableRunConfigFactory.id()}
|
||||
};
|
||||
|
||||
ProjectFileWizardExtension m_projectFileWizardExtension;
|
||||
|
||||
@@ -610,8 +613,6 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
m_instance = nullptr;
|
||||
|
||||
RunWorkerFactory::destroyRemainingRunWorkerFactories();
|
||||
}
|
||||
|
||||
ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
|
||||
|
@@ -227,6 +227,7 @@ public:
|
||||
static RunConfiguration *clone(Target *parent, RunConfiguration *source);
|
||||
static const QList<RunConfigurationCreationInfo> creatorsForTarget(Target *parent);
|
||||
|
||||
Core::Id id() const { return m_runConfigBaseId; }
|
||||
Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
|
||||
|
||||
static QString decoratedTargetName(const QString &targetName, Target *kit);
|
||||
|
@@ -73,7 +73,14 @@ namespace ProjectExplorer {
|
||||
|
||||
static QList<RunWorkerFactory *> g_runWorkerFactories;
|
||||
|
||||
RunWorkerFactory::RunWorkerFactory()
|
||||
RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
|
||||
const QList<Core::Id> &runModes,
|
||||
const QList<Core::Id> &runConfigs,
|
||||
const QList<Core::Id> &deviceTypes)
|
||||
: m_producer(producer),
|
||||
m_supportedRunModes(runModes),
|
||||
m_supportedRunConfigurations(runConfigs),
|
||||
m_supportedDeviceTypes(deviceTypes)
|
||||
{
|
||||
g_runWorkerFactories.append(this);
|
||||
}
|
||||
@@ -89,53 +96,32 @@ bool RunWorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMo
|
||||
return false;
|
||||
|
||||
if (!m_supportedRunConfigurations.isEmpty()) {
|
||||
if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
|
||||
// FIXME: That's to be used after mangled ids are gone.
|
||||
//if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
|
||||
// return false;
|
||||
bool ok = false;
|
||||
const QString rcid = runConfiguration->id().toString();
|
||||
for (const Core::Id &id : m_supportedRunConfigurations) {
|
||||
if (rcid.startsWith(id.toString())) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const Constraint &constraint : m_constraints) {
|
||||
if (!constraint(runConfiguration))
|
||||
return false;
|
||||
if (!m_supportedDeviceTypes.isEmpty()) {
|
||||
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
|
||||
Kit *kit = target ? target->kit() : nullptr;
|
||||
const Core::Id devid = DeviceTypeKitAspect::deviceTypeId(kit);
|
||||
return m_supportedDeviceTypes.contains(devid);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RunWorkerFactory::setProducer(const WorkerCreator &producer)
|
||||
{
|
||||
m_producer = producer;
|
||||
}
|
||||
|
||||
void RunWorkerFactory::addConstraint(const Constraint &constraint)
|
||||
{
|
||||
// Default constructed Constraints are not worth keeping.
|
||||
// FIXME: Make it a QTC_ASSERT once there is no code path
|
||||
// using this "feature" anymore.
|
||||
if (!constraint)
|
||||
return;
|
||||
m_constraints.append(constraint);
|
||||
}
|
||||
|
||||
void RunWorkerFactory::addSupportedRunMode(Core::Id runMode)
|
||||
{
|
||||
m_supportedRunModes.append(runMode);
|
||||
}
|
||||
|
||||
void RunWorkerFactory::setSupportedRunConfigurations(const QList<Core::Id> &ids)
|
||||
{
|
||||
m_supportedRunConfigurations = ids;
|
||||
}
|
||||
|
||||
void RunWorkerFactory::addSupportedRunConfiguration(Core::Id id)
|
||||
{
|
||||
m_supportedRunConfigurations.append(id);
|
||||
}
|
||||
|
||||
void RunWorkerFactory::destroyRemainingRunWorkerFactories()
|
||||
{
|
||||
qDeleteAll(g_runWorkerFactories);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::RunControl
|
||||
\brief The RunControl class instances represent one item that is run.
|
||||
|
@@ -50,11 +50,8 @@ class OutputFormatter;
|
||||
namespace ProjectExplorer {
|
||||
class GlobalOrProjectAspect;
|
||||
class Node;
|
||||
class RunConfigurationFactory;
|
||||
class RunConfiguration;
|
||||
class RunConfigurationCreationInfo;
|
||||
class RunControl;
|
||||
class RunWorkerFactory;
|
||||
class Target;
|
||||
|
||||
namespace Internal {
|
||||
@@ -142,36 +139,32 @@ private:
|
||||
const std::unique_ptr<Internal::RunWorkerPrivate> d;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT RunWorkerFactory
|
||||
class PROJECTEXPLORER_EXPORT RunWorkerFactory final
|
||||
{
|
||||
public:
|
||||
using WorkerCreator = std::function<RunWorker *(RunControl *)>;
|
||||
using Constraint = std::function<bool(RunConfiguration *)>;
|
||||
|
||||
RunWorkerFactory();
|
||||
virtual ~RunWorkerFactory();
|
||||
RunWorkerFactory(const WorkerCreator &producer,
|
||||
const QList<Core::Id> &runModes,
|
||||
const QList<Core::Id> &runConfigs = {},
|
||||
const QList<Core::Id> &deviceTypes = {});
|
||||
|
||||
~RunWorkerFactory();
|
||||
|
||||
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
|
||||
|
||||
void setProducer(const WorkerCreator &producer);
|
||||
void addConstraint(const Constraint &constraint);
|
||||
void addSupportedRunMode(Core::Id runMode);
|
||||
|
||||
void setSupportedRunConfigurations(const QList<Core::Id> &ids);
|
||||
void addSupportedRunConfiguration(Core::Id id);
|
||||
|
||||
WorkerCreator producer() const { return m_producer; }
|
||||
|
||||
private:
|
||||
// FIXME: That's temporary until ownership has been transferred to
|
||||
// the individual plugins.
|
||||
friend class ProjectExplorerPlugin;
|
||||
static void destroyRemainingRunWorkerFactories();
|
||||
template <typename Worker>
|
||||
static WorkerCreator make()
|
||||
{
|
||||
return [](RunControl *runControl) { return new Worker(runControl); };
|
||||
}
|
||||
|
||||
private:
|
||||
WorkerCreator m_producer;
|
||||
QList<Core::Id> m_supportedRunModes;
|
||||
QList<Core::Id> m_supportedRunConfigurations;
|
||||
QList<Constraint> m_constraints;
|
||||
WorkerCreator m_producer;
|
||||
QList<Core::Id> m_supportedDeviceTypes;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -258,19 +251,10 @@ public:
|
||||
RunWorker *createWorker(Core::Id id);
|
||||
|
||||
using WorkerCreator = RunWorkerFactory::WorkerCreator;
|
||||
using Constraint = RunWorkerFactory::Constraint;
|
||||
using Constraint = std::function<bool(RunConfiguration *)>;
|
||||
|
||||
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
|
||||
|
||||
template <class Worker>
|
||||
static void registerWorker(Core::Id runMode, const Constraint &constraint)
|
||||
{
|
||||
auto factory = new RunWorkerFactory;
|
||||
factory->setProducer([](RunControl *rc) { return new Worker(rc); });
|
||||
factory->addSupportedRunMode(runMode);
|
||||
factory->addConstraint(constraint);
|
||||
}
|
||||
|
||||
bool createMainWorker();
|
||||
static bool canRun(RunConfiguration *runConfig, Core::Id runMode);
|
||||
|
||||
@@ -325,20 +309,4 @@ private:
|
||||
bool m_useTerminal = false;
|
||||
};
|
||||
|
||||
template <class RunWorker, class RunConfig>
|
||||
class SimpleRunWorkerFactory : public RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
SimpleRunWorkerFactory(Core::Id runMode = ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||
{
|
||||
addSupportedRunMode(runMode);
|
||||
addConstraint([](RunConfiguration *runConfig) {
|
||||
return qobject_cast<RunConfig *>(runConfig) != nullptr;
|
||||
});
|
||||
setProducer([](RunControl *runControl) {
|
||||
return new RunWorker(runControl);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -810,7 +810,11 @@ class PythonPluginPrivate
|
||||
public:
|
||||
PythonEditorFactory editorFactory;
|
||||
PythonRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, PythonRunConfiguration> runWorkerFactory;
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
};
|
||||
|
||||
PythonPlugin::~PythonPlugin()
|
||||
|
@@ -108,13 +108,12 @@ bool QmlPreviewPlugin::initialize(const QStringList &arguments, QString *errorSt
|
||||
setFileClassifier(&defaultFileClassifier);
|
||||
setFpsHandler(&defaultFpsHandler);
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfiguration) {
|
||||
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
|
||||
Kit *kit = target ? target->kit() : nullptr;
|
||||
return DeviceTypeKitAspect::deviceTypeId(kit) == Constants::DESKTOP_DEVICE_TYPE;
|
||||
};
|
||||
|
||||
RunControl::registerWorker<LocalQmlPreviewSupport>(Constants::QML_PREVIEW_RUN_MODE, constraint);
|
||||
m_runWorkerFactory.reset(new RunWorkerFactory{
|
||||
RunWorkerFactory::make<LocalQmlPreviewSupport>(),
|
||||
{Constants::QML_PREVIEW_RUN_MODE},
|
||||
{}, // All runconfig.
|
||||
{Constants::DESKTOP_DEVICE_TYPE}
|
||||
});
|
||||
|
||||
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
||||
Constants::M_BUILDPROJECT);
|
||||
|
@@ -122,6 +122,7 @@ private:
|
||||
float m_zoomFactor = -1.0;
|
||||
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
|
||||
QString m_locale;
|
||||
std::unique_ptr<ProjectExplorer::RunWorkerFactory> m_runWorkerFactory;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -80,34 +80,18 @@ namespace Internal {
|
||||
|
||||
Q_GLOBAL_STATIC(QmlProfilerSettings, qmlProfilerGlobalSettings)
|
||||
|
||||
bool constraint(RunConfiguration *runConfiguration)
|
||||
{
|
||||
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
|
||||
Kit *kit = target ? target->kit() : nullptr;
|
||||
return DeviceTypeKitAspect::deviceTypeId(kit)
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
class QmlProfilerRunWorkerFactory : public RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
QmlProfilerRunWorkerFactory(QmlProfilerTool *tool)
|
||||
{
|
||||
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
setProducer([tool](RunControl *runControl) {
|
||||
return new LocalQmlProfilerSupport(tool, runControl);
|
||||
});
|
||||
addConstraint(constraint);
|
||||
}
|
||||
};
|
||||
|
||||
class QmlProfilerPluginPrivate
|
||||
{
|
||||
public:
|
||||
QmlProfilerTool m_profilerTool;
|
||||
QmlProfilerOptionsPage m_profilerOptionsPage;
|
||||
QmlProfilerActions m_actions;
|
||||
QmlProfilerRunWorkerFactory m_profilerWorkerFactory{&m_profilerTool};
|
||||
RunWorkerFactory m_profilerWorkerFactory{
|
||||
RunWorkerFactory::make<LocalQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
{},
|
||||
{ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}
|
||||
};
|
||||
};
|
||||
|
||||
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
|
@@ -218,14 +218,12 @@ static QUrl localServerUrl(RunControl *runControl)
|
||||
return serverUrl;
|
||||
}
|
||||
|
||||
LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
|
||||
RunControl *runControl)
|
||||
: LocalQmlProfilerSupport(profilerTool, runControl, localServerUrl(runControl))
|
||||
LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl)
|
||||
: LocalQmlProfilerSupport(runControl, localServerUrl(runControl))
|
||||
{
|
||||
}
|
||||
|
||||
LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
|
||||
RunControl *runControl, const QUrl &serverUrl)
|
||||
LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const QUrl &serverUrl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
setId("LocalQmlProfilerSupport");
|
||||
@@ -233,7 +231,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
|
||||
auto profiler = new QmlProfilerRunner(runControl);
|
||||
profiler->setServerUrl(serverUrl);
|
||||
connect(profiler, &QmlProfilerRunner::starting,
|
||||
profilerTool, &QmlProfilerTool::finalizeRunControl);
|
||||
QmlProfilerTool::instance(), &QmlProfilerTool::finalizeRunControl);
|
||||
|
||||
addStopDependency(profiler);
|
||||
// We need to open the local server before the application tries to connect.
|
||||
|
@@ -72,8 +72,8 @@ class LocalQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LocalQmlProfilerSupport(QmlProfilerTool *profilerTool, ProjectExplorer::RunControl *runControl);
|
||||
LocalQmlProfilerSupport(QmlProfilerTool *profilerTool, ProjectExplorer::RunControl *runControl,
|
||||
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
|
||||
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl,
|
||||
const QUrl &serverUrl);
|
||||
};
|
||||
|
||||
|
@@ -96,6 +96,8 @@ using namespace ProjectExplorer;
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
static QmlProfilerTool *m_instance = nullptr;
|
||||
|
||||
class QmlProfilerTool::QmlProfilerToolPrivate
|
||||
{
|
||||
public:
|
||||
@@ -129,6 +131,7 @@ public:
|
||||
QmlProfilerTool::QmlProfilerTool()
|
||||
: d(new QmlProfilerToolPrivate)
|
||||
{
|
||||
m_instance = this;
|
||||
setObjectName(QLatin1String("QmlProfilerTool"));
|
||||
|
||||
d->m_profilerState = new QmlProfilerStateManager(this);
|
||||
@@ -279,6 +282,12 @@ QmlProfilerTool::~QmlProfilerTool()
|
||||
{
|
||||
d->m_profilerModelManager->clearAll();
|
||||
delete d;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
QmlProfilerTool *QmlProfilerTool::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void QmlProfilerTool::updateRunActions()
|
||||
|
@@ -52,6 +52,8 @@ public:
|
||||
QmlProfilerTool();
|
||||
~QmlProfilerTool() override;
|
||||
|
||||
static QmlProfilerTool *instance();
|
||||
|
||||
void finalizeRunControl(QmlProfilerRunner *runWorker);
|
||||
|
||||
bool prepareTool();
|
||||
|
@@ -45,7 +45,6 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
|
||||
|
||||
void LocalQmlProfilerRunnerTest::testRunner()
|
||||
{
|
||||
QmlProfilerTool tool;
|
||||
QPointer<ProjectExplorer::RunControl> runControl;
|
||||
QPointer<LocalQmlProfilerSupport> profiler;
|
||||
ProjectExplorer::Runnable debuggee;
|
||||
@@ -66,7 +65,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
|
||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setRunnable(debuggee);
|
||||
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
|
||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||
|
||||
auto connectRunner = [&]() {
|
||||
connect(runControl, &ProjectExplorer::RunControl::aboutToStart, this, [&]() {
|
||||
@@ -116,7 +115,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
debuggee.commandLineArguments = QString("-test QmlProfiler,");
|
||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setRunnable(debuggee);
|
||||
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
|
||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||
connectRunner();
|
||||
runControl->initiateStart();
|
||||
|
||||
@@ -135,7 +134,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
serverUrl = Utils::urlFromLocalHostAndFreePort();
|
||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setRunnable(debuggee);
|
||||
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
|
||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||
connectRunner();
|
||||
runControl->initiateStart();
|
||||
|
||||
@@ -160,7 +159,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
|
||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setRunnable(debuggee);
|
||||
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
|
||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||
connectRunner();
|
||||
runControl->initiateStart();
|
||||
|
||||
|
@@ -52,7 +52,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
||||
QVERIFY(settings);
|
||||
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), newKit->id().toSetting());
|
||||
|
||||
QmlProfilerTool profilerTool;
|
||||
QmlProfilerTool &profilerTool = *QmlProfilerTool::instance();
|
||||
|
||||
QmlProfilerClientManager *clientManager = profilerTool.clientManager();
|
||||
clientManager->setRetryInterval(10);
|
||||
@@ -107,7 +107,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
||||
|
||||
void QmlProfilerToolTest::testClearEvents()
|
||||
{
|
||||
QmlProfilerTool profilerTool;
|
||||
QmlProfilerTool &profilerTool = *QmlProfilerTool::instance();
|
||||
QmlProfilerModelManager *modelManager = profilerTool.modelManager();
|
||||
QVERIFY(modelManager);
|
||||
QmlProfilerStateManager *stateManager = profilerTool.stateManager();
|
||||
|
@@ -44,8 +44,11 @@ class QmlProjectPluginPrivate
|
||||
{
|
||||
public:
|
||||
QmlProjectRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, QmlProjectRunConfiguration>
|
||||
runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
};
|
||||
|
||||
QmlProjectPlugin::~QmlProjectPlugin()
|
||||
|
@@ -115,12 +115,21 @@ public:
|
||||
QnxSettingsPage settingsPage;
|
||||
QnxToolChainFactory toolChainFactory;
|
||||
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, QnxRunConfiguration>
|
||||
runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
|
||||
SimpleRunWorkerFactory<QnxDebugSupport, QnxRunConfiguration>
|
||||
debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE};
|
||||
SimpleRunWorkerFactory<QnxQmlProfilerSupport, QnxRunConfiguration>
|
||||
qmlProfilerWorkerFactory;
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<QnxDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<QnxQmlProfilerSupport>(),
|
||||
{}, // FIXME: Shouldn't this use the run mode id somehow?
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
};
|
||||
|
||||
static QnxPluginPrivate *dd = nullptr;
|
||||
|
@@ -239,16 +239,6 @@ const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:";
|
||||
const char QBS_RUNCONFIG_ID[] = "Qbs.RunConfiguration:";
|
||||
const char CMAKE_RUNCONFIG_ID[] = "CMakeProjectManager.CMakeRunConfiguration.";
|
||||
|
||||
DesktopRunWorkerFactory::DesktopRunWorkerFactory()
|
||||
{
|
||||
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
|
||||
addSupportedRunConfiguration(QMAKE_RUNCONFIG_ID);
|
||||
addSupportedRunConfiguration(QBS_RUNCONFIG_ID);
|
||||
addSupportedRunConfiguration(CMAKE_RUNCONFIG_ID);
|
||||
|
||||
setProducer([](RunControl *runControl) { return new SimpleTargetRunner(runControl); });
|
||||
}
|
||||
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<CMakeRunConfiguration>(CMAKE_RUNCONFIG_ID);
|
||||
|
@@ -58,12 +58,6 @@ private:
|
||||
const Kind m_kind;
|
||||
};
|
||||
|
||||
class DesktopRunWorkerFactory : public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
DesktopRunWorkerFactory();
|
||||
};
|
||||
|
||||
class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
|
@@ -71,10 +71,15 @@ public:
|
||||
CodeGenSettingsPage codeGenSettingsPage;
|
||||
QtOptionsPage qtOptionsPage;
|
||||
|
||||
DesktopRunWorkerFactory desktopRunWorkerFactory;
|
||||
DesktopQmakeRunConfigurationFactory desktopQmakeRunConfigFactory;
|
||||
QbsRunConfigurationFactory desktopQbsRunConfigFactory;
|
||||
CMakeRunConfigurationFactory desktopCMakeRunConfigFactory;
|
||||
DesktopQmakeRunConfigurationFactory qmakeRunConfigFactory;
|
||||
QbsRunConfigurationFactory qbsRunConfigFactory;
|
||||
CMakeRunConfigurationFactory cmakeRunConfigFactory;
|
||||
|
||||
RunWorkerFactory desktopRunWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{qmakeRunConfigFactory.id(), qbsRunConfigFactory.id(), cmakeRunConfigFactory.id()}
|
||||
};
|
||||
|
||||
ExamplesWelcomePage examplesPage{true};
|
||||
ExamplesWelcomePage tutorialPage{false};
|
||||
|
@@ -83,6 +83,37 @@ public:
|
||||
GenericDeployStepFactory<RemoteLinuxKillAppStep> remoteLinuxKillAppStepFactory;
|
||||
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;
|
||||
EmbeddedLinuxQtVersionFactory embeddedLinuxQtVersionFactory;
|
||||
|
||||
const QList<Core::Id> supportedRunConfigs {
|
||||
runConfigurationFactory.id(),
|
||||
customRunConfigurationFactory.id(),
|
||||
"QmlProjectManager.QmlRunConfiguration"
|
||||
};
|
||||
|
||||
RunWorkerFactory runnerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory debuggerFactory{
|
||||
RunWorkerFactory::make<LinuxDeviceDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerFactory{
|
||||
RunWorkerFactory::make<RemoteLinuxQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewFactory{
|
||||
RunWorkerFactory::make<RemoteLinuxQmlPreviewSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
};
|
||||
|
||||
static RemoteLinuxPluginPrivate *dd = nullptr;
|
||||
@@ -104,25 +135,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, QString *errorM
|
||||
|
||||
dd = new RemoteLinuxPluginPrivate;
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfig) {
|
||||
const Core::Id devType = ProjectExplorer::DeviceTypeKitAspect::deviceTypeId(
|
||||
runConfig->target()->kit());
|
||||
|
||||
if (devType != Constants::GenericLinuxOsType)
|
||||
return false;
|
||||
|
||||
const Core::Id id = runConfig->id();
|
||||
return id == RemoteLinuxCustomRunConfiguration::runConfigId()
|
||||
|| id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix)
|
||||
|| id.name().startsWith("QmlProjectManager.QmlRunConfiguration");
|
||||
};
|
||||
|
||||
using namespace ProjectExplorer::Constants;
|
||||
RunControl::registerWorker<SimpleTargetRunner>(NORMAL_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<RemoteLinuxQmlProfilerSupport>(QML_PROFILER_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<RemoteLinuxQmlPreviewSupport>(QML_PREVIEW_RUN_MODE, constraint);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -219,6 +219,11 @@ public:
|
||||
bool m_toolBusy = false;
|
||||
|
||||
Perspective m_perspective{"Callgrind.Perspective", CallgrindTool::tr("Callgrind")};
|
||||
|
||||
RunWorkerFactory callgrindRunWorkerFactory{
|
||||
RunWorkerFactory::make<CallgrindToolRunner>(),
|
||||
{CALLGRIND_RUN_MODE}
|
||||
};
|
||||
};
|
||||
|
||||
CallgrindToolPrivate::CallgrindToolPrivate()
|
||||
@@ -999,7 +1004,6 @@ void setupCallgrindRunner(CallgrindToolRunner *toolRunner)
|
||||
CallgrindTool::CallgrindTool()
|
||||
{
|
||||
dd = new CallgrindToolPrivate;
|
||||
RunControl::registerWorker<CallgrindToolRunner>(CALLGRIND_RUN_MODE, {});
|
||||
}
|
||||
|
||||
CallgrindTool::~CallgrindTool()
|
||||
|
@@ -437,6 +437,11 @@ private:
|
||||
|
||||
QString m_exitMsg;
|
||||
Perspective m_perspective{"Memcheck.Perspective", MemcheckTool::tr("Memcheck")};
|
||||
|
||||
RunWorkerFactory memcheckToolRunnerFactory{
|
||||
RunWorkerFactory::make<MemcheckToolRunner>(),
|
||||
{MEMCHECK_RUN_MODE, MEMCHECK_WITH_GDB_RUN_MODE}
|
||||
};
|
||||
};
|
||||
|
||||
static MemcheckToolPrivate *dd = nullptr;
|
||||
@@ -1644,9 +1649,6 @@ void HeobData::debugStopped()
|
||||
MemcheckTool::MemcheckTool()
|
||||
{
|
||||
dd = new MemcheckToolPrivate;
|
||||
|
||||
RunControl::registerWorker<MemcheckToolRunner>(MEMCHECK_RUN_MODE, {});
|
||||
RunControl::registerWorker<MemcheckToolRunner>(MEMCHECK_WITH_GDB_RUN_MODE, {});
|
||||
}
|
||||
|
||||
MemcheckTool::~MemcheckTool()
|
||||
|
@@ -36,6 +36,8 @@
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace WebAssembly {
|
||||
namespace Internal {
|
||||
|
||||
@@ -46,7 +48,11 @@ public:
|
||||
WebAssemblyDeviceFactory deviceFactory;
|
||||
WebAssemblyQtVersionFactory qtVersionFactory;
|
||||
EmrunRunConfigurationFactory emrunRunConfigurationFactory;
|
||||
EmrunRunWorkerFactory emrunRunWorkerFactory;
|
||||
RunWorkerFactory emrunRunWorkerFactory{
|
||||
makeEmrunWorker(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN}
|
||||
};
|
||||
};
|
||||
|
||||
static WebAssemblyPluginPrivate *dd = nullptr;
|
||||
|
@@ -110,6 +110,10 @@ public:
|
||||
PortsGatherer *m_portsGatherer;
|
||||
};
|
||||
|
||||
RunWorkerFactory::WorkerCreator makeEmrunWorker()
|
||||
{
|
||||
return RunWorkerFactory::make<EmrunRunWorker>();
|
||||
}
|
||||
|
||||
// Factories
|
||||
|
||||
@@ -120,12 +124,5 @@ EmrunRunConfigurationFactory::EmrunRunConfigurationFactory()
|
||||
addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
EmrunRunWorkerFactory::EmrunRunWorkerFactory()
|
||||
{
|
||||
setProducer([](RunControl *rc) { return new EmrunRunWorker(rc); });
|
||||
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
|
||||
addSupportedRunConfiguration(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Webassembly
|
||||
|
@@ -37,11 +37,7 @@ public:
|
||||
EmrunRunConfigurationFactory();
|
||||
};
|
||||
|
||||
class EmrunRunWorkerFactory : public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
EmrunRunWorkerFactory();
|
||||
};
|
||||
ProjectExplorer::RunWorkerFactory::WorkerCreator makeEmrunWorker();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Webassembly
|
||||
|
@@ -56,6 +56,19 @@ public:
|
||||
WinRtDeviceFactory localDeviceFactory{Constants::WINRT_DEVICE_TYPE_LOCAL};
|
||||
WinRtDeviceFactory phoneDeviceFactory{Constants::WINRT_DEVICE_TYPE_PHONE};
|
||||
WinRtDeviceFactory emulatorDeviceFactory{Constants::WINRT_DEVICE_TYPE_EMULATOR};
|
||||
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<WinRtRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
};
|
||||
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<WinRtDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()},
|
||||
{Internal::Constants::WINRT_DEVICE_TYPE_LOCAL}
|
||||
};
|
||||
};
|
||||
|
||||
WinRtPlugin::~WinRtPlugin()
|
||||
@@ -70,27 +83,6 @@ bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage
|
||||
|
||||
d = new WinRtPluginPrivate;
|
||||
|
||||
auto runConstraint = [](RunConfiguration *runConfig) {
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(runConfig->target()->kit());
|
||||
if (!device)
|
||||
return false;
|
||||
return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
|
||||
};
|
||||
|
||||
auto debugConstraint = [](RunConfiguration *runConfig) {
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(runConfig->target()->kit());
|
||||
if (!device)
|
||||
return false;
|
||||
if (device->type() != Internal::Constants::WINRT_DEVICE_TYPE_LOCAL)
|
||||
return false;
|
||||
return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
|
||||
};
|
||||
|
||||
RunControl::registerWorker<WinRtRunner>
|
||||
(ProjectExplorer::Constants::NORMAL_RUN_MODE, runConstraint);
|
||||
RunControl::registerWorker<WinRtDebugSupport>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE, debugConstraint);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user