diff options
author | hjk <hjk@qt.io> | 2019-08-23 11:13:29 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-08-26 08:16:03 +0000 |
commit | dca7edbeef1ad622e41987b6cf87d1873ad757e6 (patch) | |
tree | 2b21ea3eb246cfcfc6f91b7ce1043334649e1e5c | |
parent | 89f3b32104e1094bdb6942c52e1ee0eced2f0c3c (diff) |
Let PortsGatherer produce full URLs instead of ports only
This is what the consuming code expects in most cases.
Change-Id: I135592039e28b994996186f627215ab1d2f8d6dc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/libs/qmldebug/qmldebugcommandlinearguments.h | 6 | ||||
-rw-r--r-- | src/plugins/boot2qt/qdbdevicedebugsupport.cpp | 15 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerruncontrol.cpp | 18 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerruncontrol.h | 2 | ||||
-rw-r--r-- | src/plugins/ios/iosrunner.cpp | 7 | ||||
-rw-r--r-- | src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp | 16 | ||||
-rw-r--r-- | src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h | 2 | ||||
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.cpp | 9 | ||||
-rw-r--r-- | src/plugins/qnx/qnxdebugsupport.cpp | 10 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp | 8 | ||||
-rw-r--r-- | src/plugins/webassembly/webassemblyrunconfiguration.cpp | 2 |
11 files changed, 35 insertions, 60 deletions
diff --git a/src/libs/qmldebug/qmldebugcommandlinearguments.h b/src/libs/qmldebug/qmldebugcommandlinearguments.h index 0c9979647a..8c70a36899 100644 --- a/src/libs/qmldebug/qmldebugcommandlinearguments.h +++ b/src/libs/qmldebug/qmldebugcommandlinearguments.h @@ -25,7 +25,6 @@ #pragma once -#include <utils/port.h> #include <QString> #include <QUrl> @@ -69,9 +68,10 @@ inline QString qmlDebugCommandLineArguments(QmlDebugServicesPreset services, } inline QString qmlDebugTcpArguments(QmlDebugServicesPreset services, - Utils::Port port, bool block = true) + const QUrl &server, bool block = true) { - return qmlDebugCommandLineArguments(services, QString("port:%1").arg(port.number()), block); + // TODO: Also generate host:<host> if applicable. + return qmlDebugCommandLineArguments(services, QString("port:%1").arg(server.port()), block); } inline QString qmlDebugNativeArguments(QmlDebugServicesPreset services, bool block = true) diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp index cf2fe49327..7ef38ad832 100644 --- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp +++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp @@ -72,16 +72,15 @@ public: addStartDependency(m_portsGatherer); } - Port perfPort() const { return m_portsGatherer->gdbServerPort(); } + QUrl perfServer() const { return m_portsGatherer->gdbServer(); } QUrl gdbServer() const { return m_portsGatherer->gdbServer(); } - Port qmlServerPort() const { return m_portsGatherer->qmlServerPort(); } QUrl qmlServer() const { return m_portsGatherer->qmlServer(); } void start() override { - const int perfPort = m_portsGatherer->gdbServerPort().number(); - const int gdbServerPort = m_portsGatherer->gdbServerPort().number(); - const int qmlServerPort = m_portsGatherer->qmlServerPort().number(); + const int perfPort = m_portsGatherer->gdbServer().port(); + const int gdbServerPort = m_portsGatherer->gdbServer().port(); + const int qmlServerPort = m_portsGatherer->qmlServer().port(); int lowerPort = 0; int upperPort = 0; @@ -212,11 +211,7 @@ QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runContro void QdbDevicePerfProfilerSupport::start() { - QUrl url; - url.setScheme(Utils::urlTcpScheme()); - url.setHost(device()->sshParameters().host()); - url.setPort(m_profilee->perfPort().number()); - runControl()->setProperty("PerfConnection", url); + runControl()->setProperty("PerfConnection", m_profilee->perfServer()); reportStarted(); } diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index ec80b470cf..73c7080c2e 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -845,7 +845,7 @@ bool DebuggerRunTool::fixupParameters() if (rp.startMode != AttachExternal && rp.startMode != AttachCrashedExternal) { QString qmlarg = rp.isCppDebugging() && rp.nativeMixedEnabled ? QmlDebug::qmlDebugNativeArguments(service, false) - : QmlDebug::qmlDebugTcpArguments(service, Port(rp.qmlServer.port())); + : QmlDebug::qmlDebugTcpArguments(service, rp.qmlServer); QtcProcess::addArg(&rp.inferior.commandLineArguments, qmlarg); } } @@ -1047,23 +1047,11 @@ GdbServerPortsGatherer::GdbServerPortsGatherer(RunControl *runControl) GdbServerPortsGatherer::~GdbServerPortsGatherer() = default; -Port GdbServerPortsGatherer::gdbServerPort() const -{ - QUrl url = channel(0); - return Port(url.port()); -} - QUrl GdbServerPortsGatherer::gdbServer() const { return channel(0); } -Port GdbServerPortsGatherer::qmlServerPort() const -{ - QUrl url = channel(1); - return Port(url.port()); -} - QUrl GdbServerPortsGatherer::qmlServer() const { return channel(1); @@ -1111,7 +1099,7 @@ void GdbServerRunner::start() if (isQmlDebugging) { args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, - m_portsGatherer->qmlServerPort())); + m_portsGatherer->qmlServer())); } if (isQmlDebugging && !isCppDebugging) { gdbserver.executable = m_runnable.executable; // FIXME: Case should not happen? @@ -1124,7 +1112,7 @@ void GdbServerRunner::start() args.append("--multi"); if (m_pid.isValid()) args.append("--attach"); - args.append(QString(":%1").arg(m_portsGatherer->gdbServerPort().number())); + args.append(QString(":%1").arg(m_portsGatherer->gdbServer().port())); if (m_pid.isValid()) args.append(QString::number(m_pid.pid())); } diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 109de7fe53..ca219ad1bf 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -147,12 +147,10 @@ public: void setUseGdbServer(bool useIt) { m_useGdbServer = useIt; } bool useGdbServer() const { return m_useGdbServer; } - Utils::Port gdbServerPort() const; QUrl gdbServer() const; void setUseQmlServer(bool useIt) { m_useQmlServer = useIt; } bool useQmlServer() const { return m_useQmlServer; } - Utils::Port qmlServerPort() const; QUrl qmlServer() const; private: diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index 2d4039a637..21879132ce 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -199,8 +199,11 @@ void IosRunner::start() this, &IosRunner::handleFinished); QStringList args = QtcProcess::splitArgs(m_arguments, OsTypeMac); - if (m_qmlServerPort.isValid()) - args.append(QmlDebug::qmlDebugTcpArguments(m_qmlDebugServices, m_qmlServerPort)); + if (m_qmlServerPort.isValid()) { + QUrl qmlServer; + qmlServer.setPort(m_qmlServerPort.number()); + args.append(QmlDebug::qmlDebugTcpArguments(m_qmlDebugServices, qmlServer)); + } m_toolHandler->requestRunApp(bundlePath(), args, runType(), deviceId()); } diff --git a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp index 2bb94dad54..746fb8fd50 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp @@ -197,9 +197,13 @@ void PortsGatherer::start() m_portsGatherer.start(device()); } -Port PortsGatherer::findPort() +QUrl PortsGatherer::findEndPoint() { - return m_portsGatherer.getNextFreePort(&m_portList); + QUrl result; + result.setScheme(urlTcpScheme()); + result.setHost(device()->sshParameters().host()); + result.setPort(m_portsGatherer.getNextFreePort(&m_portList).number()); + return result; } void PortsGatherer::stop() @@ -268,11 +272,7 @@ public: if (m_channelForwarder) { m_channelForwarder->addStartDependency(m_portGatherer); m_channelForwarder->setFromUrlGetter([this] { - QUrl url; - url.setScheme(urlTcpScheme()); - url.setHost(device()->sshParameters().host()); - url.setPort(m_portGatherer->findPort().number()); - return url; + return m_portGatherer->findEndPoint(); }); addStartDependency(m_channelForwarder); } @@ -287,7 +287,7 @@ public: if (m_channelForwarder) m_channel.setPort(m_channelForwarder->recordedData("LocalPort").toUInt()); else if (m_portGatherer) - m_channel.setPort(m_portGatherer->findPort().number()); + m_channel.setPort(m_portGatherer->findEndPoint().port()); reportStarted(); } diff --git a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h index 4344f059a5..da3f866ae2 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h +++ b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h @@ -74,7 +74,7 @@ public: explicit PortsGatherer(RunControl *runControl); ~PortsGatherer() override; - Utils::Port findPort(); + QUrl findEndPoint(); protected: void start() override; diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 3f732f8805..cab0bc7d57 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -66,17 +66,12 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) void QnxQmlProfilerSupport::start() { - Port qmlPort = m_portsGatherer->findPort(); - - QUrl serverUrl; - serverUrl.setHost(device()->sshParameters().host()); - serverUrl.setPort(qmlPort.number()); - serverUrl.setScheme("tcp"); + const QUrl serverUrl = m_portsGatherer->findEndPoint(); m_profiler->recordData("QmlServerUrl", serverUrl); Runnable r = runnable(); QtcProcess::addArg(&r.commandLineArguments, - QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, qmlPort), + QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl), device()->osType()); setRunnable(r); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index ed67dc8a35..37809a9e44 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -108,13 +108,13 @@ private: Runnable r = runnable(); QStringList arguments; if (m_portsGatherer->useGdbServer()) { - Port pdebugPort = m_portsGatherer->gdbServerPort(); + int pdebugPort = m_portsGatherer->gdbServer().port(); r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); - arguments.append(pdebugPort.toString()); + arguments.append(QString::number(pdebugPort)); } if (m_portsGatherer->useQmlServer()) { arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, - m_portsGatherer->qmlServerPort())); + m_portsGatherer->qmlServer())); } arguments.append(QtcProcess::splitArgs(r.commandLineArguments)); r.commandLineArguments = QtcProcess::joinArgs(arguments); @@ -206,11 +206,11 @@ public: private: void start() final { - Port pdebugPort = m_portsGatherer->gdbServerPort(); + const int pdebugPort = m_portsGatherer->gdbServer().port(); Runnable r; r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); - r.commandLineArguments = pdebugPort.toString(); + r.commandLineArguments = QString::number(pdebugPort); setRunnable(r); SimpleTargetRunner::start(); diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp index 49f6851068..65194e3e96 100644 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp @@ -57,16 +57,12 @@ RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport( void RemoteLinuxQmlToolingSupport::start() { - Port qmlPort = m_portsGatherer->findPort(); + const QUrl serverUrl = m_portsGatherer->findEndPoint(); - QUrl serverUrl; - serverUrl.setScheme(urlTcpScheme()); - serverUrl.setHost(device()->sshParameters().host()); - serverUrl.setPort(qmlPort.number()); m_runworker->recordData("QmlServerUrl", serverUrl); Runnable r = runnable(); - QtcProcess::addArg(&r.commandLineArguments, QmlDebug::qmlDebugTcpArguments(m_services, qmlPort), + QtcProcess::addArg(&r.commandLineArguments, QmlDebug::qmlDebugTcpArguments(m_services, serverUrl), device()->osType()); setRunnable(r); diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index 6a1d98f815..c6ead8ae21 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -99,7 +99,7 @@ public: { CommandLine cmd = emrunCommand(runControl()->target(), runControl()->aspect<WebBrowserSelectionAspect>()->currentBrowser(), - m_portsGatherer->findPort().toString()); + QString::number(m_portsGatherer->findEndPoint().port())); Runnable r; r.setCommandLine(cmd); setRunnable(r); |