using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
-ProFileReader::ProFileReader(ProFileOption *option) : ProFileEvaluator(option)
+ProFileReader::ProFileReader(ProFileOption *option)
+ : ProFileEvaluator(option)
+ , m_ignoreLevel(0)
{
}
bool ProFileReader::readProFile(const QString &fileName)
{
if (ProFile *pro = parsedProFile(fileName)) {
- m_ignoreLevel = 0;
- aboutToEval(0, pro, EvalIncludeFile);
bool ok = accept(pro);
pro->deref();
return ok;
void ProFileReader::aboutToEval(ProFile *, ProFile *pro, EvalFileType type)
{
- if (m_ignoreLevel || type == EvalFeatureFile) {
+ if (m_ignoreLevel || (type != EvalProjectFile && type != EvalIncludeFile)) {
m_ignoreLevel++;
} else if (!m_includeFiles.contains(pro->fileName())) {
m_includeFiles.insert(pro->fileName(), pro);
static ALWAYS_INLINE void skipHashStr(const ushort *&tokPtr);
void skipExpression(const ushort *&tokPtr);
- VisitReturn visitProFile(ProFile *pro);
+ VisitReturn visitProFile(ProFile *pro, ProFileEvaluator::EvalFileType type);
VisitReturn visitProBlock(const ushort *tokPtr);
VisitReturn visitProLoop(const ProString &variable, const ushort *exprPtr,
const ushort *tokPtr);
}
}
-ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(ProFile *pro)
+ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
+ ProFile *pro, ProFileEvaluator::EvalFileType type)
{
+ q->aboutToEval(currentProFile(), pro, type);
m_lineNo = 0;
m_profileStack.push(pro);
if (m_profileStack.count() == 1) {
if (!qmake_cache.isEmpty()) {
qmake_cache = resolvePath(qmake_cache);
QHash<ProString, ProStringList> cache_valuemap;
- if (evaluateFileInto(qmake_cache, ProFileEvaluator::EvalFeatureFile,
+ if (evaluateFileInto(qmake_cache, ProFileEvaluator::EvalConfigFile,
&cache_valuemap, 0)) {
if (m_option->qmakespec.isEmpty()) {
const ProStringList &vals = cache_valuemap.value(ProString("QMAKESPEC"));
m_option->qmakespec = QDir::cleanPath(qmakespec);
QString spec = m_option->qmakespec + QLatin1String("/qmake.conf");
- if (!evaluateFileInto(spec, ProFileEvaluator::EvalFeatureFile,
+ if (!evaluateFileInto(spec, ProFileEvaluator::EvalConfigFile,
&m_option->base_valuemap, &m_option->base_functions)) {
errorMessage(format("Could not read qmake configuration file %1").arg(spec));
} else if (!m_option->cachefile.isEmpty()) {
- evaluateFileInto(m_option->cachefile, ProFileEvaluator::EvalFeatureFile,
+ evaluateFileInto(m_option->cachefile, ProFileEvaluator::EvalConfigFile,
&m_option->base_valuemap, &m_option->base_functions);
}
m_option->qmakespec_name = IoUtils::fileName(m_option->qmakespec).toString();
}
}
m_profileStack.pop();
+ q->doneWithEval(currentProFile());
return ReturnTrue;
}
QHash<ProString, ProStringList> vars;
QString fn = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1)));
fn.detach();
- if (evaluateFileInto(fn, ProFileEvaluator::EvalIncludeFile, &vars, 0))
+ if (evaluateFileInto(fn, ProFileEvaluator::EvalAuxFile, &vars, 0))
ret = vars.value(map(args.at(1)));
}
break;
QHash<ProString, ProStringList> vars;
QString fn = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1)));
fn.detach();
- if (!evaluateFileInto(fn, ProFileEvaluator::EvalIncludeFile, &vars, 0))
+ if (!evaluateFileInto(fn, ProFileEvaluator::EvalAuxFile, &vars, 0))
return ReturnFalse;
if (args.count() == 2)
return returnBool(vars.contains(args.at(1)));
{
int lineNo = m_lineNo;
if (ProFile *pro = parsedProFile(fileName, true)) {
- q->aboutToEval(currentProFile(), pro, type);
- bool ok = (visitProFile(pro) == ReturnTrue);
- q->doneWithEval(currentProFile());
+ bool ok = (visitProFile(pro, type) == ReturnTrue);
pro->deref();
m_lineNo = lineNo;
return ok;
bool ProFileEvaluator::accept(ProFile *pro)
{
- return d->visitProFile(pro);
+ return d->visitProFile(pro, ProFileEvaluator::EvalProjectFile);
}
QString ProFileEvaluator::propertyValue(const QString &name) const