forked from qt-creator/qt-creator
CMakePM: Rename CMakeParser to CMakeOutputParser
CMakeOutputParser reflects better what the class does, it parses the CMake output to look out for warnings and errors. Change-Id: I601705b2c08ac859c0947d2a50584813353305cf Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -20,7 +20,7 @@ add_qtc_plugin(CMakeProjectManager
|
||||
cmakeinstallstep.cpp cmakeinstallstep.h
|
||||
cmakekitaspect.cpp cmakekitaspect.h
|
||||
cmakelocatorfilter.cpp cmakelocatorfilter.h
|
||||
cmakeparser.cpp cmakeparser.h
|
||||
cmakeoutputparser.cpp cmakeoutputparser.h
|
||||
cmakeprocess.cpp cmakeprocess.h
|
||||
cmakeproject.cpp cmakeproject.h
|
||||
cmakeproject.qrc
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakebuildsystem.h"
|
||||
#include "cmakekitaspect.h"
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeoutputparser.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
@@ -330,14 +330,14 @@ bool CMakeBuildStep::init()
|
||||
|
||||
void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
||||
{
|
||||
CMakeParser *cmakeParser = new CMakeParser;
|
||||
CMakeOutputParser *cmakeOutputParser = new CMakeOutputParser;
|
||||
CmakeProgressParser * const progressParser = new CmakeProgressParser;
|
||||
connect(progressParser, &CmakeProgressParser::progress, this, [this](int percent) {
|
||||
emit progress(percent, {});
|
||||
});
|
||||
formatter->addLineParser(progressParser);
|
||||
cmakeParser->setSourceDirectory(project()->projectDirectory());
|
||||
formatter->addLineParsers({cmakeParser, new GnuMakeParser});
|
||||
cmakeOutputParser->setSourceDirectory(project()->projectDirectory());
|
||||
formatter->addLineParsers({cmakeOutputParser, new GnuMakeParser});
|
||||
Toolchain *tc = ToolchainKitAspect::cxxToolchain(kit());
|
||||
OutputTaskParser *xcodeBuildParser = nullptr;
|
||||
if (tc && tc->targetAbi().os() == Abi::DarwinOS) {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "cmakeabstractprocessstep.h"
|
||||
#include "cmakebuildsystem.h"
|
||||
#include "cmakekitaspect.h"
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeoutputparser.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketool.h"
|
||||
@@ -52,9 +52,9 @@ private:
|
||||
|
||||
void CMakeInstallStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
CMakeParser *cmakeParser = new CMakeParser;
|
||||
cmakeParser->setSourceDirectory(project()->projectDirectory());
|
||||
formatter->addLineParsers({cmakeParser});
|
||||
CMakeOutputParser *cmakeOutputParser = new CMakeOutputParser;
|
||||
cmakeOutputParser->setSourceDirectory(project()->projectDirectory());
|
||||
formatter->addLineParsers({cmakeOutputParser});
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
CMakeAbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2016 Axonian LLC.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeoutputparser.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
@@ -21,7 +21,7 @@ const char COMMON_WARNING_PATTERN[] = "^CMake Warning (\\(dev\\) )?at (.*?):([0-
|
||||
const char LOCATION_LINE_PATTERN[] = ":(\\d+?):(?:(\\d+?))?$";
|
||||
const char SOURCE_LINE_AND_FUNCTION_PATTERN[] = " (.*?):([0-9]*?)( \\((.*?)\\))";
|
||||
|
||||
CMakeParser::CMakeParser()
|
||||
CMakeOutputParser::CMakeOutputParser()
|
||||
{
|
||||
m_commonError.setPattern(QLatin1String(COMMON_ERROR_PATTERN));
|
||||
QTC_CHECK(m_commonError.isValid());
|
||||
@@ -39,7 +39,7 @@ CMakeParser::CMakeParser()
|
||||
QTC_CHECK(m_sourceLineAndFunction.isValid());
|
||||
}
|
||||
|
||||
void CMakeParser::setSourceDirectory(const FilePath &sourceDir)
|
||||
void CMakeOutputParser::setSourceDirectory(const FilePath &sourceDir)
|
||||
{
|
||||
if (m_sourceDirectory)
|
||||
emit searchDirExpired(m_sourceDirectory.value());
|
||||
@@ -47,14 +47,14 @@ void CMakeParser::setSourceDirectory(const FilePath &sourceDir)
|
||||
emit newSearchDirFound(sourceDir);
|
||||
}
|
||||
|
||||
FilePath CMakeParser::resolvePath(const QString &path) const
|
||||
FilePath CMakeOutputParser::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 CMakeOutputParser::handleLine(const QString &line, OutputFormat type)
|
||||
{
|
||||
if (line.startsWith("ninja: build stopped")) {
|
||||
m_lastTask = BuildSystemTask(Task::Error, line);
|
||||
@@ -202,7 +202,7 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
|
||||
return Status::NotHandled;
|
||||
}
|
||||
|
||||
void CMakeParser::flush()
|
||||
void CMakeOutputParser::flush()
|
||||
{
|
||||
if (m_lastTask.isNull())
|
||||
return;
|
||||
@@ -260,16 +260,16 @@ void CMakeParser::flush()
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeParserTest final : public QObject
|
||||
class CMakeOutputParserTest final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testCMakeParser_data();
|
||||
void testCMakeParser();
|
||||
void testCMakeOutputParser_data();
|
||||
void testCMakeOutputParser();
|
||||
};
|
||||
|
||||
void CMakeParserTest::testCMakeParser_data()
|
||||
void CMakeOutputParserTest::testCMakeOutputParser_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -475,10 +475,10 @@ void CMakeParserTest::testCMakeParser_data()
|
||||
<< QString();
|
||||
}
|
||||
|
||||
void CMakeParserTest::testCMakeParser()
|
||||
void CMakeOutputParserTest::testCMakeOutputParser()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.addLineParser(new CMakeParser);
|
||||
testbench.addLineParser(new CMakeOutputParser);
|
||||
QFETCH(QString, input);
|
||||
QFETCH(OutputParserTester::Channel, inputChannel);
|
||||
QFETCH(Tasks, tasks);
|
||||
@@ -491,13 +491,13 @@ void CMakeParserTest::testCMakeParser()
|
||||
outputLines);
|
||||
}
|
||||
|
||||
QObject *createCMakeParserTest()
|
||||
QObject *createCMakeOutputParserTest()
|
||||
{
|
||||
return new CMakeParserTest;
|
||||
return new CMakeOutputParserTest;
|
||||
}
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
#endif
|
||||
|
||||
#include "cmakeparser.moc"
|
||||
#include "cmakeoutputparser.moc"
|
@@ -16,12 +16,12 @@
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMAKE_EXPORT CMakeParser : public ProjectExplorer::OutputTaskParser
|
||||
class CMAKE_EXPORT CMakeOutputParser : public ProjectExplorer::OutputTaskParser
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CMakeParser();
|
||||
explicit CMakeOutputParser();
|
||||
void setSourceDirectory(const Utils::FilePath &sourceDir);
|
||||
|
||||
private:
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
};
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
namespace Internal { QObject *createCMakeParserTest(); }
|
||||
namespace Internal { QObject *createCMakeOutputParserTest(); }
|
||||
#endif
|
||||
|
||||
} // CMakeProjectManager
|
@@ -4,7 +4,7 @@
|
||||
#include "cmakeprocess.h"
|
||||
|
||||
#include "builddirparameters.h"
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeoutputparser.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
@@ -113,7 +113,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
idePackageManagerDir.copyRecursively(localPackageManagerDir);
|
||||
}
|
||||
|
||||
const auto parser = new CMakeParser;
|
||||
const auto parser = new CMakeOutputParser;
|
||||
parser->setSourceDirectory(parameters.sourceDirectory);
|
||||
m_parser.addLineParser(parser);
|
||||
m_parser.addLineParsers(parameters.outputParsers());
|
||||
|
@@ -41,8 +41,8 @@ QtcPlugin {
|
||||
"cmakekitaspect.cpp",
|
||||
"cmakelocatorfilter.cpp",
|
||||
"cmakelocatorfilter.h",
|
||||
"cmakeparser.cpp",
|
||||
"cmakeparser.h",
|
||||
"cmakeoutputparser.cpp",
|
||||
"cmakeoutputparser.h",
|
||||
"cmakeprocess.cpp",
|
||||
"cmakeprocess.h",
|
||||
"cmakeproject.cpp",
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "cmakeinstallstep.h"
|
||||
#include "cmakelocatorfilter.h"
|
||||
#include "cmakekitaspect.h"
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeoutputparser.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectimporter.h"
|
||||
@@ -70,7 +70,7 @@ class CMakeProjectPlugin final : public ExtensionSystem::IPlugin
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
addTestCreator(createCMakeConfigTest);
|
||||
addTestCreator(createCMakeParserTest);
|
||||
addTestCreator(createCMakeOutputParserTest);
|
||||
addTestCreator(createCMakeProjectImporterTest);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user