forked from qt-creator/qt-creator
MacroExpanders: Remove legacy "Current(Project|Build|Kit)" variables
Should use "CurrentDocument:....." now. Change-Id: Ie47f0e0f77b506bef6fc7a173aec8cfdcf863e5e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -170,16 +170,9 @@ BuildConfiguration::BuildConfiguration(Target *target, Utils::Id id)
|
||||
expander->registerVariable("buildDir", tr("Build directory"),
|
||||
[this] { return buildDirectory().toUserOutput(); });
|
||||
|
||||
// TODO: Remove "Current" variants in ~4.16.
|
||||
expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("Name of current build"),
|
||||
[this] { return displayName(); }, false);
|
||||
|
||||
expander->registerVariable("BuildConfig:Name", tr("Name of the build configuration"),
|
||||
[this] { return displayName(); });
|
||||
|
||||
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
|
||||
tr("Variables in the current build environment"),
|
||||
[this](const QString &var) { return environment().expandedValueForKey(var); }, false);
|
||||
expander->registerPrefix("BuildConfig:Env",
|
||||
tr("Variables in the build configuration's environment"),
|
||||
[this](const QString &var) { return environment().expandedValueForKey(var); });
|
||||
@@ -602,22 +595,12 @@ FilePath BuildConfiguration::buildDirectoryFromTemplate(const FilePath &projectD
|
||||
|
||||
qCDebug(bcLog) << Q_FUNC_INFO << projectDir << mainFilePath << projectName << bcName;
|
||||
|
||||
// TODO: Remove "Current" variants in ~4.16
|
||||
exp.registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||
QCoreApplication::translate("ProjectExplorer", "Main file of current project"),
|
||||
[mainFilePath] { return mainFilePath; }, false);
|
||||
exp.registerFileVariables("Project",
|
||||
QCoreApplication::translate("ProjectExplorer", "Main file of the project"),
|
||||
[mainFilePath] { return mainFilePath; });
|
||||
exp.registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
||||
[projectName] { return projectName; }, false);
|
||||
exp.registerVariable("Project:Name",
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of the project"),
|
||||
[projectName] { return projectName; });
|
||||
exp.registerVariable(Constants::VAR_CURRENTBUILD_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of current build"),
|
||||
[bcName] { return bcName; }, false);
|
||||
exp.registerVariable("BuildConfig:Name",
|
||||
QCoreApplication::translate(
|
||||
"ProjectExplorer", "Name of the project's active build configuration"),
|
||||
|
@@ -74,27 +74,14 @@ public:
|
||||
for (KitAspect *aspect : KitManager::kitAspects())
|
||||
aspect->addToMacroExpander(kit, &m_macroExpander);
|
||||
|
||||
// TODO: Remove the "Current" variants in ~4.16
|
||||
m_macroExpander.registerVariable("CurrentKit:Name",
|
||||
tr("The name of the currently active kit."),
|
||||
[kit] { return kit->displayName(); },
|
||||
false);
|
||||
m_macroExpander.registerVariable("Kit:Name",
|
||||
tr("The name of the kit."),
|
||||
[kit] { return kit->displayName(); });
|
||||
|
||||
m_macroExpander.registerVariable("CurrentKit:FileSystemName",
|
||||
tr("The name of the currently active kit in a filesystem-friendly version."),
|
||||
[kit] { return kit->fileSystemFriendlyName(); },
|
||||
false);
|
||||
m_macroExpander.registerVariable("Kit:FileSystemName",
|
||||
tr("The name of the kit in a filesystem-friendly version."),
|
||||
[kit] { return kit->fileSystemFriendlyName(); });
|
||||
|
||||
m_macroExpander.registerVariable("CurrentKit:Id",
|
||||
tr("The ID of the currently active kit."),
|
||||
[kit] { return kit->id().toString(); },
|
||||
false);
|
||||
m_macroExpander.registerVariable("Kit:Id",
|
||||
tr("The ID of the kit."),
|
||||
[kit] { return kit->id().toString(); });
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include "projectexplorericons.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "projectexplorersettingspage.h"
|
||||
#include "projectexplorertr.h"
|
||||
#include "projectfilewizardextension.h"
|
||||
#include "projectmanager.h"
|
||||
#include "projectnodes.h"
|
||||
@@ -1943,19 +1944,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
|
||||
dd->updateWelcomePage();
|
||||
|
||||
// FIXME: These are mostly "legacy"/"convenience" entries, relying on
|
||||
// the global entry point ProjectExplorer::currentProject(). They should
|
||||
// not be used in the Run/Build configuration pages.
|
||||
// TODO: Remove the CurrentProject versions in ~4.16
|
||||
MacroExpander *expander = Utils::globalMacroExpander();
|
||||
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||
tr("Current project's main file."),
|
||||
[]() -> FilePath {
|
||||
FilePath projectFilePath;
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
projectFilePath = project->projectFilePath();
|
||||
return projectFilePath;
|
||||
}, false);
|
||||
expander->registerFileVariables("CurrentDocument:Project",
|
||||
tr("Main file of the project the current document belongs to."),
|
||||
[]() -> FilePath {
|
||||
@@ -1965,12 +1954,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
return projectFilePath;
|
||||
}, false);
|
||||
|
||||
expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
||||
tr("The name of the current project."),
|
||||
[]() -> QString {
|
||||
Project *project = ProjectTree::currentProject();
|
||||
return project ? project->displayName() : QString();
|
||||
}, false);
|
||||
expander->registerVariable("CurrentDocument:Project:Name",
|
||||
tr("The name of the project the current document belongs to."),
|
||||
[]() -> QString {
|
||||
@@ -1978,13 +1961,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
return project ? project->displayName() : QString();
|
||||
});
|
||||
|
||||
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
|
||||
BuildConfiguration::tr("Variables in the current build environment."),
|
||||
[](const QString &var) {
|
||||
if (BuildConfiguration *bc = currentBuildConfiguration())
|
||||
return bc->environment().expandedValueForKey(var);
|
||||
return QString();
|
||||
}, false);
|
||||
const char currentBuildEnvVar[] = "CurrentDocument:Project:BuildConfig:Env";
|
||||
expander->registerPrefix(currentBuildEnvVar,
|
||||
BuildConfiguration::tr(
|
||||
|
@@ -172,12 +172,6 @@ const char ANDROID_ABI_ARM64_V8A[] = "arm64-v8a";
|
||||
const char ANDROID_ABI_X86[] = "x86";
|
||||
const char ANDROID_ABI_X86_64[] = "x86_64";
|
||||
|
||||
// Variable Names:
|
||||
const char VAR_CURRENTPROJECT_PREFIX[] = "CurrentProject";
|
||||
const char VAR_CURRENTPROJECT_NAME[] = "CurrentProject:Name";
|
||||
const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
|
||||
const char VAR_CURRENTBUILD_ENV[] = "CurrentBuild:Env";
|
||||
|
||||
// JsonWizard:
|
||||
const char PAGE_ID_PREFIX[] = "PE.Wizard.Page.";
|
||||
const char GENERATOR_ID_PREFIX[] = "PE.Wizard.Generator.";
|
||||
|
@@ -145,46 +145,9 @@ Target::Target(Project *project, Kit *k, _constructor_tag) :
|
||||
return QString();
|
||||
});
|
||||
|
||||
// TODO: Remove in ~4.16.
|
||||
d->m_macroExpander.registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
||||
[project] { return project->displayName(); },
|
||||
false);
|
||||
d->m_macroExpander.registerVariable("Project:Name",
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
||||
[project] { return project->displayName(); });
|
||||
|
||||
d->m_macroExpander.registerVariable("CurrentRun:Name",
|
||||
tr("The currently active run configuration's name."),
|
||||
[this]() -> QString {
|
||||
if (RunConfiguration * const rc = activeRunConfiguration())
|
||||
return rc->displayName();
|
||||
return QString();
|
||||
}, false);
|
||||
d->m_macroExpander.registerFileVariables("CurrentRun:Executable",
|
||||
tr("The currently active run configuration's executable (if applicable)."),
|
||||
[this]() -> FilePath {
|
||||
if (RunConfiguration * const rc = activeRunConfiguration())
|
||||
return rc->commandLine().executable();
|
||||
return FilePath();
|
||||
}, false);
|
||||
d->m_macroExpander.registerPrefix("CurrentRun:Env", tr("Variables in the current run environment."),
|
||||
[this](const QString &var) {
|
||||
if (RunConfiguration * const rc = activeRunConfiguration()) {
|
||||
if (const auto envAspect = rc->aspect<EnvironmentAspect>())
|
||||
return envAspect->environment().expandedValueForKey(var);
|
||||
}
|
||||
return QString();
|
||||
}, false);
|
||||
d->m_macroExpander.registerVariable("CurrentRun:WorkingDir",
|
||||
tr("The currently active run configuration's working directory."),
|
||||
[this] {
|
||||
if (RunConfiguration * const rc = activeRunConfiguration()) {
|
||||
if (const auto wdAspect = rc->aspect<WorkingDirectoryAspect>())
|
||||
return wdAspect->workingDirectory().toString();
|
||||
}
|
||||
return QString();
|
||||
}, false);
|
||||
}
|
||||
|
||||
Target::~Target()
|
||||
|
Reference in New Issue
Block a user