forked from qt-creator/qt-creator
revamp maintenance of base values (qmakespec+cache)
instantiate a complete evaluator instead of having just vars and functions in the option object. that's cleaner. Change-Id: I0ecd98307832ed072cebfd5b535572f7dcb103c1 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -171,6 +171,13 @@ QMakeEvaluator::~QMakeEvaluator()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMakeEvaluator::initFrom(const QMakeEvaluator &other)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(&other, "QMakeEvaluator::visitProFile", "Project not prepared");
|
||||||
|
m_functionDefs = other.m_functionDefs;
|
||||||
|
m_valuemapStack = other.m_valuemapStack;
|
||||||
|
}
|
||||||
|
|
||||||
//////// Evaluator tools /////////
|
//////// Evaluator tools /////////
|
||||||
|
|
||||||
uint QMakeEvaluator::getBlockLen(const ushort *&tokPtr)
|
uint QMakeEvaluator::getBlockLen(const ushort *&tokPtr)
|
||||||
@@ -858,6 +865,10 @@ void QMakeEvaluator::prepareProject()
|
|||||||
|
|
||||||
void QMakeEvaluator::loadSpec()
|
void QMakeEvaluator::loadSpec()
|
||||||
{
|
{
|
||||||
|
#ifdef PROEVALUATOR_CUMULATIVE
|
||||||
|
m_cumulative = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
QString qmakespec = m_option->expandEnvVars(m_option->qmakespec);
|
QString qmakespec = m_option->expandEnvVars(m_option->qmakespec);
|
||||||
if (qmakespec.isEmpty())
|
if (qmakespec.isEmpty())
|
||||||
qmakespec = QLatin1String("default");
|
qmakespec = QLatin1String("default");
|
||||||
@@ -935,43 +946,28 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
|||||||
QThreadPool::globalInstance()->reserveThread();
|
QThreadPool::globalInstance()->reserveThread();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (m_option->base_valuemap.isEmpty()) {
|
if (!m_option->base_eval) {
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
m_option->base_inProgress = true;
|
m_option->base_inProgress = true;
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_CUMULATIVE
|
|
||||||
bool cumulative = m_cumulative;
|
|
||||||
m_cumulative = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
prepareProject();
|
prepareProject();
|
||||||
|
|
||||||
loadSpec();
|
m_option->base_eval = new QMakeEvaluator(m_option, m_parser, m_handler);
|
||||||
|
m_option->base_eval->loadSpec();
|
||||||
m_option->base_valuemap = m_valuemapStack.top();
|
|
||||||
m_option->base_functions = m_functionDefs;
|
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_CUMULATIVE
|
|
||||||
m_cumulative = cumulative;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
locker.relock();
|
locker.relock();
|
||||||
m_option->base_inProgress = false;
|
m_option->base_inProgress = false;
|
||||||
m_option->cond.wakeAll();
|
m_option->cond.wakeAll();
|
||||||
#endif
|
#endif
|
||||||
goto fresh;
|
|
||||||
}
|
}
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_valuemapStack.top() = m_option->base_valuemap;
|
initFrom(*m_option->base_eval);
|
||||||
m_functionDefs = m_option->base_functions;
|
|
||||||
|
|
||||||
fresh: ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_handler->aboutToEval(currentProFile(), pro, type);
|
m_handler->aboutToEval(currentProFile(), pro, type);
|
||||||
@@ -1441,8 +1437,7 @@ bool QMakeEvaluator::modesForGenerator(const QString &gen,
|
|||||||
void QMakeEvaluator::validateModes() const
|
void QMakeEvaluator::validateModes() const
|
||||||
{
|
{
|
||||||
if (m_option->target_mode == QMakeGlobals::TARG_UNKNOWN_MODE) {
|
if (m_option->target_mode == QMakeGlobals::TARG_UNKNOWN_MODE) {
|
||||||
const ProValueMap &vals =
|
const ProValueMap &vals = m_valuemapStack[0];
|
||||||
m_option->base_valuemap.isEmpty() ? m_valuemapStack[0] : m_option->base_valuemap;
|
|
||||||
QMakeGlobals::TARG_MODE target_mode;
|
QMakeGlobals::TARG_MODE target_mode;
|
||||||
const ProStringList &gen = vals.value(ProString("MAKEFILE_GENERATOR"));
|
const ProStringList &gen = vals.value(ProString("MAKEFILE_GENERATOR"));
|
||||||
if (gen.isEmpty()) {
|
if (gen.isEmpty()) {
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ public:
|
|||||||
|
|
||||||
void prepareProject();
|
void prepareProject();
|
||||||
void loadSpec();
|
void loadSpec();
|
||||||
|
void initFrom(const QMakeEvaluator &other);
|
||||||
void visitCmdLine(const QString &cmds);
|
void visitCmdLine(const QString &cmds);
|
||||||
VisitReturn visitProFile(ProFile *pro, QMakeHandler::EvalFileType type,
|
VisitReturn visitProFile(ProFile *pro, QMakeHandler::EvalFileType type,
|
||||||
LoadFlags flags);
|
LoadFlags flags);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "qmakeglobals.h"
|
#include "qmakeglobals.h"
|
||||||
|
|
||||||
|
#include "qmakeevaluator.h"
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@@ -109,10 +110,12 @@ QMakeGlobals::QMakeGlobals()
|
|||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
base_inProgress = false;
|
base_inProgress = false;
|
||||||
#endif
|
#endif
|
||||||
|
base_eval = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMakeGlobals::~QMakeGlobals()
|
QMakeGlobals::~QMakeGlobals()
|
||||||
{
|
{
|
||||||
|
delete base_eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeGlobals::setCommandLineArguments(const QStringList &args)
|
void QMakeGlobals::setCommandLineArguments(const QStringList &args)
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ private:
|
|||||||
QString getEnv(const QString &) const;
|
QString getEnv(const QString &) const;
|
||||||
QStringList getPathListEnv(const QString &var) const;
|
QStringList getPathListEnv(const QString &var) const;
|
||||||
|
|
||||||
ProValueMap base_valuemap; // Cached results of qmake.conf, .qmake.cache & default_pre.prf
|
|
||||||
ProFunctionDefs base_functions;
|
|
||||||
QStringList feature_roots;
|
QStringList feature_roots;
|
||||||
QString qmakespec_name;
|
QString qmakespec_name;
|
||||||
QString precmds, postcmds;
|
QString precmds, postcmds;
|
||||||
@@ -93,6 +91,7 @@ private:
|
|||||||
QWaitCondition cond;
|
QWaitCondition cond;
|
||||||
bool base_inProgress;
|
bool base_inProgress;
|
||||||
#endif
|
#endif
|
||||||
|
QMakeEvaluator *base_eval;
|
||||||
|
|
||||||
friend class QMakeEvaluator;
|
friend class QMakeEvaluator;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user