From bb06ff83d77be75dd6088ed9bd9a61c85778cb72 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 1 Nov 2013 14:13:41 +0100 Subject: [PATCH] LocalRunConfiguration: Do not add a LocalEnvironmentAspect This makes the specializations responsible to register the environment aspect that makes the most sense for them. The only real user of this is the QmlProject, which added its own EnvironmentAspect on top of LocalEnvironmentAspect set by the base class. Change-Id: I2ad8c23a008e249dc919491a5fd397ec04502375 Reviewed-by: Tobias Hunger --- .../cmakerunconfiguration.cpp | 3 ++- .../localapplicationrunconfiguration.cpp | 16 ++-------------- .../localapplicationrunconfiguration.h | 1 - .../qbsprojectmanager/qbsrunconfiguration.cpp | 2 ++ .../desktopqmakerunconfiguration.cpp | 2 ++ .../qmlprojectrunconfiguration.cpp | 4 ++-- .../customexecutablerunconfiguration.cpp | 4 +++- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 50e5a4d6afe..1451813b09f 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -75,6 +75,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, Co m_title(title), m_enabled(true) { + addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this)); ctor(); } diff --git a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp index e0022a61dfe..ec7a0ec9862 100644 --- a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp @@ -30,7 +30,6 @@ #include "localapplicationrunconfiguration.h" #include "buildconfiguration.h" -#include "localenvironmentaspect.h" #include #include @@ -39,10 +38,8 @@ #include - namespace ProjectExplorer { - namespace Internal { class FallBackMacroExpander : public Utils::AbstractQtcMacroExpander { public: @@ -67,15 +64,11 @@ bool FallBackMacroExpander::resolveMacro(const QString &name, QString *ret) LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, const Core::Id id) : RunConfiguration(target, id), m_macroExpander(0) -{ - ctor(); -} +{ } LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc) : RunConfiguration(target, rc), m_macroExpander(0) -{ - ctor(); -} +{ } LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration() { @@ -96,9 +89,4 @@ Utils::AbstractMacroExpander *LocalApplicationRunConfiguration::macroExpander() return m_macroExpander; } -void LocalApplicationRunConfiguration::ctor() -{ - addExtraAspect(new LocalEnvironmentAspect(this)); -} - } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/localapplicationrunconfiguration.h b/src/plugins/projectexplorer/localapplicationrunconfiguration.h index ccca694b7e0..98d4dfeb70b 100644 --- a/src/plugins/projectexplorer/localapplicationrunconfiguration.h +++ b/src/plugins/projectexplorer/localapplicationrunconfiguration.h @@ -66,7 +66,6 @@ protected: Utils::AbstractMacroExpander *macroExpander() const; private: - void ctor(); mutable Utils::AbstractMacroExpander *m_macroExpander; }; diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp index 697f4606590..de1dda1c5f5 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp @@ -96,6 +96,8 @@ QbsRunConfiguration::QbsRunConfiguration(ProjectExplorer::Target *parent, Core:: m_currentInstallStep(0), m_currentBuildStepList(0) { + addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this)); + ctor(); } diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index 9df0e595cf3..06407811b8d 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -83,6 +83,8 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, Core: m_runMode(Gui), m_isUsingDyldImageSuffix(false) { + addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this)); + QmakeProject *project = static_cast(parent->project()); m_parseSuccess = project->validParse(m_proFilePath); m_parseInProgress = project->parseInProgress(m_proFilePath); diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 2d17f24d5b0..8ce33831b77 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -60,6 +60,8 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target * m_scriptFile(QLatin1String(M_CURRENT_FILE)), m_isEnabled(false) { + addExtraAspect(new QmlProjectEnvironmentAspect(this)); + ctor(); } @@ -98,8 +100,6 @@ void QmlProjectRunConfiguration::ctor() setDisplayName(tr("QML Scene", "QMLRunConfiguration display name.")); else setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name.")); - - addExtraAspect(new QmlProjectEnvironmentAspect(this)); } QString QmlProjectRunConfiguration::executable() const diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp index 5be41ad3853..617f1f32a39 100644 --- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp +++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp @@ -32,7 +32,7 @@ #include "qtkitinformation.h" #include -#include +#include #include #include #include @@ -72,6 +72,8 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(ProjectExplor m_workingDirectory(QLatin1String(ProjectExplorer::Constants::DEFAULT_WORKING_DIR)), m_runMode(Gui) { + addExtraAspect(new ProjectExplorer::LocalEnvironmentAspect(this)); + if (!parent->activeBuildConfiguration()) m_workingDirectory = QLatin1String(ProjectExplorer::Constants::DEFAULT_WORKING_DIR_ALTERNATE); ctor();