aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/winrt
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-03-11 15:42:43 +0100
committerhjk <hjk@qt.io>2019-03-12 12:27:35 +0000
commit9ef0b97716e4ed73187470bc574a9c2a550d8901 (patch)
treead89a72d5947f14ac3342aed65961f31d7736169 /src/plugins/winrt
parent582f72f433c0b68ada35d0d2912f4c21146f17d7 (diff)
Avoid some visible uses of RunControl::runConfiguration()
For a long time, probably from the very beginning, a RunControl was meant to hold (a copy of) data needed for its operation, that was valid at the time of its construction, to be resilient in cases where RunConfiguration setting were changed while the RunControl was running, or to properly re-run with the original settings. Unfortunately, the task was repetitive, as RunConfiguration classes had no generic access to properties / "aspects" and there was was the runConfiguration() accessor (probably for mostly unrelated reasons in the output pane handling) which made the idea of just casting that to the original runConfiguration and access the data directly there appealing, with all the expected consequences. This patch here partially addresses the issue by copying some more of the related data at RunControl construction time and adjust the using code, avoiding most uses of the runConfiguration() accessor in a mostly mechanical matter. Complete removal appears possible, but will be less mechanical in "difficult" plugins like ios, so this is left for later. The new accessors in RunControl are very much ad-hoc, leaving room for improvement, e.g. by consolidating the access to the run config settings aspects with the other runconfig aspects or similar. For now the goal is to remove the runConfiguration() accessor, and to as much as possible fixed data after RunControl setup is finished. Next step would be to officially allow construction of RunControls without a specific RunConfiguration by setting the necessary data independently, removing the need for the various workarounds that are currently used for the purpose of faking (parts of) the effect of the non-existing RunConfiguration or refusing to operate at all, even if it would be possible. Change-Id: If8e5596da8422c70e90f97270389adbe6d0b46f2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r--src/plugins/winrt/winrtdebugsupport.cpp2
-rw-r--r--src/plugins/winrt/winrtrunnerhelper.cpp19
2 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp
index f7962c4ef0..d7f3e9a59b 100644
--- a/src/plugins/winrt/winrtdebugsupport.cpp
+++ b/src/plugins/winrt/winrtdebugsupport.cpp
@@ -75,7 +75,7 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
setQmlServer(qmlServer);
}
- setSymbolFile(runControl->runConfiguration()->buildTargetInfo().targetFilePath.toString());
+ setSymbolFile(runControl->buildTargetInfo().targetFilePath.toString());
QString errorMessage;
m_runner = new WinRtRunnerHelper(this, &errorMessage);
if (!errorMessage.isEmpty()) {
diff --git a/src/plugins/winrt/winrtrunnerhelper.cpp b/src/plugins/winrt/winrtrunnerhelper.cpp
index 491abfc57f..b5b10b0600 100644
--- a/src/plugins/winrt/winrtrunnerhelper.cpp
+++ b/src/plugins/winrt/winrtrunnerhelper.cpp
@@ -50,12 +50,11 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
: QObject(runWorker)
, m_worker(runWorker)
{
- auto runConfiguration = runWorker->runControl()->runConfiguration();
+ auto runControl = runWorker->runControl();
- ProjectExplorer::Target *target = runConfiguration->target();
m_device = runWorker->device().dynamicCast<const WinRtDevice>();
- const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target->kit());
+ const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(runControl->kit());
if (!qt) {
*errorMessage = tr("The current kit has no Qt version.");
return;
@@ -68,7 +67,7 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
return;
}
- const BuildTargetInfo bti = runConfiguration->buildTargetInfo();
+ const BuildTargetInfo bti = runControl->buildTargetInfo();
m_executableFilePath = bti.targetFilePath.toString();
if (m_executableFilePath.isEmpty()) {
@@ -84,13 +83,13 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
bool loopbackExemptClient = false;
bool loopbackExemptServer = false;
- if (auto aspect = runConfiguration->aspect<ArgumentsAspect>())
- m_arguments = aspect->arguments(runConfiguration->macroExpander());
- if (auto aspect = runConfiguration->aspect<UninstallAfterStopAspect>())
+ if (auto aspect = runControl->aspect<ArgumentsAspect>())
+ m_arguments = aspect->arguments(runControl->runConfiguration()->macroExpander());
+ if (auto aspect = runControl->aspect<UninstallAfterStopAspect>())
m_uninstallAfterStop = aspect->value();
- if (auto aspect = runConfiguration->aspect<LoopbackExemptClientAspect>())
+ if (auto aspect = runControl->aspect<LoopbackExemptClientAspect>())
loopbackExemptClient = aspect->value();
- if (auto aspect = runConfiguration->aspect<LoopbackExemptServerAspect>())
+ if (auto aspect = runControl->aspect<LoopbackExemptServerAspect>())
loopbackExemptServer = aspect->value();
if (loopbackExemptClient && loopbackExemptServer)
m_loopbackArguments = "--loopbackexempt clientserver";
@@ -99,7 +98,7 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
else if (loopbackExemptServer)
m_loopbackArguments = "--loopbackexempt server";
- if (ProjectExplorer::BuildConfiguration *bc = target->activeBuildConfiguration())
+ if (BuildConfiguration *bc = runControl->target()->activeBuildConfiguration())
m_environment = bc->environment();
}