QbsProjectManager: Remove the QbsParser class

It serves no purpose.

Change-Id: I92e700ed5c1d2b72398f4c7b88dab0cea9404e4d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-04-07 12:50:53 +02:00
parent c54107b125
commit b22bb5a9a7
7 changed files with 13 additions and 119 deletions

View File

@@ -15,7 +15,6 @@ add_qtc_plugin(QbsProjectManager
qbskitinformation.cpp qbskitinformation.h qbskitinformation.cpp qbskitinformation.h
qbsnodes.cpp qbsnodes.h qbsnodes.cpp qbsnodes.h
qbsnodetreebuilder.cpp qbsnodetreebuilder.h qbsnodetreebuilder.cpp qbsnodetreebuilder.h
qbsparser.cpp qbsparser.h
qbspmlogging.cpp qbspmlogging.h qbspmlogging.cpp qbspmlogging.h
qbsprofilemanager.cpp qbsprofilemanager.h qbsprofilemanager.cpp qbsprofilemanager.h
qbsprofilessettingspage.cpp qbsprofilessettingspage.h qbsprofilessettingspage.cpp qbsprofilessettingspage.h

View File

@@ -26,7 +26,6 @@
#include "qbsbuildstep.h" #include "qbsbuildstep.h"
#include "qbsbuildconfiguration.h" #include "qbsbuildconfiguration.h"
#include "qbsparser.h"
#include "qbsproject.h" #include "qbsproject.h"
#include "qbsprojectmanagerconstants.h" #include "qbsprojectmanagerconstants.h"
#include "qbssession.h" #include "qbssession.h"
@@ -35,6 +34,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/variablechooser.h> #include <coreplugin/variablechooser.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/kit.h> #include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -60,7 +60,6 @@
// -------------------------------------------------------------------- // --------------------------------------------------------------------
const char QBS_CONFIG[] = "Qbs.Configuration"; const char QBS_CONFIG[] = "Qbs.Configuration";
const char QBS_DRY_RUN[] = "Qbs.DryRun";
const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing"; const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs"; const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs";
const char QBS_SHOWCOMMANDLINES[] = "Qbs.ShowCommandLines"; const char QBS_SHOWCOMMANDLINES[] = "Qbs.ShowCommandLines";
@@ -170,17 +169,14 @@ bool QbsBuildStep::init()
return false; return false;
delete m_parser; delete m_parser;
m_parser = new Internal::QbsParser; m_parser = target()->kit()->createOutputParser();
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser(); if (m_parser)
if (parser) connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
m_parser->appendOutputParser(parser);
m_changedFiles = bc->changedFiles(); m_changedFiles = bc->changedFiles();
m_activeFileTags = bc->activeFileTags(); m_activeFileTags = bc->activeFileTags();
m_products = bc->products(); m_products = bc->products();
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
return true; return true;
} }
@@ -379,18 +375,22 @@ void QbsBuildStep::handleProcessResult(
if (success && !hasOutput) if (success && !hasOutput)
return; return;
m_parser->setWorkingDirectory(workingDir); if (m_parser)
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) {
m_parser->handleStderr(line + '\n'); if (m_parser)
m_parser->handleStderr(line + '\n');
emit addOutput(line, OutputFormat::Stderr); emit addOutput(line, OutputFormat::Stderr);
} }
for (const QString &line : stdOut) { for (const QString &line : stdOut) {
m_parser->handleStdout(line + '\n'); if (m_parser)
m_parser->handleStdout(line + '\n');
emit addOutput(line, OutputFormat::Stdout); emit addOutput(line, OutputFormat::Stdout);
} }
m_parser->flush(); if (m_parser)
m_parser->flush();
} }
void QbsBuildStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, void QbsBuildStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message,

View File

@@ -30,6 +30,7 @@
#include <projectexplorer/buildstep.h> #include <projectexplorer/buildstep.h>
#include <projectexplorer/task.h> #include <projectexplorer/task.h>
namespace ProjectExplorer { class IOutputParser; }
namespace Utils { class FancyLineEdit; } namespace Utils { class FancyLineEdit; }
namespace QbsProjectManager { namespace QbsProjectManager {

View File

@@ -1,55 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qbsparser.h"
#include <projectexplorer/task.h>
#include <utils/fileutils.h>
#include <QDir>
#include <QFileInfo>
namespace QbsProjectManager {
namespace Internal {
QbsParser::QbsParser()
{
setObjectName(QLatin1String("QbsParser"));
}
// TODO: Is this really needed? qbs never emits relative paths...
void QbsParser::taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines)
{
ProjectExplorer::Task editable(task);
const QString filePath = task.file.toString();
if (!filePath.isEmpty())
editable.file = workingDirectory().pathAppended(filePath);
IOutputParser::taskAdded(editable, linkedLines, skipLines);
}
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -1,47 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "qbsprojectmanager_global.h"
#include <projectexplorer/ioutputparser.h>
namespace QbsProjectManager {
namespace Internal {
class QbsParser : public ProjectExplorer::IOutputParser
{
Q_OBJECT
public:
explicit QbsParser();
private:
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
};
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -16,7 +16,6 @@ HEADERS = \
qbsinstallstep.h \ qbsinstallstep.h \
qbsnodes.h \ qbsnodes.h \
qbsnodetreebuilder.h \ qbsnodetreebuilder.h \
qbsparser.h \
qbspmlogging.h \ qbspmlogging.h \
qbsprofilemanager.h \ qbsprofilemanager.h \
qbsprofilessettingspage.h \ qbsprofilessettingspage.h \
@@ -39,7 +38,6 @@ SOURCES = \
qbskitinformation.cpp \ qbskitinformation.cpp \
qbsnodes.cpp \ qbsnodes.cpp \
qbsnodetreebuilder.cpp \ qbsnodetreebuilder.cpp \
qbsparser.cpp \
qbspmlogging.cpp \ qbspmlogging.cpp \
qbsprofilemanager.cpp \ qbsprofilemanager.cpp \
qbsprofilessettingspage.cpp \ qbsprofilessettingspage.cpp \

View File

@@ -40,8 +40,6 @@ QtcPlugin {
"qbsnodes.h", "qbsnodes.h",
"qbsnodetreebuilder.cpp", "qbsnodetreebuilder.cpp",
"qbsnodetreebuilder.h", "qbsnodetreebuilder.h",
"qbsparser.cpp",
"qbsparser.h",
"qbspmlogging.cpp", "qbspmlogging.cpp",
"qbspmlogging.h", "qbspmlogging.h",
"qbsprofilemanager.cpp", "qbsprofilemanager.cpp",