forked from qt-creator/qt-creator
CMake: Allow parser to run remotely
Change-Id: I3953d459177790fd652ab69c083b0dd0f1d29031 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -300,7 +300,7 @@ void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
|||||||
emit progress(percent, {});
|
emit progress(percent, {});
|
||||||
});
|
});
|
||||||
formatter->addLineParser(progressParser);
|
formatter->addLineParser(progressParser);
|
||||||
cmakeParser->setSourceDirectory(project()->projectDirectory().toString());
|
cmakeParser->setSourceDirectory(project()->projectDirectory());
|
||||||
formatter->addLineParsers({cmakeParser, new GnuMakeParser});
|
formatter->addLineParsers({cmakeParser, new GnuMakeParser});
|
||||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
||||||
OutputTaskParser *xcodeBuildParser = nullptr;
|
OutputTaskParser *xcodeBuildParser = nullptr;
|
||||||
|
@@ -32,12 +32,19 @@ CMakeParser::CMakeParser()
|
|||||||
QTC_CHECK(m_locationLine.isValid());
|
QTC_CHECK(m_locationLine.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeParser::setSourceDirectory(const QString &sourceDir)
|
void CMakeParser::setSourceDirectory(const FilePath &sourceDir)
|
||||||
{
|
{
|
||||||
if (m_sourceDirectory)
|
if (m_sourceDirectory)
|
||||||
emit searchDirExpired(FilePath::fromString(m_sourceDirectory.value().path()));
|
emit searchDirExpired(m_sourceDirectory.value());
|
||||||
m_sourceDirectory = QDir(sourceDir);
|
m_sourceDirectory = sourceDir;
|
||||||
emit newSearchDirFound(FilePath::fromString(sourceDir));
|
emit newSearchDirFound(sourceDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePath CMakeParser::resolvePath(const QString &path) const
|
||||||
|
{
|
||||||
|
if (m_sourceDirectory)
|
||||||
|
return m_sourceDirectory->resolvePath(path);
|
||||||
|
return FilePath::fromUserInput(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputFormat type)
|
OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputFormat type)
|
||||||
@@ -69,12 +76,11 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
|
|||||||
|
|
||||||
match = m_commonError.match(trimmedLine);
|
match = m_commonError.match(trimmedLine);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
QString path = m_sourceDirectory ? m_sourceDirectory->absoluteFilePath(
|
const FilePath path = resolvePath(match.captured(1));
|
||||||
QDir::fromNativeSeparators(match.captured(1)))
|
|
||||||
: QDir::fromNativeSeparators(match.captured(1));
|
|
||||||
m_lastTask = BuildSystemTask(Task::Error,
|
m_lastTask = BuildSystemTask(Task::Error,
|
||||||
QString(),
|
QString(),
|
||||||
absoluteFilePath(FilePath::fromUserInput(path)),
|
absoluteFilePath(path),
|
||||||
match.captured(2).toInt());
|
match.captured(2).toInt());
|
||||||
m_lines = 1;
|
m_lines = 1;
|
||||||
LinkSpecs linkSpecs;
|
LinkSpecs linkSpecs;
|
||||||
@@ -94,12 +100,10 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
|
|||||||
}
|
}
|
||||||
match = m_commonWarning.match(trimmedLine);
|
match = m_commonWarning.match(trimmedLine);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
QString path = m_sourceDirectory ? m_sourceDirectory->absoluteFilePath(
|
const FilePath path = resolvePath(match.captured(2));
|
||||||
QDir::fromNativeSeparators(match.captured(2)))
|
|
||||||
: QDir::fromNativeSeparators(match.captured(2));
|
|
||||||
m_lastTask = BuildSystemTask(Task::Warning,
|
m_lastTask = BuildSystemTask(Task::Warning,
|
||||||
QString(),
|
QString(),
|
||||||
absoluteFilePath(FilePath::fromUserInput(path)),
|
absoluteFilePath(path),
|
||||||
match.captured(3).toInt());
|
match.captured(3).toInt());
|
||||||
m_lines = 1;
|
m_lines = 1;
|
||||||
LinkSpecs linkSpecs;
|
LinkSpecs linkSpecs;
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
#include <projectexplorer/ioutputparser.h>
|
#include <projectexplorer/ioutputparser.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -21,17 +22,18 @@ class CMAKE_EXPORT CMakeParser : public ProjectExplorer::OutputTaskParser
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CMakeParser();
|
explicit CMakeParser();
|
||||||
void setSourceDirectory(const QString &sourceDir);
|
void setSourceDirectory(const Utils::FilePath &sourceDir);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result handleLine(const QString &line, Utils::OutputFormat type) override;
|
Result handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void flush() override;
|
void flush() override;
|
||||||
|
Utils::FilePath resolvePath(const QString &path) const;
|
||||||
|
|
||||||
enum TripleLineError { NONE, LINE_LOCATION, LINE_DESCRIPTION, LINE_DESCRIPTION2 };
|
enum TripleLineError { NONE, LINE_LOCATION, LINE_DESCRIPTION, LINE_DESCRIPTION2 };
|
||||||
|
|
||||||
TripleLineError m_expectTripleLineErrorData = NONE;
|
TripleLineError m_expectTripleLineErrorData = NONE;
|
||||||
|
|
||||||
std::optional<QDir> m_sourceDirectory;
|
std::optional<Utils::FilePath> m_sourceDirectory;
|
||||||
ProjectExplorer::Task m_lastTask;
|
ProjectExplorer::Task m_lastTask;
|
||||||
QRegularExpression m_commonError;
|
QRegularExpression m_commonError;
|
||||||
QRegularExpression m_nextSubError;
|
QRegularExpression m_nextSubError;
|
||||||
@@ -41,4 +43,4 @@ private:
|
|||||||
int m_lines = 0;
|
int m_lines = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CMakeProjectManager
|
} // CMakeProjectManager
|
||||||
|
@@ -97,7 +97,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto parser = new CMakeParser;
|
const auto parser = new CMakeParser;
|
||||||
parser->setSourceDirectory(parameters.sourceDirectory.path());
|
parser->setSourceDirectory(parameters.sourceDirectory);
|
||||||
m_parser.addLineParser(parser);
|
m_parser.addLineParser(parser);
|
||||||
|
|
||||||
// Always use the sourceDir: If we are triggered because the build directory is getting deleted
|
// Always use the sourceDir: If we are triggered because the build directory is getting deleted
|
||||||
|
Reference in New Issue
Block a user