Commit 9ae2ce76 authored by hjk's avatar hjk

ProjectExplorer: Drop LocalApplicationRunConfiguration

The functionality can be provided by producing a suitable Runnable
in the derived classes directly.

Change-Id: I7b8e8fe33fffd2b00176b6cf6633eca4e152e466
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 4ea8cacc
......@@ -30,8 +30,9 @@
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
......@@ -94,20 +95,17 @@ void basicProjectInformation(Project *project, const QString &proFile, QString *
}
}
void extractEnvironmentInformation(LocalApplicationRunConfiguration *localRunConfiguration,
QString *workDir, Utils::Environment *env)
static bool isLocal(RunConfiguration *runConfiguration)
{
*workDir = Utils::FileUtils::normalizePathName(localRunConfiguration->workingDirectory());
if (auto environmentAspect = localRunConfiguration->extraAspect<EnvironmentAspect>())
*env = environmentAspect->environment();
Target *target = runConfiguration ? runConfiguration->target() : 0;
Kit *kit = target ? target->kit() : 0;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
}
void TestConfiguration::completeTestInformation()
{
QTC_ASSERT(!m_mainFilePath.isEmpty() || !m_proFile.isEmpty(), return);
typedef LocalApplicationRunConfiguration LocalRunConfig;
Project *project = SessionManager::startupProject();
if (!project)
return;
......@@ -144,23 +142,32 @@ void TestConfiguration::completeTestInformation()
QList<RunConfiguration *> rcs = target->runConfigurations();
foreach (RunConfiguration *rc, rcs) {
auto config = qobject_cast<LocalRunConfig *>(rc);
if (config && config->executable() == targetFile) {
extractEnvironmentInformation(config, &workDir, &env);
Runnable runnable = rc->runnable();
if (isLocal(rc) && runnable.is<StandardRunnable>()) {
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
if (stdRunnable.executable == targetFile) {
workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory);
env = stdRunnable.environment;
hasDesktopTarget = true;
break;
}
}
}
// if we could not figure out the run configuration
// try to use the run configuration of the parent project
if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) {
if (auto config = qobject_cast<LocalRunConfig *>(target->activeRunConfiguration())) {
extractEnvironmentInformation(config, &workDir, &env);
if (auto rc = target->activeRunConfiguration()) {
Runnable runnable = rc->runnable();
if (isLocal(rc) && runnable.is<StandardRunnable>()) {
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory);
env = stdRunnable.environment;
hasDesktopTarget = true;
guessedRunConfiguration = true;
}
}
}
setProFile(proFile);
setDisplayName(displayName);
......
......@@ -61,11 +61,11 @@ const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const QString &target,
const QString &workingDirectory, const QString &title) :
LocalApplicationRunConfiguration(parent, id),
RunConfiguration(parent, id),
m_buildTarget(target),
m_title(title)
{
addExtraAspect(new LocalEnvironmentAspect(this));
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.Arguments")));
addExtraAspect(new TerminalAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.UseTerminal")));
......@@ -77,7 +77,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const
}
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) :
LocalApplicationRunConfiguration(parent, source),
RunConfiguration(parent, source),
m_buildTarget(source->m_buildTarget),
m_title(source->m_title),
m_enabled(source->m_enabled)
......@@ -90,36 +90,25 @@ void CMakeRunConfiguration::ctor()
setDefaultDisplayName(defaultDisplayName());
}
QString CMakeRunConfiguration::executable() const
Runnable CMakeRunConfiguration::runnable() const
{
return m_buildTarget;
}
ApplicationLauncher::Mode CMakeRunConfiguration::runMode() const
{
return extraAspect<TerminalAspect>()->runMode();
}
QString CMakeRunConfiguration::workingDirectory() const
{
const auto *wdAspect = extraAspect<WorkingDirectoryAspect>();
QTC_ASSERT(wdAspect, return baseWorkingDirectory());
return wdAspect->workingDirectory().toString();
StandardRunnable r;
r.executable = m_buildTarget;
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
r.runMode = extraAspect<TerminalAspect>()->runMode();
return r;
}
QString CMakeRunConfiguration::baseWorkingDirectory() const
{
const QString exe = executable();
const QString exe = m_buildTarget;
if (!exe.isEmpty())
return QFileInfo(executable()).absolutePath();
return QFileInfo(m_buildTarget).absolutePath();
return QString();
}
QString CMakeRunConfiguration::commandLineArguments() const
{
return extraAspect<ArgumentsAspect>()->arguments();
}
QString CMakeRunConfiguration::title() const
{
return m_title;
......@@ -138,7 +127,7 @@ void CMakeRunConfiguration::setBaseWorkingDirectory(const QString &wd)
QVariantMap CMakeRunConfiguration::toMap() const
{
QVariantMap map(LocalApplicationRunConfiguration::toMap());
QVariantMap map(RunConfiguration::toMap());
map.insert(QLatin1String(TITLE_KEY), m_title);
return map;
}
......
......@@ -26,24 +26,13 @@
#ifndef CMAKERUNCONFIGURATION_H
#define CMAKERUNCONFIGURATION_H
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <projectexplorer/runnables.h>
#include <utils/environment.h>
QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE
namespace Utils {
class PathChooser;
class DetailsWidget;
}
namespace CMakeProjectManager {
namespace Internal {
class CMakeTarget;
class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
class CMakeRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
friend class CMakeRunConfigurationWidget;
......@@ -53,10 +42,7 @@ public:
CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
const QString &workingDirectory, const QString &title);
QString executable() const override;
ProjectExplorer::ApplicationLauncher::Mode runMode() const override;
QString workingDirectory() const override;
QString commandLineArguments() const override;
ProjectExplorer::Runnable runnable() const override;
QWidget *createConfigurationWidget() override;
void setExecutable(const QString &executable);
......
......@@ -87,7 +87,6 @@
#include <extensionsystem/invoker.h>
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
......@@ -98,6 +97,7 @@
#include <projectexplorer/projecttree.h>
#include <projectexplorer/projectexplorersettings.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
......
......@@ -40,9 +40,9 @@
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
#include <projectexplorer/devicesupport/deviceprocesslist.h>
#include <projectexplorer/environmentaspect.h> // For the environment
#include <projectexplorer/localapplicationrunconfiguration.h> // For LocalApplication*
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
......@@ -331,12 +331,13 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
m_runConfig = runConfig;
// Extract as much as possible from available RunConfiguration.
if (auto localRc = qobject_cast<const LocalApplicationRunConfiguration *>(m_runConfig)) {
m_rp.executable = localRc->executable();
m_rp.processArgs = localRc->commandLineArguments();
m_rp.useTerminal = localRc->runMode() == ApplicationLauncher::Console;
if (m_runConfig->runnable().is<StandardRunnable>()) {
auto runnable = m_runConfig->runnable().as<StandardRunnable>();
m_rp.executable = runnable.executable;
m_rp.processArgs = runnable.commandLineArguments;
m_rp.useTerminal = runnable.runMode == ApplicationLauncher::Console;
// Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...)
m_rp.workingDirectory = FileUtils::normalizePathName(localRc->workingDirectory());
m_rp.workingDirectory = FileUtils::normalizePathName(runnable.workingDirectory);
}
// Find a Kit and Target. Either could be missing.
......@@ -630,9 +631,11 @@ public:
bool canRun(RunConfiguration *runConfig, Core::Id mode) const override
{
return (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfig)
|| isDebuggableScript(runConfig));
if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain))
return false;
return DeviceTypeKitInformation::deviceTypeId(runConfig->target()->kit())
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|| isDebuggableScript(runConfig);
}
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
......
......@@ -38,7 +38,7 @@
#include <projectexplorer/projecttree.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <projectexplorer/runnables.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
......@@ -56,6 +56,13 @@ using namespace ProjectExplorer;
namespace Debugger {
namespace Internal {
static bool isLocal(RunConfiguration *runConfiguration)
{
Target *target = runConfiguration ? runConfiguration->target() : 0;
Kit *kit = target ? target->kit() : 0;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
}
/*!
\class Debugger::Internal::UnstartedAppWatcherDialog
......@@ -88,8 +95,11 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_kitChooser->setVisible(true);
Project *project = ProjectTree::currentProject();
if (project && project->activeTarget() && project->activeTarget()->kit())
m_kitChooser->setCurrentKitId(project->activeTarget()->kit()->id());
Target *activeTarget = project ? project->activeTarget() : 0;
Kit *kit = activeTarget ? activeTarget->kit() : 0;
if (kit)
m_kitChooser->setCurrentKitId(kit->id());
else if (KitManager::defaultKit())
m_kitChooser->setCurrentKitId(KitManager::defaultKit()->id());
......@@ -97,13 +107,12 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_pathChooser->setHistoryCompleter(QLatin1String("LocalExecutable"));
if (project && project->activeTarget() && project->activeTarget()->activeRunConfiguration()) {
LocalApplicationRunConfiguration *localAppRC =
qobject_cast<LocalApplicationRunConfiguration *>
(project->activeTarget()->activeRunConfiguration());
if (localAppRC)
m_pathChooser->setPath(localAppRC->executable());
if (activeTarget) {
if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {
const Runnable runnable = runConfig->runnable();
if (runnable.is<StandardRunnable>() && isLocal(runConfig))
m_pathChooser->setPath(runnable.as<StandardRunnable>().executable);
}
}
m_hideOnAttachCheckBox = new QCheckBox(tr("Reopen dialog when application finishes"), this);
......@@ -171,20 +180,19 @@ void UnstartedAppWatcherDialog::selectExecutable()
QString path;
Project *project = ProjectTree::currentProject();
Target *activeTarget = project ? project->activeTarget() : 0;
if (project && project->activeTarget() && project->activeTarget()->activeRunConfiguration()) {
LocalApplicationRunConfiguration *localAppRC =
qobject_cast<LocalApplicationRunConfiguration *>
(project->activeTarget()->activeRunConfiguration());
if (localAppRC)
path = QFileInfo(localAppRC->executable()).path();
if (activeTarget) {
if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {
const Runnable runnable = runConfig->runnable();
if (runnable.is<StandardRunnable>() && isLocal(runConfig))
path = QFileInfo(runnable.as<StandardRunnable>().executable).path();
}
}
if (path.isEmpty()) {
if (project && project->activeTarget() &&
project->activeTarget()->activeBuildConfiguration()) {
path = project->activeTarget()->activeBuildConfiguration()->buildDirectory().toString();
if (activeTarget && activeTarget->activeBuildConfiguration()) {
path = activeTarget->activeBuildConfiguration()->buildDirectory().toString();
} else if (project) {
path = project->projectDirectory().toString();
}
......
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef LOCALAPPLICATIONRUNCONFIGURATION_H
#define LOCALAPPLICATIONRUNCONFIGURATION_H
#include "runconfiguration.h"
#include "applicationlauncher.h"
namespace Utils { class Environment; }
namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT LocalApplicationRunConfiguration : public RunConfiguration
{
Q_OBJECT
public:
virtual QString executable() const = 0;
virtual ApplicationLauncher::Mode runMode() const = 0;
virtual QString workingDirectory() const = 0;
virtual QString commandLineArguments() const = 0;
virtual void addToBaseEnvironment(Utils::Environment &env) const;
protected:
explicit LocalApplicationRunConfiguration(Target *target, Core::Id id);
explicit LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
};
} // namespace ProjectExplorer
#endif // LOCALAPPLICATIONRUNCONFIGURATION_H
......@@ -24,11 +24,14 @@
****************************************************************************/
#include "localapplicationruncontrol.h"
#include "localapplicationrunconfiguration.h"
#include "runnables.h"
#include "environmentaspect.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <utils/environment.h>
......@@ -37,30 +40,27 @@
namespace ProjectExplorer {
namespace Internal {
LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
{
}
LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
static bool isLocal(RunConfiguration *runConfiguration)
{
Target *target = runConfiguration ? runConfiguration->target() : 0;
Kit *kit = target ? target->kit() : 0;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
}
bool LocalApplicationRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
{
return mode == Constants::NORMAL_RUN_MODE && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
return mode == Constants::NORMAL_RUN_MODE && isLocal(runConfiguration);
}
RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
{
Q_UNUSED(errorMessage)
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
LocalApplicationRunConfiguration *localRunConfiguration = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
QTC_ASSERT(localRunConfiguration, return 0);
LocalApplicationRunControl *runControl = new LocalApplicationRunControl(localRunConfiguration, mode);
runControl->setCommand(localRunConfiguration->executable(), localRunConfiguration->commandLineArguments());
runControl->setApplicationLauncherMode(localRunConfiguration->runMode());
runControl->setWorkingDirectory(localRunConfiguration->workingDirectory());
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
auto runnable = runConfiguration->runnable().as<StandardRunnable>();
auto runControl = new LocalApplicationRunControl(runConfiguration, mode);
runControl->setCommand(runnable.executable, runnable.commandLineArguments);
runControl->setApplicationLauncherMode(runnable.runMode);
runControl->setWorkingDirectory(runnable.workingDirectory);
return runControl;
}
......
......@@ -36,8 +36,6 @@ class LocalApplicationRunControlFactory : public IRunControlFactory
{
Q_OBJECT
public:
LocalApplicationRunControlFactory ();
~LocalApplicationRunControlFactory();
bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const;
RunControl* create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage);
};
......
......@@ -27,7 +27,7 @@
#include "buildconfiguration.h"
#include "environmentaspectwidget.h"
#include "localapplicationrunconfiguration.h"
#include "runnables.h"
#include "kit.h"
#include "target.h"
......@@ -72,8 +72,8 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
env = Utils::Environment::systemEnvironment();
}
if (const LocalApplicationRunConfiguration *rc = qobject_cast<const LocalApplicationRunConfiguration *>(runConfiguration()))
rc->addToBaseEnvironment(env);
if (m_baseEnvironmentModifier)
m_baseEnvironmentModifier(env);
return env;
}
......@@ -84,16 +84,17 @@ void LocalEnvironmentAspect::buildEnvironmentHasChanged()
emit environmentChanged();
}
LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *parent) :
EnvironmentAspect(parent)
LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *parent,
const BaseEnvironmentModifier &modifier) :
EnvironmentAspect(parent), m_baseEnvironmentModifier(modifier)
{
connect(parent->target(), SIGNAL(environmentChanged()),
this, SLOT(buildEnvironmentHasChanged()));
connect(parent->target(), &Target::environmentChanged,
this, &LocalEnvironmentAspect::buildEnvironmentHasChanged);
}
LocalEnvironmentAspect *LocalEnvironmentAspect::create(RunConfiguration *parent) const
{
LocalEnvironmentAspect *result = new LocalEnvironmentAspect(parent);
auto result = new LocalEnvironmentAspect(parent, m_baseEnvironmentModifier);
result->setUserEnvironmentChanges(userEnvironmentChanges());
return result;
}
......
......@@ -35,7 +35,8 @@ class PROJECTEXPLORER_EXPORT LocalEnvironmentAspect : public EnvironmentAspect
Q_OBJECT
public:
LocalEnvironmentAspect(RunConfiguration *parent);
typedef std::function<void(Utils::Environment &)> BaseEnvironmentModifier;
LocalEnvironmentAspect(RunConfiguration *parent, const BaseEnvironmentModifier &modifier);
LocalEnvironmentAspect *create(RunConfiguration *parent) const;
QList<int> possibleBaseEnvironments() const;
......@@ -51,6 +52,8 @@ private:
SystemEnvironmentBase,
BuildEnvironmentBase
};
BaseEnvironmentModifier m_baseEnvironmentModifier;
};
} // namespace ProjectExplorer
......
......@@ -14,7 +14,7 @@ HEADERS += projectexplorer.h \
environmentaspectwidget.h \
gcctoolchain.h \
importwidget.h \
localapplicationrunconfiguration.h \
runnables.h \
localenvironmentaspect.h \
osparser.h \
projectexplorer_export.h \
......@@ -167,7 +167,6 @@ SOURCES += projectexplorer.cpp \
environmentaspectwidget.cpp \
gcctoolchain.cpp \
importwidget.cpp \
localapplicationrunconfiguration.cpp \
localenvironmentaspect.cpp \
osparser.cpp \
projectimporter.cpp \
......
......@@ -94,7 +94,6 @@ QtcPlugin {
"kitoptionspage.cpp", "kitoptionspage.h",
"ldparser.cpp", "ldparser.h",
"linuxiccparser.cpp", "linuxiccparser.h",
"localapplicationrunconfiguration.cpp", "localapplicationrunconfiguration.h",
"localapplicationruncontrol.cpp", "localapplicationruncontrol.h",
"localenvironmentaspect.cpp", "localenvironmentaspect.h",
"metatypedeclarations.h",
......@@ -127,6 +126,7 @@ QtcPlugin {
"projectwizardpage.cpp", "projectwizardpage.h", "projectwizardpage.ui",
"propertiespanel.cpp", "propertiespanel.h",
"removetaskhandler.cpp", "removetaskhandler.h",
"runnables.h",
"runconfiguration.cpp", "runconfiguration.h",
"runconfigurationaspects.cpp", "runconfigurationaspects.h",
"runconfigurationmodel.cpp", "runconfigurationmodel.h",
......
......@@ -23,32 +23,28 @@
**
****************************************************************************/
#include "localapplicationrunconfiguration.h"
#ifndef PROJECTEXPLORER_RUNNABLES_H
#define PROJECTEXPLORER_RUNNABLES_H
#include "buildconfiguration.h"
#include "runconfiguration.h"
#include <utils/macroexpander.h>
#include "applicationlauncher.h"
#include "devicesupport/idevice.h"
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
#include <QDir>
#include <utils/environment.h>
namespace ProjectExplorer {
LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, Core::Id id) :
RunConfiguration(target, id)
{
}
LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc) :
RunConfiguration(target, rc)
class PROJECTEXPLORER_EXPORT StandardRunnable
{
}
void LocalApplicationRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{
Q_UNUSED(env);
}
public:
QString executable;
QString commandLineArguments;
QString workingDirectory;
Utils::Environment environment;
ApplicationLauncher::Mode runMode;
};
} // namespace ProjectExplorer
#endif // PROJECTEXPLORER_RUNNABLES_H
......@@ -419,7 +419,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *parent, Core::Id id) :
const QString exec = sysEnv.searchInPath(QLatin1String("python")).toString();
m_interpreter = exec.isEmpty() ? QLatin1String("python") : exec;
addExtraAspect(new LocalEnvironmentAspect(this));
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("PythonEditor.RunConfiguration.Arguments")));
addExtraAspect(new TerminalAspect(this, QStringLiteral("PythonEditor.RunConfiguration.UseTerminal")));
setDefaultDisplayName(defaultDisplayName());
......
......@@ -61,6 +61,7 @@
#include <QDir>
using namespace ProjectExplorer;
using namespace Utils;
namespace QbsProjectManager {
namespace Internal {
......@@ -106,12 +107,12 @@ const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &u
// --------------------------------------------------------------------
QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
LocalApplicationRunConfiguration(parent, id),
RunConfiguration(parent, id),
m_uniqueProductName(uniqueProductNameFromId(id)),
m_currentInstallStep(0),
m_currentBuildStepList(0)
{
addExtraAspect(new LocalEnvironmentAspect(this));
addExtraAspect(new LocalEnvironmentAspect(this, [this](Environment &env) { addToBaseEnvironment(env); }));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qbs.RunConfiguration.CommandLineArguments")));
addExtraAspect(new WorkingDirectoryAspect(this, QStringLiteral("Qbs.RunConfiguration.WorkingDirectory")));
......@@ -123,7 +124,7 @@ QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
}
QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) :
LocalApplicationRunConfiguration(parent, source),
RunConfiguration(parent, source),
m_uniqueProductName(source->m_uniqueProductName),
m_currentInstallStep(0), // no need to copy this, we will get if from the DC anyway.
m_currentBuildStepList(0) // ditto
......@@ -226,6 +227,17 @@ void QbsRunConfiguration::installStepToBeRemoved(int pos)
m_currentInstallStep = 0;
}
Runnable QbsRunConfiguration::runnable() const
{
StandardRunnable r;
r.executable = executable();
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
r.runMode = extraAspect<TerminalAspect>()->runMode();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
return r;
}
QString QbsRunConfiguration::executable() const
{
QbsProject *pro = static_cast<QbsProject *>(target()->project());
......@@ -237,11 +249,6 @@ QString QbsRunConfiguration::executable() const
return pro->qbsProject().targetExecutable(product, installOptions());
}
ApplicationLauncher::Mode QbsRunConfiguration::runMode() const
{
return extraAspect<TerminalAspect>()->runMode();
}
bool QbsRunConfiguration::isConsoleApplication() const
{
QbsProject *pro = static_cast<QbsProject *>(target()->project());
......@@ -249,13 +256,6 @@ bool QbsRunConfiguration::isConsoleApplication() const
return product.properties().value(QLatin1String("consoleApplication"), false).toBool();
}
QString QbsRunConfiguration::workingDirectory() const