summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-01-04 14:08:13 +0100
committerEike Ziller <eike.ziller@qt.io>2023-01-09 11:55:08 +0000
commit23fa784e9c90fcc26413012f861becf696503fab (patch)
tree0a834f5b3ea6bbab771ccf09bd1152bf5c9a6794 /src/plugins
parent37fafcabb23eea4fc22d3f54f714bf0ced297b94 (diff)
downloadqt-creator-23fa784e9c90fcc26413012f861becf696503fab.tar.gz
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp17
-rw-r--r--src/plugins/projectexplorer/kit.cpp13
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp26
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h6
-rw-r--r--src/plugins/projectexplorer/target.cpp37
5 files changed, 1 insertions, 98 deletions
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index f0db7a7c48..84fb831e43 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -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"),
diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp
index a872940f0b..bc0080b529 100644
--- a/src/plugins/projectexplorer/kit.cpp
+++ b/src/plugins/projectexplorer/kit.cpp
@@ -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(); });
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index abd2903f1f..647d4435c9 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -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(
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index b1ee1bb9e7..371630edad 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -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.";
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index 978632ac09..4631a2f176 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -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()