MesonProjectManager: fix output parser faulty file location

Faulty meson files are located relative to build dir.

Change-Id: I7933c1965daf2f07bed5cdd8210681f74bec77cd
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alexis Jeandet
2025-01-11 17:40:32 +01:00
parent 3698514fb9
commit 9376ac09d4
3 changed files with 11 additions and 1 deletions

View File

@@ -132,7 +132,12 @@ void MesonOutputParser::readStdo(const QByteArray &data)
void MesonOutputParser::setSourceDirectory(const Utils::FilePath &sourceDir) void MesonOutputParser::setSourceDirectory(const Utils::FilePath &sourceDir)
{ {
emit newSearchDirFound(sourceDir); addSearchDir(sourceDir);
}
void MesonOutputParser::setBuildDirectory(const Utils::FilePath &buildDir)
{
addSearchDir(buildDir);
} }
} // namespace MesonProjectManager::Internal } // namespace MesonProjectManager::Internal

View File

@@ -6,6 +6,7 @@
#include <projectexplorer/ioutputparser.h> #include <projectexplorer/ioutputparser.h>
#include <utils/outputformatter.h> #include <utils/outputformatter.h>
#include <utils/fileutils.h>
#include <QRegularExpression> #include <QRegularExpression>
@@ -36,6 +37,7 @@ public:
Result handleLine(const QString &line, Utils::OutputFormat type) override; Result handleLine(const QString &line, Utils::OutputFormat type) override;
void readStdo(const QByteArray &data); void readStdo(const QByteArray &data);
void setSourceDirectory(const Utils::FilePath &sourceDir); void setSourceDirectory(const Utils::FilePath &sourceDir);
void setBuildDirectory(const Utils::FilePath &buildDir);
}; };
} // namespace MesonProjectManager::Internal } // namespace MesonProjectManager::Internal

View File

@@ -291,6 +291,7 @@ bool MesonProjectParser::configure(
m_srcDir = sourcePath.canonicalPath(); m_srcDir = sourcePath.canonicalPath();
m_buildDir = buildPath.canonicalPath(); m_buildDir = buildPath.canonicalPath();
m_outputParser.setSourceDirectory(m_srcDir); m_outputParser.setSourceDirectory(m_srcDir);
m_outputParser.setBuildDirectory(m_buildDir);
auto cmd = MesonTools::toolById(m_meson)->configure(m_srcDir, m_buildDir, args); auto cmd = MesonTools::toolById(m_meson)->configure(m_srcDir, m_buildDir, args);
cmd.environment = m_env; cmd.environment = m_env;
// see comment near m_pendingCommands declaration // see comment near m_pendingCommands declaration
@@ -313,6 +314,7 @@ bool MesonProjectParser::setup(
m_srcDir = sourcePath.canonicalPath(); m_srcDir = sourcePath.canonicalPath();
m_buildDir = buildPath.canonicalPath(); m_buildDir = buildPath.canonicalPath();
m_outputParser.setSourceDirectory(m_srcDir); m_outputParser.setSourceDirectory(m_srcDir);
m_outputParser.setBuildDirectory(m_buildDir);
auto cmdArgs = args; auto cmdArgs = args;
if (forceWipe || isSetup(m_buildDir)) if (forceWipe || isSetup(m_buildDir))
cmdArgs << "--wipe"; cmdArgs << "--wipe";
@@ -326,6 +328,7 @@ bool MesonProjectParser::parse(const FilePath &sourcePath, const FilePath &build
m_srcDir = sourcePath.canonicalPath(); m_srcDir = sourcePath.canonicalPath();
m_buildDir = buildPath.canonicalPath(); m_buildDir = buildPath.canonicalPath();
m_outputParser.setSourceDirectory(m_srcDir); m_outputParser.setSourceDirectory(m_srcDir);
m_outputParser.setBuildDirectory(m_buildDir);
if (!isSetup(m_buildDir)) { if (!isSetup(m_buildDir)) {
return parse(m_srcDir); return parse(m_srcDir);
} else { } else {