From 7255b71422eef9c5b6c974bc83d0a86e19cf4a4e Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Mon, 6 Oct 2014 13:15:40 +0200 Subject: [PATCH] BuildConfiguration: Use ProjectMacroExpander So that in the context of the buildconfiguration and its buildsteps current project and others refers to the project of the bc. Task-number: QTCREATORBUG-12869 Change-Id: Idad7741301432a5fddffdff4225762f4100a3dee Reviewed-by: Tobias Hunger --- .../projectexplorer/buildconfiguration.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 99b841b8919..6da9c1a2711 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -35,10 +35,12 @@ #include "target.h" #include "project.h" #include "kit.h" +#include "projectmacroexpander.h" #include #include #include +#include #include #include @@ -55,10 +57,16 @@ static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.Bui namespace ProjectExplorer { namespace Internal { -class BuildConfigMacroExpander : public Utils::AbstractMacroExpander +class BuildConfigMacroExpander : public ProjectMacroExpander { public: - explicit BuildConfigMacroExpander(const BuildConfiguration *bc) : m_bc(bc) {} + explicit BuildConfigMacroExpander(const BuildConfiguration *bc) + : ProjectMacroExpander(bc->target()->project()->document()->filePath(), + bc->target()->project()->displayName(), + bc->target()->kit(), + bc->displayName()), + m_bc(bc) + {} virtual bool resolveMacro(const QString &name, QString *ret); private: const BuildConfiguration *m_bc; @@ -66,6 +74,7 @@ private: bool BuildConfigMacroExpander::resolveMacro(const QString &name, QString *ret) { + // legacy variables if (name == QLatin1String("sourceDir")) { *ret = m_bc->target()->project()->projectDirectory().toUserOutput(); return true; @@ -74,9 +83,8 @@ bool BuildConfigMacroExpander::resolveMacro(const QString &name, QString *ret) *ret = m_bc->buildDirectory().toUserOutput(); return true; } - bool found; - *ret = Core::VariableManager::value(name.toUtf8(), &found); - return found; + + return ProjectMacroExpander::resolveMacro(name, ret); } } // namespace Internal