Commit c813b5f3 authored by hjk's avatar hjk
Browse files

Make local custom executables run independent of device selection



Task-number: QTCREATORBUG-16199
Change-Id: I1e9e2103e626c6480fa1c5ac9b2b3f8ac93e3038
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 3d96108b
......@@ -598,6 +598,14 @@ public:
{
if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain))
return false;
Runnable runnable = runConfig->runnable();
if (runnable.is<StandardRunnable>()) {
IDevice::ConstPtr device = runnable.as<StandardRunnable>().device;
if (device && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return true;
}
return DeviceTypeKitInformation::deviceTypeId(runConfig->target()->kit())
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|| isDebuggableScript(runConfig);
......
......@@ -138,9 +138,15 @@ static bool isLocal(RunConfiguration *runConfiguration)
bool LocalApplicationRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
{
return mode == Constants::NORMAL_RUN_MODE
&& isLocal(runConfiguration)
&& runConfiguration->runnable().is<StandardRunnable>();
if (mode != Constants::NORMAL_RUN_MODE)
return false;
const Runnable runnable = runConfiguration->runnable();
if (!runnable.is<StandardRunnable>())
return false;
const IDevice::ConstPtr device = runnable.as<StandardRunnable>().device;
if (device && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return true;
return isLocal(runConfiguration);
}
RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
......
......@@ -42,6 +42,7 @@ public:
QString workingDirectory;
Utils::Environment environment;
ApplicationLauncher::Mode runMode = ApplicationLauncher::Gui;
IDevice::ConstPtr device; // Override the kit's device. Keep unset by default.
};
PROJECTEXPLORER_EXPORT bool operator==(const StandardRunnable &r1, const StandardRunnable &r2);
......
......@@ -33,6 +33,7 @@
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <coreplugin/icore.h>
......@@ -253,6 +254,7 @@ Runnable CustomExecutableRunConfiguration::runnable() const
r.workingDirectory = workingDirectory();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
r.runMode = extraAspect<TerminalAspect>()->runMode();
r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
return r;
}
......
......@@ -85,8 +85,9 @@ void ValgrindRunControl::start()
ValgrindRunner *run = runner();
run->setValgrindExecutable(m_settings->valgrindExecutable());
run->setValgrindArguments(genericToolArguments() + toolArguments());
run->setDevice(device());
run->setDebuggee(runnable().as<StandardRunnable>());
const StandardRunnable r = runnable().as<StandardRunnable>();
run->setDevice(r.device ? r.device : device());
run->setDebuggee(r);
connect(run, &ValgrindRunner::processOutputReceived,
this, &ValgrindRunControl::receiveProcessOutput);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment