implement simple VFS to support caching during project parsing

this tremendously speeds up loading of qt 5.1 based projects (including
qt itself) under mac os, as these look up the sdk dynamically, and use
caching to avoid doing that in every subproject.

Change-Id: I833253f81c3159056fab2ff888f293b36cc2ef56
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Oswald Buddenhagen
2013-05-29 20:18:51 +02:00
parent 571234786a
commit 66802ef8bf
20 changed files with 365 additions and 91 deletions

View File

@@ -46,6 +46,7 @@
#include <coreplugin/documentmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <qmljstools/qmljsmodelmanager.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/toolchain.h>
@@ -53,6 +54,7 @@
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmacroexpander.h>
#include <proparser/qmakevfs.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/qtkitinformation.h>
@@ -344,6 +346,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_nodesWatcher(new Internal::Qt4NodesWatcher(this)),
m_fileInfo(new Qt4ProjectFile(fileName, this)),
m_projectFiles(new Qt4ProjectFiles),
m_qmakeVfs(new QMakeVfs),
m_qmakeGlobals(0),
m_asyncUpdateFutureInterface(0),
m_pendingEvaluateFuturesCount(0),
@@ -358,6 +361,10 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(3000);
connect(&m_asyncUpdateTimer, SIGNAL(timeout()), this, SLOT(asyncUpdate()));
connect(ProjectExplorerPlugin::instance()->buildManager(),
SIGNAL(buildQueueFinished(bool)),
SLOT(buildFinished(bool)));
}
Qt4Project::~Qt4Project()
@@ -365,6 +372,7 @@ Qt4Project::~Qt4Project()
m_codeModelFuture.cancel();
m_asyncUpdateState = ShuttingDown;
m_manager->unregisterProject(this);
delete m_qmakeVfs;
delete m_projectFiles;
m_cancelEvaluate = true;
// Deleting the root node triggers a few things, make sure rootProjectNode
@@ -847,6 +855,9 @@ void Qt4Project::asyncUpdate()
{
if (debug)
qDebug()<<"async update, timer expired, doing now";
m_qmakeVfs->invalidateCache();
Q_ASSERT(!m_asyncUpdateFutureInterface);
m_asyncUpdateFutureInterface = new QFutureInterface<void>();
@@ -877,6 +888,12 @@ void Qt4Project::asyncUpdate()
m_asyncUpdateState = AsyncUpdateInProgress;
}
void Qt4Project::buildFinished(bool success)
{
if (success)
m_qmakeVfs->invalidateContents();
}
ProjectExplorer::IProjectManager *Qt4Project::projectManager() const
{
return m_manager;
@@ -1002,7 +1019,7 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(const Qt4ProFileNode *
}
++m_qmakeGlobalsRefCnt;
QtSupport::ProFileReader *reader = new QtSupport::ProFileReader(m_qmakeGlobals);
QtSupport::ProFileReader *reader = new QtSupport::ProFileReader(m_qmakeGlobals, m_qmakeVfs);
reader->setOutputDir(qt4ProFileNode->buildDir());