diff --git a/src/plugins/qbsprojectmanager/qbspmlogging.cpp b/src/plugins/qbsprojectmanager/qbspmlogging.cpp new file mode 100644 index 00000000000..e630981b296 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbspmlogging.cpp @@ -0,0 +1,32 @@ +/**************************************************************************** +** +** 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 "qbspmlogging.h" + +namespace QbsProjectManager { +namespace Internal { +Q_LOGGING_CATEGORY(qbsPmLog, "qtc.qbspm") +} +} diff --git a/src/plugins/qbsprojectmanager/qbspmlogging.h b/src/plugins/qbsprojectmanager/qbspmlogging.h new file mode 100644 index 00000000000..471fa86cf3f --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbspmlogging.h @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#ifndef QBSPMLOGGING_P_H +#define QBSPMLOGGING_P_H + +#include + +namespace QbsProjectManager { +namespace Internal { +Q_DECLARE_LOGGING_CATEGORY(qbsPmLog) +} +} + +#endif // Include guard diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 326340085e8..8e8c0cc9509 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -27,6 +27,7 @@ #include "qbsbuildconfiguration.h" #include "qbslogsink.h" +#include "qbspmlogging.h" #include "qbsprojectfile.h" #include "qbsprojectmanager.h" #include "qbsprojectparser.h" @@ -176,11 +177,13 @@ static void collectFilesForProject(const qbs::ProjectData &project, QSet result; collectFilesForProject(m_projectData, result); result.unite(m_qbsProject.buildSystemFiles()); + qCDebug(qbsPmLog) << "file count:" << result.count(); return result.toList(); } @@ -431,47 +434,55 @@ bool QbsProject::needsSpecialDeployment() const return true; } +bool QbsProject::checkCancelStatus() +{ + const CancelStatus cancelStatus = m_cancelStatus; + m_cancelStatus = CancelStatusNone; + if (cancelStatus != CancelStatusCancelingForReparse) + return false; + qCDebug(qbsPmLog) << "Cancel request while parsing, starting re-parse"; + m_qbsProjectParser->deleteLater(); + m_qbsProjectParser = 0; + parseCurrentBuildConfiguration(); + return true; +} + void QbsProject::handleProjectStructureAvailable() { QTC_ASSERT(m_qbsProjectParser, return); + qCDebug(qbsPmLog) << "Project structure available"; + + if (checkCancelStatus()) + return; - bool dataChanged = false; m_qbsProject = m_qbsProjectParser->qbsProject(); + QTC_ASSERT(m_qbsProject.isValid(), return); + const qbs::ProjectData &projectData = m_qbsProject.projectData(); - QTC_CHECK(m_qbsProject.isValid()); + if (projectData == m_projectData) + return; - if (projectData != m_projectData) { - m_projectData = projectData; - rootProjectNode()->update(); - updateDocuments(m_qbsProject.isValid() - ? m_qbsProject.buildSystemFiles() : QSet() << projectFilePath().toString()); - dataChanged = true; - } - - if (dataChanged) { - auto * const futureInterface = m_qbsUpdateFutureInterface; - m_qbsUpdateFutureInterface = nullptr; // So that isParsing() returns false; - updateCppCodeModel(); - updateQmlJsCodeModel(); - emit fileListChanged(); - m_qbsUpdateFutureInterface = futureInterface; - } + qCDebug(qbsPmLog) << "Project data changed."; + m_projectData = projectData; + rootProjectNode()->update(); + updateDocuments(QSet() << projectFilePath().toString()); + auto * const futureInterface = m_qbsUpdateFutureInterface; + m_qbsUpdateFutureInterface = nullptr; // So that isParsing() returns false; + updateCppCodeModel(); + updateQmlJsCodeModel(); + emit fileListChanged(); + m_qbsUpdateFutureInterface = futureInterface; } void QbsProject::handleQbsParsingDone(bool success) { QTC_ASSERT(m_qbsProjectParser, return); + QTC_ASSERT(m_qbsUpdateFutureInterface, return); - const CancelStatus cancelStatus = m_cancelStatus; - m_cancelStatus = CancelStatusNone; + qCDebug(qbsPmLog) << "Parsing done completely, success:" << success; - // Start a new one parse operation right away, ignoring the old result. - if (cancelStatus == CancelStatusCancelingForReparse) { - m_qbsProjectParser->deleteLater(); - m_qbsProjectParser = 0; - parseCurrentBuildConfiguration(); + if (checkCancelStatus()) return; - } generateErrors(m_qbsProjectParser->error()); @@ -484,15 +495,12 @@ void QbsProject::handleQbsParsingDone(bool success) m_qbsProjectParser->deleteLater(); m_qbsProjectParser = 0; - - if (m_qbsUpdateFutureInterface) { - m_qbsUpdateFutureInterface->reportFinished(); - delete m_qbsUpdateFutureInterface; - m_qbsUpdateFutureInterface = 0; - } + m_qbsUpdateFutureInterface->reportFinished(); + delete m_qbsUpdateFutureInterface; + m_qbsUpdateFutureInterface = 0; if (success) - updateBuildTargetData(); + updateAfterBuild(); emit projectParsingDone(success); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index cd102b735c9..a132910184b 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -137,6 +137,7 @@ private: void updateDeploymentInfo(); void updateBuildTargetData(); void handleProjectStructureAvailable(); + bool checkCancelStatus(); void projectLoaded() override; static bool ensureWriteableQbsFile(const QString &file); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index 395908d7405..cd2e5d16d83 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -31,6 +31,7 @@ HEADERS = \ qbslogsink.h \ qbsnodes.h \ qbsparser.h \ + qbspmlogging.h \ qbsprofilessettingspage.h \ qbsproject.h \ qbsprojectfile.h \ @@ -56,6 +57,7 @@ SOURCES = \ qbslogsink.cpp \ qbsnodes.cpp \ qbsparser.cpp \ + qbspmlogging.cpp \ qbsprofilessettingspage.cpp \ qbsproject.cpp \ qbsprojectfile.cpp \ diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index 9965e489800..0de3d568cbd 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -90,6 +90,8 @@ QtcPlugin { "qbsnodes.h", "qbsparser.cpp", "qbsparser.h", + "qbspmlogging.cpp", + "qbspmlogging.h", "qbsprofilessettingspage.cpp", "qbsprofilessettingspage.h", "qbsprofilessettingswidget.ui",