Commit 7255b714 authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarTobias Hunger <>
parent be65afa9
......@@ -35,10 +35,12 @@
#include "target.h"
#include "project.h"
#include "kit.h"
#include "projectmacroexpander.h"
#include <coreplugin/variablemanager.h>
#include <projectexplorer/buildenvironmentwidget.h>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/idocument.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
......@@ -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
explicit BuildConfigMacroExpander(const BuildConfiguration *bc) : m_bc(bc) {}
explicit BuildConfigMacroExpander(const BuildConfiguration *bc)
: ProjectMacroExpander(bc->target()->project()->document()->filePath(),
virtual bool resolveMacro(const QString &name, QString *ret);
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment