aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qnx/qnxanalyzesupport.cpp
blob: 29ea42b7cdbc5e8658f39aac3af5333ea7c9de4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "qnxanalyzesupport.h"

#include "qnxconstants.h"
#include "qnxtr.h"
#include "slog2inforunner.h"

#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>

#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>

#include <qmldebug/qmldebugcommandlinearguments.h>

using namespace ProjectExplorer;
using namespace Utils;

namespace Qnx::Internal {

class QnxQmlProfilerSupport final : public SimpleTargetRunner
{
public:
    explicit QnxQmlProfilerSupport(RunControl *runControl)
        : SimpleTargetRunner(runControl)
    {
        setId("QnxQmlProfilerSupport");
        appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);

        auto portsGatherer = new PortsGatherer(runControl);
        addStartDependency(portsGatherer);

        auto slog2InfoRunner = new Slog2InfoRunner(runControl);
        addStartDependency(slog2InfoRunner);

        auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
        profiler->addStartDependency(this);
        addStopDependency(profiler);

        setStartModifier([this, portsGatherer, profiler] {
            const QUrl serverUrl = portsGatherer->findEndPoint();
            profiler->recordData("QmlServerUrl", serverUrl);

            CommandLine cmd = commandLine();
            cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl));
            setCommandLine(cmd);
        });
    }
};

QnxQmlProfilerWorkerFactory::QnxQmlProfilerWorkerFactory()
{
    setProduct<QnxQmlProfilerSupport>();
    // FIXME: Shouldn't this use the run mode id somehow?
    addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
}

} // Qnx::Internal