forked from qt-creator/qt-creator
move LoadFlags to QMakeEvaluator
Change-Id: I931bce3aaf1ccaaacf586ca54b93659485b79372 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -145,7 +145,7 @@ void S60PublisherOvi::completeCreation()
|
||||
//m_reader->setCumulative(false); // todo need to reenable that, after fixing parsing for symbian scopes
|
||||
|
||||
ProFile *profile = m_reader->parsedProFile(m_qt4project->rootProjectNode()->path());
|
||||
m_reader->accept(profile, ProFileEvaluator::LoadProOnly);
|
||||
m_reader->accept(profile, QMakeEvaluator::LoadProOnly);
|
||||
profile->deref();
|
||||
|
||||
// set up process for creating the resulting SIS files
|
||||
|
||||
@@ -1690,9 +1690,9 @@ Qt4ProFileNode::EvalResult Qt4ProFileNode::evaluate()
|
||||
{
|
||||
EvalResult evalResult = EvalOk;
|
||||
if (ProFile *pro = m_readerExact->parsedProFile(m_projectFilePath)) {
|
||||
if (!m_readerExact->accept(pro, ProFileEvaluator::LoadAll))
|
||||
if (!m_readerExact->accept(pro, QMakeEvaluator::LoadAll))
|
||||
evalResult = EvalPartial;
|
||||
if (!m_readerCumulative->accept(pro, ProFileEvaluator::LoadPreFiles))
|
||||
if (!m_readerCumulative->accept(pro, QMakeEvaluator::LoadPreFiles))
|
||||
evalResult = EvalFail;
|
||||
pro->deref();
|
||||
} else {
|
||||
|
||||
@@ -727,7 +727,7 @@ void BaseQtVersion::ensureMkSpecParsed() const
|
||||
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
||||
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
||||
evaluator.setCumulative(false);
|
||||
evaluator.accept(pro, ProFileEvaluator::LoadProOnly);
|
||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
||||
pro->deref();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
||||
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
||||
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
|
||||
evaluator.setCumulative(false);
|
||||
evaluator.accept(pro, ProFileEvaluator::LoadProOnly);
|
||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
||||
pro->deref();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "profileevaluator.h"
|
||||
|
||||
#include "qmakeevaluator.h"
|
||||
#include "ioutils.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -186,7 +185,7 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
|
||||
return TT_Unknown;
|
||||
}
|
||||
|
||||
bool ProFileEvaluator::accept(ProFile *pro, LoadFlags flags)
|
||||
bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||
{
|
||||
return d->visitProFile(pro, QMakeEvaluatorHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define PROFILEEVALUATOR_H
|
||||
|
||||
#include "qmake_global.h"
|
||||
#include "qmakeevaluator.h"
|
||||
#include "proitems.h"
|
||||
|
||||
#include <QHash>
|
||||
@@ -70,14 +71,7 @@ public:
|
||||
#endif
|
||||
void setOutputDir(const QString &dir); // Default is empty
|
||||
|
||||
enum LoadFlag {
|
||||
LoadProOnly = 0,
|
||||
LoadPreFiles = 1,
|
||||
LoadPostFiles = 2,
|
||||
LoadAll = LoadPreFiles|LoadPostFiles
|
||||
};
|
||||
Q_DECLARE_FLAGS(LoadFlags, LoadFlag)
|
||||
bool accept(ProFile *pro, LoadFlags flags = LoadAll);
|
||||
bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags = QMakeEvaluator::LoadAll);
|
||||
|
||||
bool contains(const QString &variableName) const;
|
||||
QString value(const QString &variableName) const;
|
||||
@@ -97,8 +91,6 @@ private:
|
||||
friend class QMakeEvaluator;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ProFileEvaluator::LoadFlags)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PROFILEEVALUATOR_H
|
||||
|
||||
@@ -30,12 +30,11 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "profileevaluator.h"
|
||||
#include "qmakeevaluator.h"
|
||||
|
||||
#include "qmakeevaluator_p.h"
|
||||
#include "qmakeglobals.h"
|
||||
#include "qmakeparser.h"
|
||||
#include "qmakeevaluator.h"
|
||||
#include "qmakeevaluator_p.h"
|
||||
#include "ioutils.h"
|
||||
|
||||
#include <QByteArray>
|
||||
@@ -992,8 +991,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
fn.detach();
|
||||
bool ok;
|
||||
if (parseInto.isEmpty()) {
|
||||
ok = evaluateFile(fn, QMakeEvaluatorHandler::EvalIncludeFile,
|
||||
ProFileEvaluator::LoadProOnly);
|
||||
ok = evaluateFile(fn, QMakeEvaluatorHandler::EvalIncludeFile, LoadProOnly);
|
||||
} else {
|
||||
QHash<ProString, ProStringList> symbols;
|
||||
if ((ok = evaluateFileInto(fn, QMakeEvaluatorHandler::EvalAuxFile,
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "qmakeevaluator.h"
|
||||
|
||||
#include "profileevaluator.h"
|
||||
#include "qmakeglobals.h"
|
||||
#include "qmakeparser.h"
|
||||
#include "qmakeevaluator_p.h"
|
||||
@@ -847,15 +848,14 @@ void QMakeEvaluator::visitCmdLine(const QString &cmds)
|
||||
}
|
||||
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
ProFile *pro, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags)
|
||||
ProFile *pro, QMakeEvaluatorHandler::EvalFileType type, LoadFlags flags)
|
||||
{
|
||||
if (!m_cumulative && !pro->isOk())
|
||||
return ReturnFalse;
|
||||
|
||||
m_handler->aboutToEval(currentProFile(), pro, type);
|
||||
m_profileStack.push(pro);
|
||||
if (flags & ProFileEvaluator::LoadPreFiles) {
|
||||
if (flags & LoadPreFiles) {
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
{
|
||||
QMutexLocker locker(&m_option->mutex);
|
||||
@@ -953,14 +953,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
m_option->qmakespec = QDir::cleanPath(qmakespec);
|
||||
|
||||
QString spec = m_option->qmakespec + QLatin1String("/qmake.conf");
|
||||
if (!evaluateFileDirect(spec, QMakeEvaluatorHandler::EvalConfigFile,
|
||||
ProFileEvaluator::LoadProOnly)) {
|
||||
if (!evaluateFileDirect(spec,
|
||||
QMakeEvaluatorHandler::EvalConfigFile, LoadProOnly)) {
|
||||
m_handler->configError(
|
||||
fL1S("Could not read qmake configuration file %1").arg(spec));
|
||||
} else if (!m_option->cachefile.isEmpty()) {
|
||||
evaluateFileDirect(m_option->cachefile,
|
||||
QMakeEvaluatorHandler::EvalConfigFile,
|
||||
ProFileEvaluator::LoadProOnly);
|
||||
QMakeEvaluatorHandler::EvalConfigFile, LoadProOnly);
|
||||
}
|
||||
m_option->qmakespec_name = IoUtils::fileName(m_option->qmakespec).toString();
|
||||
if (m_option->qmakespec_name == QLatin1String("default")) {
|
||||
@@ -1016,7 +1015,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
|
||||
visitProBlock(pro, pro->tokPtr());
|
||||
|
||||
if (flags & ProFileEvaluator::LoadPostFiles) {
|
||||
if (flags & LoadPostFiles) {
|
||||
visitCmdLine(m_option->postcmds);
|
||||
|
||||
evaluateFeatureFile(QLatin1String("default_post.prf"));
|
||||
@@ -1926,8 +1925,7 @@ ProStringList QMakeEvaluator::values(const ProString &variableName) const
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::evaluateFileDirect(
|
||||
const QString &fileName, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags)
|
||||
const QString &fileName, QMakeEvaluatorHandler::EvalFileType type, LoadFlags flags)
|
||||
{
|
||||
if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
|
||||
m_locationStack.push(m_current);
|
||||
@@ -1941,8 +1939,7 @@ bool QMakeEvaluator::evaluateFileDirect(
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::evaluateFile(
|
||||
const QString &fileName, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags)
|
||||
const QString &fileName, QMakeEvaluatorHandler::EvalFileType type, LoadFlags flags)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
@@ -1999,8 +1996,7 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName)
|
||||
#endif
|
||||
|
||||
// The path is fully normalized already.
|
||||
bool ok = evaluateFileDirect(fn, QMakeEvaluatorHandler::EvalFeatureFile,
|
||||
ProFileEvaluator::LoadProOnly);
|
||||
bool ok = evaluateFileDirect(fn, QMakeEvaluatorHandler::EvalFeatureFile, LoadProOnly);
|
||||
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
m_cumulative = cumulative;
|
||||
@@ -2023,7 +2019,7 @@ bool QMakeEvaluator::evaluateFileInto(
|
||||
if (mode == EvalWithDefaults)
|
||||
visitor.d->evaluateFeatureFile(QLatin1String("default_pre.prf"));
|
||||
if (!visitor.d->evaluateFile(fileName, type,
|
||||
(mode == EvalWithSetup) ? ProFileEvaluator::LoadAll : ProFileEvaluator::LoadProOnly))
|
||||
(mode == EvalWithSetup) ? LoadAll : LoadProOnly))
|
||||
return false;
|
||||
*values = visitor.d->m_valuemapStack.top();
|
||||
// if (funcs)
|
||||
|
||||
@@ -64,6 +64,14 @@ public:
|
||||
class QMAKE_EXPORT QMakeEvaluator
|
||||
{
|
||||
public:
|
||||
enum LoadFlag {
|
||||
LoadProOnly = 0,
|
||||
LoadPreFiles = 1,
|
||||
LoadPostFiles = 2,
|
||||
LoadAll = LoadPreFiles|LoadPostFiles
|
||||
};
|
||||
Q_DECLARE_FLAGS(LoadFlags, LoadFlag)
|
||||
|
||||
static void initStatics();
|
||||
static void initFunctionStatics();
|
||||
QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser,
|
||||
@@ -95,7 +103,7 @@ public:
|
||||
|
||||
void visitCmdLine(const QString &cmds);
|
||||
VisitReturn visitProFile(ProFile *pro, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags);
|
||||
LoadFlags flags);
|
||||
VisitReturn visitProBlock(ProFile *pro, const ushort *tokPtr);
|
||||
VisitReturn visitProBlock(const ushort *tokPtr);
|
||||
VisitReturn visitProLoop(const ProString &variable, const ushort *exprPtr,
|
||||
@@ -119,9 +127,9 @@ public:
|
||||
{ return ProFileEvaluatorInternal::IoUtils::resolvePath(currentDirectory(), fileName); }
|
||||
|
||||
bool evaluateFileDirect(const QString &fileName, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags);
|
||||
LoadFlags flags);
|
||||
bool evaluateFile(const QString &fileName, QMakeEvaluatorHandler::EvalFileType type,
|
||||
ProFileEvaluator::LoadFlags flags);
|
||||
LoadFlags flags);
|
||||
bool evaluateFeatureFile(const QString &fileName);
|
||||
enum EvalIntoMode { EvalProOnly, EvalWithDefaults, EvalWithSetup };
|
||||
bool evaluateFileInto(const QString &fileName, QMakeEvaluatorHandler::EvalFileType type,
|
||||
@@ -207,6 +215,8 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeEvaluator::LoadFlags)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMAKEEVALUATOR_H
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "qmake_global.h"
|
||||
#include "proitems.h"
|
||||
|
||||
#include "profileevaluator.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QStringList>
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
@@ -95,7 +93,6 @@ private:
|
||||
bool base_inProgress;
|
||||
#endif
|
||||
|
||||
friend class ProFileEvaluator;
|
||||
friend class QMakeEvaluator;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user