Commit f406a38c authored by hjk's avatar hjk
Browse files

Provide %{buildDir} macro expansion again.



This was a regression introduced during the macro expander rework.

Task-number: QTCREATORBUG-13260
Change-Id: I9fd28c6a522faa11992931f937dd0b0eb779f419
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 7d417271
......@@ -75,6 +75,8 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
connect(target, SIGNAL(kitChanged()),
this, SLOT(handleKitUpdate()));
connect(this, SIGNAL(environmentChanged()), this, SLOT(emitBuildDirectoryChanged()));
macroExpander()->registerSubProvider([target] { return target->macroExpander(); });
}
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
......@@ -92,29 +94,8 @@ BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *sourc
connect(target, SIGNAL(kitChanged()),
this, SLOT(handleKitUpdate()));
}
void BuildConfiguration::setupMacroExpander()
{
Utils::MacroExpander *expander = macroExpander();
expander->registerSubProvider(
[this] { return target()->kit()->macroExpander(); });
// Legacy support.
expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
[this] { return target()->project()->displayName(); });
expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME,
QCoreApplication::translate("ProjectExplorer", "Name of current build"),
[this] { return displayName(); });
expander->registerVariable("sourceDir", tr("Source directory"),
[this] { return target()->project()->projectDirectory().toUserOutput(); });
expander->registerVariable("buildDir", tr("Build directory"),
[this] { return buildDirectory().toUserOutput(); });
macroExpander()->registerSubProvider([target] { return target->macroExpander(); });
}
BuildConfiguration::~BuildConfiguration()
......
......@@ -107,7 +107,6 @@ private slots:
private:
void emitEnvironmentChanged();
void setupMacroExpander();
bool m_clearSystemEnvironment;
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
......
......@@ -53,6 +53,7 @@ DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) :
m_stepList->setDefaultDisplayName(tr("Deploy"));
//: Default DeployConfiguration display name
setDefaultDisplayName(tr("Deploy locally"));
macroExpander()->registerSubProvider([target] { return target->macroExpander(); });
}
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
......@@ -63,6 +64,7 @@ DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *so
// Do not clone stepLists here, do that in the derived constructor instead
// otherwise BuildStepFactories might reject to set up a BuildStep for us
// since we are not yet the derived class!
macroExpander()->registerSubProvider([target] { return target->macroExpander(); });
}
DeployConfiguration::~DeployConfiguration()
......
......@@ -253,6 +253,8 @@ void RunConfiguration::addExtraAspect(IRunConfigurationAspect *aspect)
void RunConfiguration::ctor()
{
connect(this, SIGNAL(enabledChanged()), this, SIGNAL(requestRunActionsUpdate()));
macroExpander()->registerSubProvider([this] { return target()->macroExpander(); });
}
/*!
......
......@@ -138,6 +138,29 @@ Target::Target(Project *project, Kit *k) :
this, SLOT(handleKitUpdates(ProjectExplorer::Kit*)));
connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
this, SLOT(handleKitRemoval(ProjectExplorer::Kit*)));
Utils::MacroExpander *expander = macroExpander();
expander->registerSubProvider([this] { return kit()->macroExpander(); });
// Legacy support.
expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
[project] { return project->displayName(); },
false);
expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME,
QCoreApplication::translate("ProjectExplorer", "Name of current build"),
[this] { return activeBuildConfiguration() ? activeBuildConfiguration()->displayName() : QString(); },
false);
expander->registerVariable("sourceDir", tr("Source directory"),
[project] { return project->projectDirectory().toUserOutput(); });
expander->registerVariable("buildDir", tr("Build directory"),
[this] { return activeBuildConfiguration()
? activeBuildConfiguration()->buildDirectory().toUserOutput()
: QString() ; });
}
Target::~Target()
......
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