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 /////////
|
||||
|
||||
uint QMakeEvaluator::getBlockLen(const ushort *&tokPtr)
|
||||
@@ -858,6 +865,10 @@ void QMakeEvaluator::prepareProject()
|
||||
|
||||
void QMakeEvaluator::loadSpec()
|
||||
{
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
m_cumulative = false;
|
||||
#endif
|
||||
|
||||
QString qmakespec = m_option->expandEnvVars(m_option->qmakespec);
|
||||
if (qmakespec.isEmpty())
|
||||
qmakespec = QLatin1String("default");
|
||||
@@ -935,43 +946,28 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
QThreadPool::globalInstance()->reserveThread();
|
||||
} else
|
||||
#endif
|
||||
if (m_option->base_valuemap.isEmpty()) {
|
||||
if (!m_option->base_eval) {
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
m_option->base_inProgress = true;
|
||||
locker.unlock();
|
||||
#endif
|
||||
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
bool cumulative = m_cumulative;
|
||||
m_cumulative = false;
|
||||
#endif
|
||||
|
||||
prepareProject();
|
||||
|
||||
loadSpec();
|
||||
|
||||
m_option->base_valuemap = m_valuemapStack.top();
|
||||
m_option->base_functions = m_functionDefs;
|
||||
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
m_cumulative = cumulative;
|
||||
#endif
|
||||
m_option->base_eval = new QMakeEvaluator(m_option, m_parser, m_handler);
|
||||
m_option->base_eval->loadSpec();
|
||||
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
locker.relock();
|
||||
m_option->base_inProgress = false;
|
||||
m_option->cond.wakeAll();
|
||||
#endif
|
||||
goto fresh;
|
||||
}
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
}
|
||||
#endif
|
||||
|
||||
m_valuemapStack.top() = m_option->base_valuemap;
|
||||
m_functionDefs = m_option->base_functions;
|
||||
|
||||
fresh: ;
|
||||
initFrom(*m_option->base_eval);
|
||||
}
|
||||
|
||||
m_handler->aboutToEval(currentProFile(), pro, type);
|
||||
@@ -1441,8 +1437,7 @@ bool QMakeEvaluator::modesForGenerator(const QString &gen,
|
||||
void QMakeEvaluator::validateModes() const
|
||||
{
|
||||
if (m_option->target_mode == QMakeGlobals::TARG_UNKNOWN_MODE) {
|
||||
const ProValueMap &vals =
|
||||
m_option->base_valuemap.isEmpty() ? m_valuemapStack[0] : m_option->base_valuemap;
|
||||
const ProValueMap &vals = m_valuemapStack[0];
|
||||
QMakeGlobals::TARG_MODE target_mode;
|
||||
const ProStringList &gen = vals.value(ProString("MAKEFILE_GENERATOR"));
|
||||
if (gen.isEmpty()) {
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
|
||||
void prepareProject();
|
||||
void loadSpec();
|
||||
void initFrom(const QMakeEvaluator &other);
|
||||
void visitCmdLine(const QString &cmds);
|
||||
VisitReturn visitProFile(ProFile *pro, QMakeHandler::EvalFileType type,
|
||||
LoadFlags flags);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "qmakeglobals.h"
|
||||
|
||||
#include "qmakeevaluator.h"
|
||||
#include "ioutils.h"
|
||||
|
||||
#include <QByteArray>
|
||||
@@ -109,10 +110,12 @@ QMakeGlobals::QMakeGlobals()
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
base_inProgress = false;
|
||||
#endif
|
||||
base_eval = 0;
|
||||
}
|
||||
|
||||
QMakeGlobals::~QMakeGlobals()
|
||||
{
|
||||
delete base_eval;
|
||||
}
|
||||
|
||||
void QMakeGlobals::setCommandLineArguments(const QStringList &args)
|
||||
|
||||
@@ -80,8 +80,6 @@ private:
|
||||
QString getEnv(const QString &) 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;
|
||||
QString qmakespec_name;
|
||||
QString precmds, postcmds;
|
||||
@@ -93,6 +91,7 @@ private:
|
||||
QWaitCondition cond;
|
||||
bool base_inProgress;
|
||||
#endif
|
||||
QMakeEvaluator *base_eval;
|
||||
|
||||
friend class QMakeEvaluator;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user