Tie SimpleTargetRunner desktop usages to individual RunConfigurations

This avoids the "catch all" that leads to conflicts with more specific
setups like the AppManagerRunConfig, and consequently lets us remove
the priorities in the RunWorkerFactories.

Change-Id: I382f00ca7f759eef995ac6fe749bb371ab027020
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-05-29 12:51:40 +02:00
parent f44e73b858
commit 397de4ff30
6 changed files with 10 additions and 11 deletions

View File

@@ -112,6 +112,8 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
registerRunConfiguration<CMakeRunConfiguration>("CMakeProjectManager.CMakeRunConfiguration."); registerRunConfiguration<CMakeRunConfiguration>("CMakeProjectManager.CMakeRunConfiguration.");
addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID); addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
} }
} // Internal } // Internal

View File

@@ -285,6 +285,8 @@ CustomExecutableRunConfigurationFactory::CustomExecutableRunConfigurationFactory
FixedRunConfigurationFactory(CustomExecutableRunConfiguration::tr("Custom Executable")) FixedRunConfigurationFactory(CustomExecutableRunConfiguration::tr("Custom Executable"))
{ {
registerRunConfiguration<CustomExecutableRunConfiguration>(CUSTOM_EXECUTABLE_ID); registerRunConfiguration<CustomExecutableRunConfiguration>(CUSTOM_EXECUTABLE_ID);
addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
} }
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -649,17 +649,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
panelFactory->setCreateWidgetFunction([](Project *project) { return new DependenciesWidget(project); }); panelFactory->setCreateWidgetFunction([](Project *project) { return new DependenciesWidget(project); });
ProjectPanelFactory::registerFactory(panelFactory); ProjectPanelFactory::registerFactory(panelFactory);
auto constraint = [](RunConfiguration *runConfiguration) {
const Runnable runnable = runConfiguration->runnable();
const IDevice::ConstPtr device = runnable.device;
if (device && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return true;
Target *target = runConfiguration->target();
Kit *kit = target ? target->kit() : nullptr;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
};
RunControl::registerWorker<SimpleTargetRunner>(Constants::NORMAL_RUN_MODE, constraint);
// context menus // context menus
ActionContainer *msessionContextMenu = ActionContainer *msessionContextMenu =
ActionManager::createMenu(Constants::M_SESSIONCONTEXT); ActionManager::createMenu(Constants::M_SESSIONCONTEXT);

View File

@@ -177,6 +177,8 @@ QbsRunConfigurationFactory::QbsRunConfigurationFactory()
registerRunConfiguration<QbsRunConfiguration>("Qbs.RunConfiguration:"); registerRunConfiguration<QbsRunConfiguration>("Qbs.RunConfiguration:");
addSupportedProjectType(Constants::PROJECT_ID); addSupportedProjectType(Constants::PROJECT_ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
} }
} // namespace Internal } // namespace Internal

View File

@@ -173,6 +173,8 @@ DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory()
registerRunConfiguration<DesktopQmakeRunConfiguration>("Qt4ProjectManager.Qt4RunConfiguration:"); registerRunConfiguration<DesktopQmakeRunConfiguration>("Qt4ProjectManager.Qt4RunConfiguration:");
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
} }
} // namespace Internal } // namespace Internal

View File

@@ -299,6 +299,8 @@ QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
registerRunConfiguration<QmlProjectRunConfiguration> registerRunConfiguration<QmlProjectRunConfiguration>
("QmlProjectManager.QmlRunConfiguration.QmlScene"); ("QmlProjectManager.QmlRunConfiguration.QmlScene");
addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID); addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
} }
} // namespace Internal } // namespace Internal