forked from qt-creator/qt-creator
CMake: Handle deletion of builddir better
Change-Id: Ifeb35b14aba05c0e23a027b71f185ba20eed3e55 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -48,7 +48,6 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// Helper:
|
// Helper:
|
||||||
@@ -107,9 +106,13 @@ BuildDirManager::BuildDirManager(const Utils::FileName &sourceDir, const Project
|
|||||||
QTC_CHECK(!m_buildDir.isEmpty());
|
QTC_CHECK(!m_buildDir.isEmpty());
|
||||||
QTC_CHECK(k);
|
QTC_CHECK(k);
|
||||||
|
|
||||||
|
m_reparseTimer.setSingleShot(true);
|
||||||
|
m_reparseTimer.setInterval(500);
|
||||||
|
connect(&m_reparseTimer, &QTimer::timeout, this, &BuildDirManager::forceReparse);
|
||||||
|
|
||||||
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, [this]() {
|
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, [this]() {
|
||||||
if (!isBusy())
|
if (!isBusy())
|
||||||
forceReparse();
|
m_reparseTimer.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
QTimer::singleShot(0, this, &BuildDirManager::parse);
|
QTimer::singleShot(0, this, &BuildDirManager::parse);
|
||||||
@@ -129,6 +132,12 @@ bool BuildDirManager::isBusy() const
|
|||||||
|
|
||||||
void BuildDirManager::forceReparse()
|
void BuildDirManager::forceReparse()
|
||||||
{
|
{
|
||||||
|
if (isBusy()) {
|
||||||
|
m_cmakeProcess->disconnect();
|
||||||
|
m_cmakeProcess->deleteLater();
|
||||||
|
m_cmakeProcess = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
|
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
|
||||||
const QString generator = CMakeGeneratorKitInformation::generator(m_kit);
|
const QString generator = CMakeGeneratorKitInformation::generator(m_kit);
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QTemporaryDir);
|
QT_FORWARD_DECLARE_CLASS(QTemporaryDir);
|
||||||
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
|
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
|
||||||
@@ -117,6 +118,8 @@ private:
|
|||||||
// For error reporting:
|
// For error reporting:
|
||||||
ProjectExplorer::IOutputParser *m_parser = nullptr;
|
ProjectExplorer::IOutputParser *m_parser = nullptr;
|
||||||
QFutureInterface<void> *m_future = nullptr;
|
QFutureInterface<void> *m_future = nullptr;
|
||||||
|
|
||||||
|
QTimer m_reparseTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user