ProjectExplorer: Streamline access to buildDirectoryTemplate data

There's only one kind of use, in the context of BuildConfiguration.

Change-Id: I09628ff443ef08e28738125a614c17d5d979189b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-08-24 08:34:32 +02:00
parent cd3c2fdc5b
commit 22ecef0444
15 changed files with 89 additions and 177 deletions

View File

@@ -39,13 +39,15 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmacroexpander.h>
#include <utils/fileutils.h>
#include <utils/qtcprocess.h>
#include <QDir>
using namespace ProjectExplorer;
using namespace Utils;
namespace MesonProjectManager {
namespace Internal {
@@ -72,26 +74,18 @@ MesonBuildConfiguration::~MesonBuildConfiguration()
delete m_buildSystem;
}
Utils::FilePath MesonBuildConfiguration::shadowBuildDirectory(
const Utils::FilePath &projectFilePath,
const ProjectExplorer::Kit *k,
const QString &bcName,
ProjectExplorer::BuildConfiguration::BuildType buildType)
FilePath MesonBuildConfiguration::shadowBuildDirectory(const FilePath &projectFilePath,
const Kit *k,
const QString &bcName,
BuildConfiguration::BuildType buildType)
{
if (projectFilePath.isEmpty())
return Utils::FilePath();
return {};
const QString projectName = projectFilePath.parentDir().fileName();
ProjectExplorer::ProjectMacroExpander expander(projectFilePath,
projectName,
k,
bcName,
buildType);
QDir projectDir = QDir(ProjectExplorer::Project::projectDirectory(projectFilePath).toString());
QString buildPath = expander.expand(
ProjectExplorer::ProjectExplorerPlugin::buildDirectoryTemplate());
buildPath.replace(" ", "-");
return Utils::FilePath::fromUserInput(projectDir.absoluteFilePath(buildPath));
return BuildConfiguration::buildDirectoryFromTemplate(
Project::projectDirectory(projectFilePath),
projectFilePath, projectName, k, bcName, buildType, BuildConfiguration::ReplaceSpaces);
}
ProjectExplorer::BuildSystem *MesonBuildConfiguration::buildSystem() const