Changeset View
Changeset View
Standalone View
Standalone View
plugins/heaptrack/job.cpp
Show All 19 Lines | |||||
20 | #include "job.h" | 20 | #include "job.h" | ||
21 | 21 | | |||
22 | #include "debug.h" | 22 | #include "debug.h" | ||
23 | #include "globalsettings.h" | 23 | #include "globalsettings.h" | ||
24 | #include "utils.h" | 24 | #include "utils.h" | ||
25 | 25 | | |||
26 | #include <execute/iexecuteplugin.h> | 26 | #include <execute/iexecuteplugin.h> | ||
27 | #include <interfaces/icore.h> | 27 | #include <interfaces/icore.h> | ||
28 | #include <interfaces/iplugincontroller.h> | | |||
29 | #include <interfaces/iuicontroller.h> | 28 | #include <interfaces/iuicontroller.h> | ||
30 | #include <util/environmentprofilelist.h> | 29 | #include <util/environmentprofilelist.h> | ||
31 | #include <util/path.h> | 30 | #include <util/path.h> | ||
32 | 31 | | |||
33 | #include <KLocalizedString> | 32 | #include <KLocalizedString> | ||
34 | 33 | | |||
35 | #include <QFileInfo> | 34 | #include <QFileInfo> | ||
36 | #include <QRegularExpression> | 35 | #include <QRegularExpression> | ||
37 | 36 | | |||
38 | namespace Heaptrack | 37 | namespace Heaptrack | ||
39 | { | 38 | { | ||
40 | 39 | | |||
41 | Job::Job(KDevelop::ILaunchConfiguration* launchConfig) | 40 | Job::Job(KDevelop::ILaunchConfiguration* launchConfig, IExecutePlugin* executePlugin) | ||
42 | : m_pid(-1) | 41 | : m_pid(-1) | ||
43 | { | 42 | { | ||
44 | Q_ASSERT(launchConfig); | 43 | Q_ASSERT(launchConfig); | ||
44 | Q_ASSERT(executePlugin); | ||||
45 | 45 | | |||
46 | auto pluginController = KDevelop::ICore::self()->pluginController(); | 46 | QString envProfile = executePlugin->environmentProfileName(launchConfig); | ||
47 | auto iface = pluginController->pluginForExtension(QStringLiteral("org.kdevelop.IExecutePlugin"))->extension<IExecutePlugin>(); | | |||
48 | Q_ASSERT(iface); | | |||
49 | | ||||
50 | QString envProfile = iface->environmentProfileName(launchConfig); | | |||
51 | if (envProfile.isEmpty()) { | 47 | if (envProfile.isEmpty()) { | ||
52 | envProfile = KDevelop::EnvironmentProfileList(KSharedConfig::openConfig()).defaultProfileName(); | 48 | envProfile = KDevelop::EnvironmentProfileList(KSharedConfig::openConfig()).defaultProfileName(); | ||
53 | } | 49 | } | ||
54 | setEnvironmentProfile(envProfile); | 50 | setEnvironmentProfile(envProfile); | ||
55 | 51 | | |||
56 | QString errorString; | 52 | QString errorString; | ||
57 | 53 | | |||
58 | m_analyzedExecutable = iface->executable(launchConfig, errorString).toLocalFile(); | 54 | m_analyzedExecutable = executePlugin->executable(launchConfig, errorString).toLocalFile(); | ||
59 | if (!errorString.isEmpty()) { | 55 | if (!errorString.isEmpty()) { | ||
60 | setError(-1); | 56 | setError(-1); | ||
61 | setErrorText(errorString); | 57 | setErrorText(errorString); | ||
62 | } | 58 | } | ||
63 | 59 | | |||
64 | QStringList analyzedExecutableArguments = iface->arguments(launchConfig, errorString); | 60 | QStringList analyzedExecutableArguments = executePlugin->arguments(launchConfig, errorString); | ||
65 | if (!errorString.isEmpty()) { | 61 | if (!errorString.isEmpty()) { | ||
66 | setError(-1); | 62 | setError(-1); | ||
67 | setErrorText(errorString); | 63 | setErrorText(errorString); | ||
68 | } | 64 | } | ||
69 | 65 | | |||
70 | QUrl workDir = iface->workingDirectory(launchConfig); | 66 | QUrl workDir = executePlugin->workingDirectory(launchConfig); | ||
71 | if (workDir.isEmpty() || !workDir.isValid()) { | 67 | if (workDir.isEmpty() || !workDir.isValid()) { | ||
72 | workDir = QUrl::fromLocalFile(QFileInfo(m_analyzedExecutable).absolutePath()); | 68 | workDir = QUrl::fromLocalFile(QFileInfo(m_analyzedExecutable).absolutePath()); | ||
73 | } | 69 | } | ||
74 | setWorkingDirectory(workDir); | 70 | setWorkingDirectory(workDir); | ||
75 | 71 | | |||
76 | *this << KDevelop::Path(GlobalSettings::heaptrackExecutable()).toLocalFile(); | 72 | *this << KDevelop::Path(GlobalSettings::heaptrackExecutable()).toLocalFile(); | ||
77 | *this << m_analyzedExecutable; | 73 | *this << m_analyzedExecutable; | ||
78 | *this << analyzedExecutableArguments; | 74 | *this << analyzedExecutableArguments; | ||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |