Commit e88ec44e authored by Aurindam Jana's avatar Aurindam Jana
Browse files

QmlProfiler: Remove RemoteLinux dependency



Change-Id: I3ff14691b4f9c80793a491b61444f8ceeb05a4fb
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@digia.com>
parent 6e677a97
......@@ -45,7 +45,7 @@ enum StartMode
StartLocal = -1,
StartRemote = -2,
StartQml = -3,
StartQmlAndroid = -4 // TODO: remove this enum and make it generic
StartQmlRemote = -4 // TODO: remove this enum and make it generic
};
namespace Constants {
......
......@@ -54,7 +54,7 @@ Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
case StartRemote:
return id.withSuffix(".Remote");
case StartQml:
case StartQmlAndroid:
case StartQmlRemote:
return id.withSuffix(".Qml");
}
return Id();
......
......@@ -63,7 +63,7 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
AnalyzerStartParameters params;
params.toolId = tool->id();
params.startMode = StartQmlAndroid;
params.startMode = StartQmlRemote;
Target *target = runConfig->target();
params.displayName = AndroidManager::packageName(target);
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
......
......@@ -11,7 +11,6 @@ SOURCES += \
qmlprofilerengine.cpp \
qmlprofilerattachdialog.cpp \
localqmlprofilerrunner.cpp \
remotelinuxqmlprofilerrunner.cpp \
qmlprofilereventview.cpp \
qmlprofilerdetailsrewriter.cpp \
qmlprofilertraceview.cpp \
......@@ -32,7 +31,6 @@ HEADERS += \
qmlprofilerattachdialog.h \
abstractqmlprofilerrunner.h \
localqmlprofilerrunner.h \
remotelinuxqmlprofilerrunner.h \
qmlprofilereventview.h \
qmlprofilerdetailsrewriter.h \
qmlprofilertraceview.h \
......
......@@ -55,8 +55,6 @@ QtcPlugin {
"qmlprofilerviewmanager.h",
"qv8profilerdatamodel.cpp",
"qv8profilerdatamodel.h",
"remotelinuxqmlprofilerrunner.cpp",
"remotelinuxqmlprofilerrunner.h",
"timelinerenderer.cpp",
"timelinerenderer.h",
"canvas/qdeclarativecanvas.cpp",
......
......@@ -7,5 +7,4 @@ QTC_PLUGIN_DEPENDS += \
analyzerbase \
qmlprojectmanager \
qt4projectmanager \
qmljstools \
remotelinux
qmljstools
......@@ -30,7 +30,6 @@
#include "qmlprofilerengine.h"
#include "localqmlprofilerrunner.h"
#include "remotelinuxqmlprofilerrunner.h"
#include <analyzerbase/analyzermanager.h>
#include <coreplugin/icore.h>
......@@ -46,7 +45,6 @@
#include <projectexplorer/localapplicationruncontrol.h>
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <qmldebug/qmloutputparser.h>
#include <remotelinux/remotelinuxrunconfiguration.h>
#include <QMainWindow>
#include <QMessageBox>
......@@ -91,37 +89,36 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
if (!runConfiguration) // attaching
return 0;
if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
QmlProjectManager::QmlProjectRunConfiguration *rc1 =
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
LocalApplicationRunConfiguration *rc2 =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
// Supports only local run configurations
if (!rc1 && !rc2)
return 0;
ProjectExplorer::EnvironmentAspect *environment
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
QTC_ASSERT(environment, return 0);
LocalQmlProfilerRunner::Configuration conf;
if (rc1) {
// This is a "plain" .qmlproject.
conf.executable = rc1->observerPath();
conf.executableArguments = rc1->viewerArguments();
conf.workingDirectory = rc1->workingDirectory();
conf.environment = environment->environment();
} else {
ProjectExplorer::EnvironmentAspect *environment
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
QTC_ASSERT(environment, return 0);
LocalQmlProfilerRunner::Configuration conf;
if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
// This is a "plain" .qmlproject.
conf.executable = rc1->observerPath();
conf.executableArguments = rc1->viewerArguments();
conf.workingDirectory = rc1->workingDirectory();
conf.environment = environment->environment();
} else if (LocalApplicationRunConfiguration *rc2 =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
// FIXME: Check.
conf.executable = rc2->executable();
conf.executableArguments = rc2->commandLineArguments();
conf.workingDirectory = rc2->workingDirectory();
conf.environment = environment->environment();
} else {
QTC_CHECK(false);
}
const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
conf.port = sp.analyzerPort;
runner = new LocalQmlProfilerRunner(conf, parent);
// FIXME: Check.
conf.executable = rc2->executable();
conf.executableArguments = rc2->commandLineArguments();
conf.workingDirectory = rc2->workingDirectory();
conf.environment = environment->environment();
}
const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
conf.port = sp.analyzerPort;
runner = new LocalQmlProfilerRunner(conf, parent);
return runner;
}
......@@ -197,7 +194,7 @@ bool QmlProfilerEngine::start()
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
d->m_runner->start();
d->m_noDebugOutputTimer.start();
} else if (d->sp.startMode == StartQmlAndroid) {
} else if (d->sp.startMode == StartQmlRemote) {
d->m_noDebugOutputTimer.start();
} else {
emit processRunning(startParameters().analyzerPort);
......
......@@ -57,9 +57,6 @@
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <texteditor/itexteditor.h>
#include <remotelinux/remotelinuxrunconfiguration.h>
#include <remotelinux/linuxdevice.h>
#include <android/androidconstants.h>
#include <coreplugin/coreconstants.h>
......@@ -97,7 +94,6 @@ using namespace QmlProfiler::Constants;
using namespace QmlDebug;
using namespace ProjectExplorer;
using namespace QmlProjectManager;
using namespace RemoteLinux;
class QmlProfilerTool::QmlProfilerToolPrivate
{
......@@ -284,7 +280,6 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)
|| qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)
|| qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
return mode == runMode();
return false;
......@@ -328,16 +323,6 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
sp.debuggee = rc2->executable();
sp.debuggeeArgs = rc2->commandLineArguments();
sp.displayName = rc2->displayName();
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.debuggee = rc3->remoteExecutableFilePath();
sp.debuggeeArgs = rc3->arguments();
sp.connParams = ProjectExplorer::DeviceKitInformation::device(rc3->target()->kit())->sshParameters();
sp.analyzerCmdPrefix = rc3->commandPrefix();
sp.displayName = rc3->displayName();
sp.sysroot = sysroot(rc3);
sp.analyzerHost = sp.connParams.host;
sp.analyzerPort = sp.connParams.port;
} else {
// What could that be?
QTC_ASSERT(false, return sp);
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "iremotelinuxrunsupport.h"
#include "remotelinuxrunconfiguration.h"
#include <projectexplorer/target.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <utils/portlist.h>
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
class IRemoteLinuxRunSupportPrivate
{
public:
IRemoteLinuxRunSupportPrivate(const RemoteLinuxRunConfiguration *runConfig)
: state(IRemoteLinuxRunSupport::Inactive),
device(DeviceKitInformation::device(runConfig->target()->kit())),
remoteFilePath(runConfig->remoteExecutableFilePath()),
arguments(runConfig->arguments()),
commandPrefix(runConfig->commandPrefix())
{
}
IRemoteLinuxRunSupport::State state;
DeviceApplicationRunner appRunner;
DeviceUsedPortsGatherer portsGatherer;
const ProjectExplorer::IDevice::ConstPtr device;
Utils::PortList portList;
const QString remoteFilePath;
const QString arguments;
const QString commandPrefix;
};
} // namespace Internal
using namespace Internal;
IRemoteLinuxRunSupport::IRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig, QObject *parent)
: QObject(parent),
d(new IRemoteLinuxRunSupportPrivate(runConfig))
{
}
IRemoteLinuxRunSupport::~IRemoteLinuxRunSupport()
{
setFinished();
delete d;
}
void IRemoteLinuxRunSupport::setApplicationRunnerPreRunAction(DeviceApplicationHelperAction *action)
{
d->appRunner.setPreRunAction(action);
}
void IRemoteLinuxRunSupport::setApplicationRunnerPostRunAction(DeviceApplicationHelperAction *action)
{
d->appRunner.setPostRunAction(action);
}
void IRemoteLinuxRunSupport::setState(IRemoteLinuxRunSupport::State state)
{
d->state = state;
}
IRemoteLinuxRunSupport::State IRemoteLinuxRunSupport::state() const
{
return d->state;
}
void IRemoteLinuxRunSupport::handleRemoteSetupRequested()
{
QTC_ASSERT(d->state == Inactive, return);
d->state = GatheringPorts;
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString)));
connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
d->portsGatherer.start(d->device);
}
void IRemoteLinuxRunSupport::handlePortsGathererError(const QString &message)
{
QTC_ASSERT(d->state == GatheringPorts, return);
handleAdapterSetupFailed(message);
}
void IRemoteLinuxRunSupport::handlePortListReady()
{
QTC_ASSERT(d->state == GatheringPorts, return);
d->portList = d->device->freePorts();
startExecution();
}
void IRemoteLinuxRunSupport::handleAppRunnerError(const QString &)
{
}
void IRemoteLinuxRunSupport::handleRemoteOutput(const QByteArray &)
{
}
void IRemoteLinuxRunSupport::handleRemoteErrorOutput(const QByteArray &)
{
}
void IRemoteLinuxRunSupport::handleAppRunnerFinished(bool)
{
}
void IRemoteLinuxRunSupport::handleProgressReport(const QString &)
{
}
void IRemoteLinuxRunSupport::handleAdapterSetupFailed(const QString &)
{
setFinished();
}
void IRemoteLinuxRunSupport::handleAdapterSetupDone()
{
d->state = Running;
}
void IRemoteLinuxRunSupport::setFinished()
{
if (d->state == Inactive)
return;
d->portsGatherer.disconnect(this);
d->appRunner.disconnect(this);
if (d->state == Running) {
const QString stopCommand
= d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath);
d->appRunner.stop(stopCommand.toUtf8());
}
d->state = Inactive;
}
bool IRemoteLinuxRunSupport::setPort(int &port)
{
port = d->portsGatherer.getNextFreePort(&d->portList);
if (port == -1) {
handleAdapterSetupFailed(tr("Not enough free ports on device for debugging."));
return false;
}
return true;
}
QString IRemoteLinuxRunSupport::arguments() const
{
return d->arguments;
}
QString IRemoteLinuxRunSupport::commandPrefix() const
{
return d->commandPrefix;
}
QString IRemoteLinuxRunSupport::remoteFilePath() const
{
return d->remoteFilePath;
}
const IDevice::ConstPtr IRemoteLinuxRunSupport::device() const
{
return d->device;
}
DeviceApplicationRunner *IRemoteLinuxRunSupport::appRunner() const
{
return &d->appRunner;
}
} // namespace RemoteLinux
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef IREMOTELINUXRUNSUPPORT_H
#define IREMOTELINUXRUNSUPPORT_H
#include "remotelinux_export.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <QObject>
namespace ProjectExplorer {
class DeviceApplicationHelperAction;
class DeviceApplicationRunner;
}
namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
namespace Internal { class IRemoteLinuxRunSupportPrivate; }
class REMOTELINUX_EXPORT IRemoteLinuxRunSupport : public QObject
{
Q_OBJECT
protected:
enum State
{
Inactive,
GatheringPorts,
StartingRunner,
Running
};
public:
IRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig,
QObject *parent = 0);
~IRemoteLinuxRunSupport();
void setApplicationRunnerPreRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
void setApplicationRunnerPostRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
protected:
void setState(State state);
State state() const;
ProjectExplorer::DeviceApplicationRunner *appRunner() const;
virtual void startExecution() = 0;
virtual void handleAdapterSetupFailed(const QString &error);
virtual void handleAdapterSetupDone();
void setFinished();
bool setPort(int &port);
QString arguments() const;
QString commandPrefix() const;
QString remoteFilePath() const;
const ProjectExplorer::IDevice::ConstPtr device() const;
protected slots:
virtual void handleRemoteSetupRequested();
virtual void handleAppRunnerError(const QString &error);
virtual void handleRemoteOutput(const QByteArray &output);
virtual void handleRemoteErrorOutput(const QByteArray &output);
virtual void handleAppRunnerFinished(bool success);
virtual void handleProgressReport(const QString &progressOutput);
private slots:
void handlePortsGathererError(const QString &message);
void handlePortListReady();
private:
friend class Internal::IRemoteLinuxRunSupportPrivate;
Internal::IRemoteLinuxRunSupportPrivate * const d;
};
} // namespace RemoteLinux
#endif // IREMOTELINUXRUNSUPPORT_H
......@@ -46,7 +46,9 @@ HEADERS += \
genericlinuxdeviceconfigurationwidget.h \
remotelinuxcheckforfreediskspaceservice.h \
remotelinuxcheckforfreediskspacestep.h \
remotelinuxdeploymentdatamodel.h
remotelinuxdeploymentdatamodel.h \
iremotelinuxrunsupport.h \
remotelinuxanalyzesupport.h
SOURCES += \
embeddedlinuxqtversion.cpp \
......@@ -90,7 +92,9 @@ SOURCES += \
genericlinuxdeviceconfigurationwidget.cpp \
remotelinuxcheckforfreediskspaceservice.cpp \
remotelinuxcheckforfreediskspacestep.cpp \
remotelinuxdeploymentdatamodel.cpp
remotelinuxdeploymentdatamodel.cpp \
iremotelinuxrunsupport.cpp \
remotelinuxanalyzesupport.cpp
FORMS += \
genericlinuxdeviceconfigurationwizardsetuppage.ui \
......
......@@ -3,4 +3,5 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
qtsupport
qtsupport \
analyzerbase
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "remotelinuxanalyzesupport.h"
#include "remotelinuxrunconfiguration.h"
#include <analyzerbase/ianalyzerengine.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h>
#include <utils/qtcassert.h>
#include <QPointer>
using namespace QSsh;
using namespace Analyzer;
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
class RemoteLinuxAnalyzeSupportPrivate
{
public:
RemoteLinuxAnalyzeSupportPrivate(IAnalyzerEngine *engine, RunMode runMode)
: engine(engine),
qmlProfiling(runMode == QmlProfilerRunMode),
qmlPort(-1)
{