forked from qt-creator/qt-creator
ProjectExplorer: Clean up IOutputParser interface
- Remove unneeded/unused functions. - De-virtualize where possible. In particular, after untangling a number of self-referential redirections, it became apparent that the outputAdded() infrastructure was entirely unused. Change-Id: I51e1beed008df2727b42494b087efa476342397e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -73,8 +73,6 @@ const int MAX_PROGRESS = 1400;
|
|||||||
|
|
||||||
ServerModeReader::ServerModeReader()
|
ServerModeReader::ServerModeReader()
|
||||||
{
|
{
|
||||||
connect(&m_parser, &CMakeParser::addOutput,
|
|
||||||
this, [](const QString &m) { Core::MessageManager::write(m); });
|
|
||||||
connect(&m_parser, &CMakeParser::addTask, this, [this](const Task &t) {
|
connect(&m_parser, &CMakeParser::addTask, this, [this](const Task &t) {
|
||||||
Task editable(t);
|
Task editable(t);
|
||||||
if (!editable.file.isEmpty()) {
|
if (!editable.file.isEmpty()) {
|
||||||
|
@@ -142,7 +142,6 @@ void AbstractProcessStep::setOutputParser(IOutputParser *parser)
|
|||||||
d->m_outputParserChain.reset(new AnsiFilterParser);
|
d->m_outputParserChain.reset(new AnsiFilterParser);
|
||||||
d->m_outputParserChain->appendOutputParser(parser);
|
d->m_outputParserChain->appendOutputParser(parser);
|
||||||
|
|
||||||
connect(d->m_outputParserChain.get(), &IOutputParser::addOutput, this, &AbstractProcessStep::outputAdded);
|
|
||||||
connect(d->m_outputParserChain.get(), &IOutputParser::addTask, this, &AbstractProcessStep::taskAdded);
|
connect(d->m_outputParserChain.get(), &IOutputParser::addTask, this, &AbstractProcessStep::taskAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -134,11 +134,6 @@ void CustomParser::stdOutput(const QString &line)
|
|||||||
IOutputParser::stdOutput(line);
|
IOutputParser::stdOutput(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomParser::setWorkingDirectory(const QString &workingDirectory)
|
|
||||||
{
|
|
||||||
m_workingDirectory = workingDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomParser::setSettings(const CustomParserSettings &settings)
|
void CustomParser::setSettings(const CustomParserSettings &settings)
|
||||||
{
|
{
|
||||||
m_error = settings.error;
|
m_error = settings.error;
|
||||||
@@ -152,10 +147,9 @@ Core::Id CustomParser::id()
|
|||||||
|
|
||||||
FilePath CustomParser::absoluteFilePath(const QString &filePath) const
|
FilePath CustomParser::absoluteFilePath(const QString &filePath) const
|
||||||
{
|
{
|
||||||
if (m_workingDirectory.isEmpty())
|
if (workingDirectory().isEmpty())
|
||||||
return FilePath::fromUserInput(filePath);
|
return FilePath::fromUserInput(filePath);
|
||||||
|
return workingDirectory().resolvePath(filePath);
|
||||||
return FilePath::fromString(m_workingDirectory).resolvePath(filePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomParser::hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
bool CustomParser::hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
||||||
@@ -481,7 +475,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers()
|
|||||||
|
|
||||||
CustomParser *parser = new CustomParser;
|
CustomParser *parser = new CustomParser;
|
||||||
parser->setSettings(settings);
|
parser->setSettings(settings);
|
||||||
parser->setWorkingDirectory(workDir);
|
parser->setWorkingDirectory(FilePath::fromString(workDir));
|
||||||
|
|
||||||
OutputParserTester testbench;
|
OutputParserTester testbench;
|
||||||
testbench.appendOutputParser(parser);
|
testbench.appendOutputParser(parser);
|
||||||
|
@@ -89,8 +89,6 @@ public:
|
|||||||
void stdError(const QString &line) override;
|
void stdError(const QString &line) override;
|
||||||
void stdOutput(const QString &line) override;
|
void stdOutput(const QString &line) override;
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &workingDirectory) override;
|
|
||||||
|
|
||||||
void setSettings(const CustomParserSettings &settings);
|
void setSettings(const CustomParserSettings &settings);
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
@@ -103,8 +101,6 @@ private:
|
|||||||
|
|
||||||
CustomParserExpression m_error;
|
CustomParserExpression m_error;
|
||||||
CustomParserExpression m_warning;
|
CustomParserExpression m_warning;
|
||||||
|
|
||||||
QString m_workingDirectory;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -56,12 +56,6 @@ GnuMakeParser::GnuMakeParser()
|
|||||||
QTC_CHECK(m_errorInMakefile.isValid());
|
QTC_CHECK(m_errorInMakefile.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnuMakeParser::setWorkingDirectory(const QString &workingDirectory)
|
|
||||||
{
|
|
||||||
addDirectory(workingDirectory);
|
|
||||||
IOutputParser::setWorkingDirectory(workingDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GnuMakeParser::hasFatalErrors() const
|
bool GnuMakeParser::hasFatalErrors() const
|
||||||
{
|
{
|
||||||
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
||||||
@@ -180,7 +174,7 @@ void GnuMakeParser::taskAdded(const Task &task, int linkedLines, int skippedLine
|
|||||||
|
|
||||||
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
|
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
|
||||||
QFileInfoList possibleFiles;
|
QFileInfoList possibleFiles;
|
||||||
foreach (const QString &dir, m_directories) {
|
foreach (const QString &dir, searchDirectories()) {
|
||||||
QFileInfo candidate(dir + QLatin1Char('/') + filePath);
|
QFileInfo candidate(dir + QLatin1Char('/') + filePath);
|
||||||
if (candidate.exists()
|
if (candidate.exists()
|
||||||
&& !possibleFiles.contains(candidate)) {
|
&& !possibleFiles.contains(candidate)) {
|
||||||
@@ -197,6 +191,14 @@ void GnuMakeParser::taskAdded(const Task &task, int linkedLines, int skippedLine
|
|||||||
IOutputParser::taskAdded(editable, linkedLines, skippedLines);
|
IOutputParser::taskAdded(editable, linkedLines, skippedLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList GnuMakeParser::searchDirectories() const
|
||||||
|
{
|
||||||
|
QStringList dirs = m_directories;
|
||||||
|
if (!workingDirectory().isEmpty())
|
||||||
|
dirs << workingDirectory().toString();
|
||||||
|
return dirs;
|
||||||
|
}
|
||||||
|
|
||||||
} // ProjectExplorer
|
} // ProjectExplorer
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -210,11 +212,6 @@ void GnuMakeParser::taskAdded(const Task &task, int linkedLines, int skippedLine
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
QStringList GnuMakeParser::searchDirectories() const
|
|
||||||
{
|
|
||||||
return m_directories;
|
|
||||||
}
|
|
||||||
|
|
||||||
GnuMakeParserTester::GnuMakeParserTester(GnuMakeParser *p, QObject *parent) :
|
GnuMakeParserTester::GnuMakeParserTester(GnuMakeParser *p, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
parser(p)
|
parser(p)
|
||||||
|
@@ -42,8 +42,6 @@ public:
|
|||||||
void stdOutput(const QString &line) override;
|
void stdOutput(const QString &line) override;
|
||||||
void stdError(const QString &line) override;
|
void stdError(const QString &line) override;
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &workingDirectory) override;
|
|
||||||
|
|
||||||
QStringList searchDirectories() const;
|
QStringList searchDirectories() const;
|
||||||
|
|
||||||
bool hasFatalErrors() const override;
|
bool hasFatalErrors() const override;
|
||||||
|
@@ -138,19 +138,7 @@ void IOutputParser::appendOutputParser(IOutputParser *parser)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_parser = parser;
|
m_parser = parser;
|
||||||
connect(parser, &IOutputParser::addOutput,
|
connect(parser, &IOutputParser::addTask, this, &IOutputParser::taskAdded);
|
||||||
this, &IOutputParser::outputAdded, Qt::DirectConnection);
|
|
||||||
connect(parser, &IOutputParser::addTask,
|
|
||||||
this, &IOutputParser::taskAdded, Qt::DirectConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
IOutputParser *IOutputParser::takeOutputParserChain()
|
|
||||||
{
|
|
||||||
IOutputParser *parser = m_parser;
|
|
||||||
disconnect(parser, &IOutputParser::addOutput, this, &IOutputParser::outputAdded);
|
|
||||||
disconnect(parser, &IOutputParser::addTask, this, &IOutputParser::taskAdded);
|
|
||||||
m_parser = nullptr;
|
|
||||||
return parser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser *IOutputParser::childParser() const
|
IOutputParser *IOutputParser::childParser() const
|
||||||
@@ -163,12 +151,8 @@ void IOutputParser::setChildParser(IOutputParser *parser)
|
|||||||
if (m_parser != parser)
|
if (m_parser != parser)
|
||||||
delete m_parser;
|
delete m_parser;
|
||||||
m_parser = parser;
|
m_parser = parser;
|
||||||
if (parser) {
|
if (parser)
|
||||||
connect(parser, &IOutputParser::addOutput,
|
connect(parser, &IOutputParser::addTask, this, &IOutputParser::taskAdded);
|
||||||
this, &IOutputParser::outputAdded, Qt::DirectConnection);
|
|
||||||
connect(parser, &IOutputParser::addTask,
|
|
||||||
this, &IOutputParser::taskAdded, Qt::DirectConnection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::stdOutput(const QString &line)
|
void IOutputParser::stdOutput(const QString &line)
|
||||||
@@ -183,11 +167,6 @@ void IOutputParser::stdError(const QString &line)
|
|||||||
m_parser->stdError(line);
|
m_parser->stdError(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::outputAdded(const QString &string, BuildStep::OutputFormat format)
|
|
||||||
{
|
|
||||||
emit addOutput(string, format);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IOutputParser::taskAdded(const Task &task, int linkedOutputLines, int skipLines)
|
void IOutputParser::taskAdded(const Task &task, int linkedOutputLines, int skipLines)
|
||||||
{
|
{
|
||||||
emit addTask(task, linkedOutputLines, skipLines);
|
emit addTask(task, linkedOutputLines, skipLines);
|
||||||
@@ -201,15 +180,11 @@ bool IOutputParser::hasFatalErrors() const
|
|||||||
return m_parser && m_parser->hasFatalErrors();
|
return m_parser && m_parser->hasFatalErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::setWorkingDirectory(const QString &workingDirectory)
|
|
||||||
{
|
|
||||||
if (m_parser)
|
|
||||||
m_parser->setWorkingDirectory(workingDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IOutputParser::setWorkingDirectory(const Utils::FilePath &fn)
|
void IOutputParser::setWorkingDirectory(const Utils::FilePath &fn)
|
||||||
{
|
{
|
||||||
setWorkingDirectory(fn.toString());
|
m_workingDir = fn;
|
||||||
|
if (m_parser)
|
||||||
|
m_parser->setWorkingDirectory(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::flush()
|
void IOutputParser::flush()
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
#include "buildstep.h"
|
#include "buildstep.h"
|
||||||
|
|
||||||
namespace Utils { class FilePath; }
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Task;
|
class Task;
|
||||||
@@ -41,9 +41,7 @@ public:
|
|||||||
IOutputParser() = default;
|
IOutputParser() = default;
|
||||||
~IOutputParser() override;
|
~IOutputParser() override;
|
||||||
|
|
||||||
virtual void appendOutputParser(IOutputParser *parser);
|
void appendOutputParser(IOutputParser *parser);
|
||||||
|
|
||||||
IOutputParser *takeOutputParserChain();
|
|
||||||
|
|
||||||
IOutputParser *childParser() const;
|
IOutputParser *childParser() const;
|
||||||
void setChildParser(IOutputParser *parser);
|
void setChildParser(IOutputParser *parser);
|
||||||
@@ -52,25 +50,26 @@ public:
|
|||||||
virtual void stdError(const QString &line);
|
virtual void stdError(const QString &line);
|
||||||
|
|
||||||
virtual bool hasFatalErrors() const;
|
virtual bool hasFatalErrors() const;
|
||||||
virtual void setWorkingDirectory(const QString &workingDirectory);
|
|
||||||
void setWorkingDirectory(const Utils::FilePath &fn);
|
void setWorkingDirectory(const Utils::FilePath &fn);
|
||||||
|
|
||||||
void flush(); // flush out pending tasks
|
void flush(); // flush out pending tasks
|
||||||
|
|
||||||
static QString rightTrimmed(const QString &in);
|
static QString rightTrimmed(const QString &in);
|
||||||
|
|
||||||
|
virtual void taskAdded(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
|
|
||||||
void addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
void addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
||||||
|
|
||||||
public slots:
|
protected:
|
||||||
virtual void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
|
Utils::FilePath workingDirectory() const { return m_workingDir; }
|
||||||
virtual void taskAdded(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void doFlush();
|
virtual void doFlush();
|
||||||
|
|
||||||
IOutputParser *m_parser = nullptr;
|
IOutputParser *m_parser = nullptr;
|
||||||
|
Utils::FilePath m_workingDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -106,7 +106,7 @@ bool MakeStep::init()
|
|||||||
IOutputParser *parser = target()->kit()->createOutputParser();
|
IOutputParser *parser = target()->kit()->createOutputParser();
|
||||||
if (parser)
|
if (parser)
|
||||||
appendOutputParser(parser);
|
appendOutputParser(parser);
|
||||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory().toString());
|
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
||||||
|
|
||||||
return AbstractProcessStep::init();
|
return AbstractProcessStep::init();
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,6 @@ static inline QByteArray msgFileComparisonFail(const Utils::FilePath &f1, const
|
|||||||
return result.toLocal8Bit();
|
return result.toLocal8Bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputParserTester::OutputParserTester() = default;
|
|
||||||
|
|
||||||
// test functions:
|
// test functions:
|
||||||
void OutputParserTester::testParsing(const QString &lines,
|
void OutputParserTester::testParsing(const QString &lines,
|
||||||
Channel inputChannel,
|
Channel inputChannel,
|
||||||
@@ -48,6 +46,10 @@ void OutputParserTester::testParsing(const QString &lines,
|
|||||||
const QString &childStdErrLines,
|
const QString &childStdErrLines,
|
||||||
const QString &outputLines)
|
const QString &outputLines)
|
||||||
{
|
{
|
||||||
|
if (!m_terminator) {
|
||||||
|
m_terminator = new TestTerminator(this);
|
||||||
|
appendOutputParser(m_terminator);
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
Q_ASSERT(childParser());
|
Q_ASSERT(childParser());
|
||||||
|
|
||||||
@@ -60,18 +62,8 @@ void OutputParserTester::testParsing(const QString &lines,
|
|||||||
}
|
}
|
||||||
childParser()->flush();
|
childParser()->flush();
|
||||||
|
|
||||||
// first disconnect ourselves from the end of the parser chain again
|
// delete the parser(s) to test
|
||||||
IOutputParser *parser = this;
|
|
||||||
while ( (parser = parser->childParser()) ) {
|
|
||||||
if (parser->childParser() == this) {
|
|
||||||
childParser()->takeOutputParserChain();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parser = nullptr;
|
|
||||||
emit aboutToDeleteParser();
|
emit aboutToDeleteParser();
|
||||||
|
|
||||||
// then delete the parser(s) to test
|
|
||||||
setChildParser(nullptr);
|
setChildParser(nullptr);
|
||||||
|
|
||||||
QCOMPARE(m_receivedOutput, outputLines);
|
QCOMPARE(m_receivedOutput, outputLines);
|
||||||
@@ -110,39 +102,11 @@ void OutputParserTester::testTaskMangling(const Task &input,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputParserTester::testOutputMangling(const QString &input,
|
|
||||||
const QString &output)
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
|
|
||||||
childParser()->outputAdded(input, BuildStep::OutputFormat::Stdout);
|
|
||||||
|
|
||||||
QCOMPARE(m_receivedOutput, output);
|
|
||||||
QVERIFY(m_receivedStdErrChildLine.isNull());
|
|
||||||
QVERIFY(m_receivedStdOutChildLine.isNull());
|
|
||||||
QVERIFY(m_receivedTasks.isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputParserTester::setDebugEnabled(bool debug)
|
void OutputParserTester::setDebugEnabled(bool debug)
|
||||||
{
|
{
|
||||||
m_debug = debug;
|
m_debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputParserTester::appendOutputParser(IOutputParser *parser)
|
|
||||||
{
|
|
||||||
Q_ASSERT(!childParser());
|
|
||||||
parser->appendOutputParser(new TestTerminator(this));
|
|
||||||
IOutputParser::appendOutputParser(parser);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputParserTester::outputAdded(const QString &line, BuildStep::OutputFormat format)
|
|
||||||
{
|
|
||||||
Q_UNUSED(format)
|
|
||||||
if (!m_receivedOutput.isEmpty())
|
|
||||||
m_receivedOutput.append('\n');
|
|
||||||
m_receivedOutput.append(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputParserTester::taskAdded(const Task &task, int linkedLines, int skipLines)
|
void OutputParserTester::taskAdded(const Task &task, int linkedLines, int skipLines)
|
||||||
{
|
{
|
||||||
Q_UNUSED(linkedLines)
|
Q_UNUSED(linkedLines)
|
||||||
|
@@ -46,8 +46,6 @@ public:
|
|||||||
STDERR
|
STDERR
|
||||||
};
|
};
|
||||||
|
|
||||||
OutputParserTester();
|
|
||||||
|
|
||||||
// test functions:
|
// test functions:
|
||||||
void testParsing(const QString &lines, Channel inputChannel,
|
void testParsing(const QString &lines, Channel inputChannel,
|
||||||
Tasks tasks,
|
Tasks tasks,
|
||||||
@@ -56,18 +54,13 @@ public:
|
|||||||
const QString &outputLines);
|
const QString &outputLines);
|
||||||
void testTaskMangling(const Task &input,
|
void testTaskMangling(const Task &input,
|
||||||
const Task &output);
|
const Task &output);
|
||||||
void testOutputMangling(const QString &input,
|
|
||||||
const QString &output);
|
|
||||||
|
|
||||||
void setDebugEnabled(bool);
|
void setDebugEnabled(bool);
|
||||||
|
|
||||||
void appendOutputParser(IOutputParser *parser) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aboutToDeleteParser();
|
void aboutToDeleteParser();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format) override;
|
|
||||||
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
|
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
@@ -78,6 +71,7 @@ private:
|
|||||||
QString m_receivedStdOutChildLine;
|
QString m_receivedStdOutChildLine;
|
||||||
Tasks m_receivedTasks;
|
Tasks m_receivedTasks;
|
||||||
QString m_receivedOutput;
|
QString m_receivedOutput;
|
||||||
|
TestTerminator *m_terminator = nullptr;
|
||||||
|
|
||||||
friend class TestTerminator;
|
friend class TestTerminator;
|
||||||
};
|
};
|
||||||
|
@@ -179,10 +179,6 @@ bool QbsBuildStep::init()
|
|||||||
m_activeFileTags = bc->activeFileTags();
|
m_activeFileTags = bc->activeFileTags();
|
||||||
m_products = bc->products();
|
m_products = bc->products();
|
||||||
|
|
||||||
connect(m_parser, &ProjectExplorer::IOutputParser::addOutput,
|
|
||||||
this, [this](const QString &string, ProjectExplorer::BuildStep::OutputFormat format) {
|
|
||||||
emit addOutput(string, format);
|
|
||||||
});
|
|
||||||
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
|
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -383,7 +379,7 @@ void QbsBuildStep::handleProcessResult(
|
|||||||
if (success && !hasOutput)
|
if (success && !hasOutput)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_parser->setWorkingDirectory(workingDir.toString());
|
m_parser->setWorkingDirectory(workingDir);
|
||||||
emit addOutput(executable.toUserOutput() + ' ' + QtcProcess::joinArgs(arguments),
|
emit addOutput(executable.toUserOutput() + ' ' + QtcProcess::joinArgs(arguments),
|
||||||
OutputFormat::Stdout);
|
OutputFormat::Stdout);
|
||||||
for (const QString &line : stdErr) {
|
for (const QString &line : stdErr) {
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
@@ -39,21 +40,13 @@ QbsParser::QbsParser()
|
|||||||
setObjectName(QLatin1String("QbsParser"));
|
setObjectName(QLatin1String("QbsParser"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsParser::setWorkingDirectory(const QString &workingDirectory)
|
// TODO: Is this really needed? qbs never emits relative paths...
|
||||||
{
|
|
||||||
m_workingDirectory = QDir(workingDirectory);
|
|
||||||
IOutputParser::setWorkingDirectory(workingDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsParser::taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines)
|
void QbsParser::taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines)
|
||||||
{
|
{
|
||||||
ProjectExplorer::Task editable(task);
|
ProjectExplorer::Task editable(task);
|
||||||
|
const QString filePath = task.file.toString();
|
||||||
QString filePath = task.file.toString();
|
|
||||||
|
|
||||||
if (!filePath.isEmpty())
|
if (!filePath.isEmpty())
|
||||||
editable.file = Utils::FilePath::fromUserInput(m_workingDirectory.absoluteFilePath(filePath));
|
editable.file = workingDirectory().pathAppended(filePath);
|
||||||
|
|
||||||
IOutputParser::taskAdded(editable, linkedLines, skipLines);
|
IOutputParser::taskAdded(editable, linkedLines, skipLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/ioutputparser.h>
|
#include <projectexplorer/ioutputparser.h>
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -42,10 +40,7 @@ public:
|
|||||||
explicit QbsParser();
|
explicit QbsParser();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setWorkingDirectory(const QString &workingDirectory) override;
|
|
||||||
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
|
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
|
||||||
|
|
||||||
QDir m_workingDirectory;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -338,7 +338,7 @@ void QMakeStep::runNextCommand()
|
|||||||
case State::RUN_MAKE_QMAKE_ALL:
|
case State::RUN_MAKE_QMAKE_ALL:
|
||||||
{
|
{
|
||||||
auto *parser = new GnuMakeParser;
|
auto *parser = new GnuMakeParser;
|
||||||
parser->setWorkingDirectory(processParameters()->workingDirectory().toString());
|
parser->setWorkingDirectory(processParameters()->workingDirectory());
|
||||||
setOutputParser(parser);
|
setOutputParser(parser);
|
||||||
m_nextState = State::POST_PROCESS;
|
m_nextState = State::POST_PROCESS;
|
||||||
startOneCommand(m_makeCommand);
|
startOneCommand(m_makeCommand);
|
||||||
|
Reference in New Issue
Block a user