From b22bb5a9a7aa22fe13e1282c5db851688ec4d83f Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 7 Apr 2020 12:50:53 +0200 Subject: [PATCH] QbsProjectManager: Remove the QbsParser class It serves no purpose. Change-Id: I92e700ed5c1d2b72398f4c7b88dab0cea9404e4d Reviewed-by: hjk --- src/plugins/qbsprojectmanager/CMakeLists.txt | 1 - .../qbsprojectmanager/qbsbuildstep.cpp | 24 ++++---- src/plugins/qbsprojectmanager/qbsbuildstep.h | 1 + src/plugins/qbsprojectmanager/qbsparser.cpp | 55 ------------------- src/plugins/qbsprojectmanager/qbsparser.h | 47 ---------------- .../qbsprojectmanager/qbsprojectmanager.pro | 2 - .../qbsprojectmanager/qbsprojectmanager.qbs | 2 - 7 files changed, 13 insertions(+), 119 deletions(-) delete mode 100644 src/plugins/qbsprojectmanager/qbsparser.cpp delete mode 100644 src/plugins/qbsprojectmanager/qbsparser.h diff --git a/src/plugins/qbsprojectmanager/CMakeLists.txt b/src/plugins/qbsprojectmanager/CMakeLists.txt index a754c922d7d..cbe09a5661c 100644 --- a/src/plugins/qbsprojectmanager/CMakeLists.txt +++ b/src/plugins/qbsprojectmanager/CMakeLists.txt @@ -15,7 +15,6 @@ add_qtc_plugin(QbsProjectManager qbskitinformation.cpp qbskitinformation.h qbsnodes.cpp qbsnodes.h qbsnodetreebuilder.cpp qbsnodetreebuilder.h - qbsparser.cpp qbsparser.h qbspmlogging.cpp qbspmlogging.h qbsprofilemanager.cpp qbsprofilemanager.h qbsprofilessettingspage.cpp qbsprofilessettingspage.h diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 2270598dd8e..038c8a1a6d1 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -26,7 +26,6 @@ #include "qbsbuildstep.h" #include "qbsbuildconfiguration.h" -#include "qbsparser.h" #include "qbsproject.h" #include "qbsprojectmanagerconstants.h" #include "qbssession.h" @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +60,6 @@ // -------------------------------------------------------------------- const char QBS_CONFIG[] = "Qbs.Configuration"; -const char QBS_DRY_RUN[] = "Qbs.DryRun"; const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing"; const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs"; const char QBS_SHOWCOMMANDLINES[] = "Qbs.ShowCommandLines"; @@ -170,17 +169,14 @@ bool QbsBuildStep::init() return false; delete m_parser; - m_parser = new Internal::QbsParser; - ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser(); - if (parser) - m_parser->appendOutputParser(parser); + m_parser = target()->kit()->createOutputParser(); + if (m_parser) + connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask); m_changedFiles = bc->changedFiles(); m_activeFileTags = bc->activeFileTags(); m_products = bc->products(); - connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask); - return true; } @@ -379,18 +375,22 @@ void QbsBuildStep::handleProcessResult( if (success && !hasOutput) return; - m_parser->setWorkingDirectory(workingDir); + if (m_parser) + m_parser->setWorkingDirectory(workingDir); emit addOutput(executable.toUserOutput() + ' ' + QtcProcess::joinArgs(arguments), OutputFormat::Stdout); for (const QString &line : stdErr) { - m_parser->handleStderr(line + '\n'); + if (m_parser) + m_parser->handleStderr(line + '\n'); emit addOutput(line, OutputFormat::Stderr); } for (const QString &line : stdOut) { - m_parser->handleStdout(line + '\n'); + if (m_parser) + m_parser->handleStdout(line + '\n'); emit addOutput(line, OutputFormat::Stdout); } - m_parser->flush(); + if (m_parser) + m_parser->flush(); } void QbsBuildStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index 3c5249dfb07..53ef60ed7e8 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -30,6 +30,7 @@ #include #include +namespace ProjectExplorer { class IOutputParser; } namespace Utils { class FancyLineEdit; } namespace QbsProjectManager { diff --git a/src/plugins/qbsprojectmanager/qbsparser.cpp b/src/plugins/qbsprojectmanager/qbsparser.cpp deleted file mode 100644 index abbe7600edc..00000000000 --- a/src/plugins/qbsprojectmanager/qbsparser.cpp +++ /dev/null @@ -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 - -#include - -#include -#include - -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 - diff --git a/src/plugins/qbsprojectmanager/qbsparser.h b/src/plugins/qbsprojectmanager/qbsparser.h deleted file mode 100644 index c5814dae972..00000000000 --- a/src/plugins/qbsprojectmanager/qbsparser.h +++ /dev/null @@ -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 - -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 diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index a03f4d4bb07..1d541089c9c 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -16,7 +16,6 @@ HEADERS = \ qbsinstallstep.h \ qbsnodes.h \ qbsnodetreebuilder.h \ - qbsparser.h \ qbspmlogging.h \ qbsprofilemanager.h \ qbsprofilessettingspage.h \ @@ -39,7 +38,6 @@ SOURCES = \ qbskitinformation.cpp \ qbsnodes.cpp \ qbsnodetreebuilder.cpp \ - qbsparser.cpp \ qbspmlogging.cpp \ qbsprofilemanager.cpp \ qbsprofilessettingspage.cpp \ diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index 9830c06efc9..197fcdc2998 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -40,8 +40,6 @@ QtcPlugin { "qbsnodes.h", "qbsnodetreebuilder.cpp", "qbsnodetreebuilder.h", - "qbsparser.cpp", - "qbsparser.h", "qbspmlogging.cpp", "qbspmlogging.h", "qbsprofilemanager.cpp",