QbsProjectManager: Proliferate the use of FilePath

Also use path() instead of toString(). While this doesn't change
anything as long as there is no remotely running QbsSession,
path() would be the better choice then.

Change-Id: Ief98536b34fe615f6b0be03cb3072df7b69f293b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-09-29 14:29:10 +02:00
parent 460f347757
commit bb6847e3ec
3 changed files with 15 additions and 17 deletions

View File

@@ -616,7 +616,7 @@ void QbsBuildSystem::parseCurrentBuildConfiguration()
->expand(QbsSettings::defaultInstallDirTemplate()));
}
Environment env = m_buildConfiguration->environment();
QString dir = m_buildConfiguration->buildDirectory().toString();
FilePath dir = m_buildConfiguration->buildDirectory();
m_guard = guardParsingRun();

View File

@@ -16,15 +16,14 @@
using namespace Utils;
namespace QbsProjectManager {
namespace Internal {
namespace QbsProjectManager::Internal {
// --------------------------------------------------------------------
// QbsProjectParser:
// --------------------------------------------------------------------
QbsProjectParser::QbsProjectParser(QbsBuildSystem *buildSystem, QFutureInterface<bool> *fi)
: m_projectFilePath(buildSystem->project()->projectFilePath().toString()),
: m_projectFilePath(buildSystem->project()->projectFilePath()),
m_session(buildSystem->session()),
m_fi(fi)
{
@@ -40,8 +39,8 @@ QbsProjectParser::~QbsProjectParser()
m_fi = nullptr; // we do not own m_fi, do not delete
}
void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir,
const QString &configName)
void QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
const FilePath &dir, const QString &configName)
{
QTC_ASSERT(m_session, return);
QTC_ASSERT(!dir.isEmpty(), return);
@@ -61,10 +60,10 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
// People don't like it when files are created as a side effect of opening a project,
// so do not store the build graph if the build directory does not exist yet.
request.insert("dry-run", !QFileInfo::exists(dir));
request.insert("dry-run", !dir.exists());
request.insert("build-root", dir);
request.insert("project-file-path", m_projectFilePath);
request.insert("build-root", dir.path());
request.insert("project-file-path", m_projectFilePath.path());
request.insert("override-build-graph-data", true);
static const auto envToJson = [](const Environment &env) {
QJsonObject envObj;
@@ -108,5 +107,4 @@ void QbsProjectParser::cancel()
m_session->cancelCurrentJob();
}
} // namespace Internal
} // namespace QbsProjectManager
} // QbsProjectManager::Internal

View File

@@ -11,8 +11,7 @@
#include <QJsonObject>
#include <QObject>
namespace QbsProjectManager {
namespace Internal {
namespace QbsProjectManager::Internal {
class QbsBuildSystem;
@@ -24,7 +23,9 @@ public:
QbsProjectParser(QbsBuildSystem *buildSystem, QFutureInterface<bool> *fi);
~QbsProjectParser() override;
void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir,
void parse(const QVariantMap &config,
const Utils::Environment &env,
const Utils::FilePath &dir,
const QString &configName);
void cancel();
Utils::Environment environment() const { return m_environment; }
@@ -38,7 +39,7 @@ signals:
private:
Utils::Environment m_environment;
const QString m_projectFilePath;
const Utils::FilePath m_projectFilePath;
QbsSession * const m_session;
ErrorInfo m_error;
QJsonObject m_projectData;
@@ -46,5 +47,4 @@ private:
QFutureInterface<bool> *m_fi = nullptr;
};
} // namespace Internal
} // namespace QbsProjectManager
} // QbsProjectManager::Internal