Commit cb068421 authored by Daniel Teske's avatar Daniel Teske

QmakeProject: Make initial parse use the async parsing

Task-number: QTCREATORBUG-12123
Change-Id: I79dcd684fe826108189db521c392c0f1d7632f88
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 742e14f1
......@@ -1750,14 +1750,6 @@ EvalInput QmakeProFileNode::evalInput() const
return input;
}
void QmakeProFileNode::update()
{
setParseInProgressRecursive(true);
setupReader();
EvalResult *evalResult = evaluate(evalInput());
applyEvaluate(evalResult, false);
}
void QmakeProFileNode::setupReader()
{
Q_ASSERT(!m_readerExact);
......@@ -2005,7 +1997,7 @@ void QmakeProFileNode::asyncEvaluate(QFutureInterface<EvalResult *> &fi, EvalInp
void QmakeProFileNode::applyAsyncEvaluate()
{
applyEvaluate(m_parseFutureWatcher.result(), true);
applyEvaluate(m_parseFutureWatcher.result());
m_project->decrementPendingEvaluateFutures();
}
......@@ -2014,7 +2006,7 @@ bool sortByNodes(Node *a, Node *b)
return a->path() < b->path();
}
void QmakeProFileNode::applyEvaluate(EvalResult *evalResult, bool async)
void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
{
QScopedPointer<EvalResult> result(evalResult);
if (!m_readerExact)
......@@ -2175,10 +2167,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult, bool async)
// So to compare that later parse with the sync one
QmakeProFileNode *proFileNode = static_cast<QmakeProFileNode *>(*existingIt);
proFileNode->setIncludedInExactParse(result->exactSubdirs.contains(proFileNode->path()) && includedInExactParse());
if (async)
proFileNode->asyncUpdate();
else
proFileNode->update();
proFileNode->asyncUpdate();
}
++existingIt;
// newCumalativeIt and newExactIt are already incremented
......@@ -2211,10 +2200,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult, bool async)
QmakeProFileNode *qmakeProFileNode = new QmakeProFileNode(m_project, nodeToAdd);
qmakeProFileNode->setParentFolderNode(this); // Needed for loop detection
qmakeProFileNode->setIncludedInExactParse(result->exactSubdirs.contains(qmakeProFileNode->path()) && includedInExactParse());
if (async)
qmakeProFileNode->asyncUpdate();
else
qmakeProFileNode->update();
qmakeProFileNode->asyncUpdate();
toAdd << qmakeProFileNode;
}
}
......
......@@ -416,7 +416,6 @@ public:
bool isDeployable() const;
QString resolvedMkspecPath() const;
void update();
void scheduleUpdate();
bool validParse() const;
......@@ -442,7 +441,7 @@ private:
Internal::EvalInput evalInput() const;
static Internal::EvalResult *evaluate(const Internal::EvalInput &input);
void applyEvaluate(Internal::EvalResult *parseResult, bool async);
void applyEvaluate(Internal::EvalResult *parseResult);
void asyncEvaluate(QFutureInterface<Internal::EvalResult *> &fi, Internal::EvalInput input);
......
......@@ -346,10 +346,11 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
m_qmakeGlobalsRefCnt(0),
m_asyncUpdateFutureInterface(0),
m_pendingEvaluateFuturesCount(0),
m_asyncUpdateState(NoState),
m_asyncUpdateState(Base),
m_cancelEvaluate(false),
m_centralizedFolderWatcher(0),
m_activeTarget(0)
m_activeTarget(0),
m_checkForTemplateUpdate(true)
{
setId(Constants::QMAKEPROJECT_ID);
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
......@@ -357,7 +358,7 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
setRequiredKitMatcher(QtSupport::QtKitInformation::qtVersionMatcher());
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(3000);
m_asyncUpdateTimer.setInterval(0); // will be increased after first parse
connect(&m_asyncUpdateTimer, SIGNAL(timeout()), this, SLOT(asyncUpdate()));
connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)),
......@@ -412,18 +413,10 @@ bool QmakeProject::fromMap(const QVariantMap &map)
m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath(), this);
m_rootProjectNode->registerWatcher(m_nodesWatcher);
update();
updateFileList();
// This might be incorrect, need a full update
updateCodeModels();
// We have the profile nodes now, so we know the runconfigs!
connect(m_nodesWatcher, SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
this, SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
// Now we emit update once :)
m_rootProjectNode->emitProFileUpdatedRecursive();
// On active buildconfiguration changes, reevaluate the .pro files
m_activeTarget = activeTarget();
if (m_activeTarget)
......@@ -433,17 +426,8 @@ bool QmakeProject::fromMap(const QVariantMap &map)
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetWasChanged()));
// // Update boiler plate code for subprojects.
QtQuickApp qtQuickApp;
foreach (QmakeProFileNode *node, applicationProFiles(QmakeProject::ExactAndCumulativeParse)) {
const QString path = node->path();
foreach (TemplateInfo info, QtQuickApp::templateInfos()) {
qtQuickApp.setTemplateInfo(info);
updateBoilerPlateCodeFiles(&qtQuickApp, path);
}
}
scheduleAsyncUpdate();
m_asyncUpdateTimer.setInterval(3000);
return true;
}
......@@ -674,26 +658,6 @@ void QmakeProject::updateQmlJSCodeModel()
modelManager->updateProjectInfo(projectInfo, this);
}
///*!
// Updates complete project
// */
void QmakeProject::update()
{
if (debug)
qDebug()<<"Doing sync update";
m_rootProjectNode->update();
if (debug)
qDebug()<<"State is now Base";
m_asyncUpdateState = Base;
enableActiveQmakeBuildConfiguration(activeTarget(), true);
updateBuildSystemData();
if (activeTarget())
activeTarget()->updateDefaultDeployConfigurations();
updateRunConfigurations();
emit proFilesEvaluated();
}
void QmakeProject::updateRunConfigurations()
{
if (activeTarget())
......@@ -707,7 +671,6 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node)
if (debug)
qDebug()<<"schduleAsyncUpdate (node)"<<node->path();
Q_ASSERT(m_asyncUpdateState != NoState);
if (m_cancelEvaluate) {
if (debug)
......@@ -779,7 +742,6 @@ void QmakeProject::scheduleAsyncUpdate()
if (m_asyncUpdateState == ShuttingDown)
return;
Q_ASSERT(m_asyncUpdateState != NoState);
if (m_cancelEvaluate) { // we are in progress of canceling
// and will start the evaluation after that
if (debug)
......@@ -858,6 +820,22 @@ void QmakeProject::decrementPendingEvaluateFutures()
if (debug)
qDebug()<<" Setting state to Base";
}
if (m_checkForTemplateUpdate) {
// Update boiler plate code for subprojects.
QtQuickApp qtQuickApp;
foreach (QmakeProFileNode *node, applicationProFiles(QmakeProject::ExactAndCumulativeParse)) {
const QString path = node->path();
foreach (TemplateInfo info, QtQuickApp::templateInfos()) {
qtQuickApp.setTemplateInfo(info);
updateBoilerPlateCodeFiles(&qtQuickApp, path);
}
}
m_checkForTemplateUpdate = false;
}
}
}
......@@ -1210,9 +1188,8 @@ void QmakeProject::notifyChanged(const QString &name)
findProFile(name, rootQmakeProjectNode(), list);
foreach (QmakeProFileNode *node, list) {
QtSupport::ProFileCacheManager::instance()->discardFile(name);
node->update();
node->scheduleUpdate();
}
updateFileList();
}
}
......
......@@ -149,7 +149,6 @@ signals:
public slots:
void scheduleAsyncUpdate();
void update();
protected:
bool fromMap(const QVariantMap &map);
......@@ -203,7 +202,7 @@ private:
QTimer m_asyncUpdateTimer;
QFutureInterface<void> *m_asyncUpdateFutureInterface;
int m_pendingEvaluateFuturesCount;
enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState m_asyncUpdateState;
bool m_cancelEvaluate;
QList<QmakeProFileNode *> m_partialEvaluate;
......@@ -213,6 +212,7 @@ private:
Internal::CentralizedFolderWatcher *m_centralizedFolderWatcher;
ProjectExplorer::Target *m_activeTarget;
bool m_checkForTemplateUpdate; // initialized to true, set to false after first parse
friend class Internal::QmakeProjectFile;
friend class Internal::QmakeProjectConfigWidget;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment