forked from qt-creator/qt-creator
QbsProjectManager: Fine-tune project parse result handling.
And add some log output to help with debugging. Change-Id: I806aee8b34ee8d90bdd40fa8d9ac2cd313485c28 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
32
src/plugins/qbsprojectmanager/qbspmlogging.cpp
Normal file
32
src/plugins/qbsprojectmanager/qbspmlogging.cpp
Normal file
@@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
37
src/plugins/qbsprojectmanager/qbspmlogging.h
Normal file
37
src/plugins/qbsprojectmanager/qbspmlogging.h
Normal file
@@ -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 <QLoggingCategory>
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(qbsPmLog)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // Include guard
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "qbsbuildconfiguration.h"
|
#include "qbsbuildconfiguration.h"
|
||||||
#include "qbslogsink.h"
|
#include "qbslogsink.h"
|
||||||
|
#include "qbspmlogging.h"
|
||||||
#include "qbsprojectfile.h"
|
#include "qbsprojectfile.h"
|
||||||
#include "qbsprojectmanager.h"
|
#include "qbsprojectmanager.h"
|
||||||
#include "qbsprojectparser.h"
|
#include "qbsprojectparser.h"
|
||||||
@@ -176,11 +177,13 @@ static void collectFilesForProject(const qbs::ProjectData &project, QSet<QString
|
|||||||
QStringList QbsProject::files(Project::FilesMode fileMode) const
|
QStringList QbsProject::files(Project::FilesMode fileMode) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(fileMode);
|
Q_UNUSED(fileMode);
|
||||||
|
qCDebug(qbsPmLog) << Q_FUNC_INFO << m_qbsProject.isValid() << isParsing();
|
||||||
if (!m_qbsProject.isValid() || isParsing())
|
if (!m_qbsProject.isValid() || isParsing())
|
||||||
return QStringList();
|
return QStringList();
|
||||||
QSet<QString> result;
|
QSet<QString> result;
|
||||||
collectFilesForProject(m_projectData, result);
|
collectFilesForProject(m_projectData, result);
|
||||||
result.unite(m_qbsProject.buildSystemFiles());
|
result.unite(m_qbsProject.buildSystemFiles());
|
||||||
|
qCDebug(qbsPmLog) << "file count:" << result.count();
|
||||||
return result.toList();
|
return result.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,47 +434,55 @@ bool QbsProject::needsSpecialDeployment() const
|
|||||||
return true;
|
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()
|
void QbsProject::handleProjectStructureAvailable()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qbsProjectParser, return);
|
QTC_ASSERT(m_qbsProjectParser, return);
|
||||||
|
qCDebug(qbsPmLog) << "Project structure available";
|
||||||
|
|
||||||
|
if (checkCancelStatus())
|
||||||
|
return;
|
||||||
|
|
||||||
bool dataChanged = false;
|
|
||||||
m_qbsProject = m_qbsProjectParser->qbsProject();
|
m_qbsProject = m_qbsProjectParser->qbsProject();
|
||||||
const qbs::ProjectData &projectData = m_qbsProject.projectData();
|
QTC_ASSERT(m_qbsProject.isValid(), return);
|
||||||
QTC_CHECK(m_qbsProject.isValid());
|
|
||||||
|
|
||||||
if (projectData != m_projectData) {
|
const qbs::ProjectData &projectData = m_qbsProject.projectData();
|
||||||
|
if (projectData == m_projectData)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qCDebug(qbsPmLog) << "Project data changed.";
|
||||||
m_projectData = projectData;
|
m_projectData = projectData;
|
||||||
rootProjectNode()->update();
|
rootProjectNode()->update();
|
||||||
updateDocuments(m_qbsProject.isValid()
|
updateDocuments(QSet<QString>() << projectFilePath().toString());
|
||||||
? m_qbsProject.buildSystemFiles() : QSet<QString>() << projectFilePath().toString());
|
|
||||||
dataChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataChanged) {
|
|
||||||
auto * const futureInterface = m_qbsUpdateFutureInterface;
|
auto * const futureInterface = m_qbsUpdateFutureInterface;
|
||||||
m_qbsUpdateFutureInterface = nullptr; // So that isParsing() returns false;
|
m_qbsUpdateFutureInterface = nullptr; // So that isParsing() returns false;
|
||||||
updateCppCodeModel();
|
updateCppCodeModel();
|
||||||
updateQmlJsCodeModel();
|
updateQmlJsCodeModel();
|
||||||
emit fileListChanged();
|
emit fileListChanged();
|
||||||
m_qbsUpdateFutureInterface = futureInterface;
|
m_qbsUpdateFutureInterface = futureInterface;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsProject::handleQbsParsingDone(bool success)
|
void QbsProject::handleQbsParsingDone(bool success)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qbsProjectParser, return);
|
QTC_ASSERT(m_qbsProjectParser, return);
|
||||||
|
QTC_ASSERT(m_qbsUpdateFutureInterface, return);
|
||||||
|
|
||||||
const CancelStatus cancelStatus = m_cancelStatus;
|
qCDebug(qbsPmLog) << "Parsing done completely, success:" << success;
|
||||||
m_cancelStatus = CancelStatusNone;
|
|
||||||
|
|
||||||
// Start a new one parse operation right away, ignoring the old result.
|
if (checkCancelStatus())
|
||||||
if (cancelStatus == CancelStatusCancelingForReparse) {
|
|
||||||
m_qbsProjectParser->deleteLater();
|
|
||||||
m_qbsProjectParser = 0;
|
|
||||||
parseCurrentBuildConfiguration();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
generateErrors(m_qbsProjectParser->error());
|
generateErrors(m_qbsProjectParser->error());
|
||||||
|
|
||||||
@@ -484,15 +495,12 @@ void QbsProject::handleQbsParsingDone(bool success)
|
|||||||
|
|
||||||
m_qbsProjectParser->deleteLater();
|
m_qbsProjectParser->deleteLater();
|
||||||
m_qbsProjectParser = 0;
|
m_qbsProjectParser = 0;
|
||||||
|
|
||||||
if (m_qbsUpdateFutureInterface) {
|
|
||||||
m_qbsUpdateFutureInterface->reportFinished();
|
m_qbsUpdateFutureInterface->reportFinished();
|
||||||
delete m_qbsUpdateFutureInterface;
|
delete m_qbsUpdateFutureInterface;
|
||||||
m_qbsUpdateFutureInterface = 0;
|
m_qbsUpdateFutureInterface = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
updateBuildTargetData();
|
updateAfterBuild();
|
||||||
emit projectParsingDone(success);
|
emit projectParsingDone(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ private:
|
|||||||
void updateDeploymentInfo();
|
void updateDeploymentInfo();
|
||||||
void updateBuildTargetData();
|
void updateBuildTargetData();
|
||||||
void handleProjectStructureAvailable();
|
void handleProjectStructureAvailable();
|
||||||
|
bool checkCancelStatus();
|
||||||
void projectLoaded() override;
|
void projectLoaded() override;
|
||||||
|
|
||||||
static bool ensureWriteableQbsFile(const QString &file);
|
static bool ensureWriteableQbsFile(const QString &file);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ HEADERS = \
|
|||||||
qbslogsink.h \
|
qbslogsink.h \
|
||||||
qbsnodes.h \
|
qbsnodes.h \
|
||||||
qbsparser.h \
|
qbsparser.h \
|
||||||
|
qbspmlogging.h \
|
||||||
qbsprofilessettingspage.h \
|
qbsprofilessettingspage.h \
|
||||||
qbsproject.h \
|
qbsproject.h \
|
||||||
qbsprojectfile.h \
|
qbsprojectfile.h \
|
||||||
@@ -56,6 +57,7 @@ SOURCES = \
|
|||||||
qbslogsink.cpp \
|
qbslogsink.cpp \
|
||||||
qbsnodes.cpp \
|
qbsnodes.cpp \
|
||||||
qbsparser.cpp \
|
qbsparser.cpp \
|
||||||
|
qbspmlogging.cpp \
|
||||||
qbsprofilessettingspage.cpp \
|
qbsprofilessettingspage.cpp \
|
||||||
qbsproject.cpp \
|
qbsproject.cpp \
|
||||||
qbsprojectfile.cpp \
|
qbsprojectfile.cpp \
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ QtcPlugin {
|
|||||||
"qbsnodes.h",
|
"qbsnodes.h",
|
||||||
"qbsparser.cpp",
|
"qbsparser.cpp",
|
||||||
"qbsparser.h",
|
"qbsparser.h",
|
||||||
|
"qbspmlogging.cpp",
|
||||||
|
"qbspmlogging.h",
|
||||||
"qbsprofilessettingspage.cpp",
|
"qbsprofilessettingspage.cpp",
|
||||||
"qbsprofilessettingspage.h",
|
"qbsprofilessettingspage.h",
|
||||||
"qbsprofilessettingswidget.ui",
|
"qbsprofilessettingswidget.ui",
|
||||||
|
|||||||
Reference in New Issue
Block a user