forked from qt-creator/qt-creator
make error() abort the qmake run, not just the current file
Change-Id: I82fc55680f9ffb227e25acb39c797596225ba89e Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> (cherry picked from qtbase/0da7f097249f71726140a38647bb4824b09fad7b)
This commit is contained in:
@@ -676,7 +676,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
ProValueMap vars;
|
ProValueMap vars;
|
||||||
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
||||||
fn.detach();
|
fn.detach();
|
||||||
if (evaluateFileInto(fn, &vars, LoadProOnly))
|
if (evaluateFileInto(fn, &vars, LoadProOnly) == ReturnTrue)
|
||||||
ret = vars.value(map(args.at(1)));
|
ret = vars.value(map(args.at(1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1086,8 +1086,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
ProValueMap vars;
|
ProValueMap vars;
|
||||||
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
||||||
fn.detach();
|
fn.detach();
|
||||||
if (!evaluateFileInto(fn, &vars, LoadProOnly))
|
VisitReturn ok = evaluateFileInto(fn, &vars, LoadProOnly);
|
||||||
return ReturnFalse;
|
if (ok != ReturnTrue)
|
||||||
|
return ok;
|
||||||
if (args.count() == 2)
|
if (args.count() == 2)
|
||||||
return returnBool(vars.contains(map(args.at(1))));
|
return returnBool(vars.contains(map(args.at(1))));
|
||||||
QRegExp regx;
|
QRegExp regx;
|
||||||
@@ -1296,12 +1297,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
}
|
}
|
||||||
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
||||||
fn.detach();
|
fn.detach();
|
||||||
bool ok;
|
VisitReturn ok;
|
||||||
if (parseInto.isEmpty()) {
|
if (parseInto.isEmpty()) {
|
||||||
ok = evaluateFileChecked(fn, QMakeHandler::EvalIncludeFile, LoadProOnly | flags);
|
ok = evaluateFileChecked(fn, QMakeHandler::EvalIncludeFile, LoadProOnly | flags);
|
||||||
} else {
|
} else {
|
||||||
ProValueMap symbols;
|
ProValueMap symbols;
|
||||||
if ((ok = evaluateFileInto(fn, &symbols, LoadAll | flags))) {
|
if ((ok = evaluateFileInto(fn, &symbols, LoadAll | flags)) == ReturnTrue) {
|
||||||
ProValueMap newMap;
|
ProValueMap newMap;
|
||||||
for (ProValueMap::ConstIterator
|
for (ProValueMap::ConstIterator
|
||||||
it = m_valuemapStack.top().constBegin(),
|
it = m_valuemapStack.top().constBegin(),
|
||||||
@@ -1322,7 +1323,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
m_valuemapStack.top() = newMap;
|
m_valuemapStack.top() = newMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnBool(ok || (flags & LoadSilent));
|
if (ok == ReturnFalse && (flags & LoadSilent))
|
||||||
|
ok = ReturnTrue;
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
case T_LOAD: {
|
case T_LOAD: {
|
||||||
bool ignore_error = false;
|
bool ignore_error = false;
|
||||||
@@ -1332,8 +1335,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
evalError(fL1S("load(feature) requires one or two arguments."));
|
evalError(fL1S("load(feature) requires one or two arguments."));
|
||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
}
|
}
|
||||||
return returnBool(evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()),
|
VisitReturn ok = evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()),
|
||||||
ignore_error) || ignore_error);
|
ignore_error);
|
||||||
|
if (ok == ReturnFalse && ignore_error)
|
||||||
|
ok = ReturnTrue;
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
case T_DEBUG: {
|
case T_DEBUG: {
|
||||||
#ifdef PROEVALUATOR_DEBUG
|
#ifdef PROEVALUATOR_DEBUG
|
||||||
|
|||||||
@@ -1118,10 +1118,10 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
|
|||||||
|
|
||||||
bool QMakeEvaluator::loadSpecInternal()
|
bool QMakeEvaluator::loadSpecInternal()
|
||||||
{
|
{
|
||||||
if (!evaluateFeatureFile(QLatin1String("spec_pre.prf")))
|
if (evaluateFeatureFile(QLatin1String("spec_pre.prf")) != ReturnTrue)
|
||||||
return false;
|
return false;
|
||||||
QString spec = m_qmakespec + QLatin1String("/qmake.conf");
|
QString spec = m_qmakespec + QLatin1String("/qmake.conf");
|
||||||
if (!evaluateFile(spec, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
if (evaluateFile(spec, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
|
||||||
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
|
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1145,7 +1145,7 @@ bool QMakeEvaluator::loadSpecInternal()
|
|||||||
#endif
|
#endif
|
||||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec);
|
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec);
|
||||||
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
|
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
|
||||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
if (evaluateFeatureFile(QLatin1String("spec_post.prf")) != ReturnTrue)
|
||||||
return false;
|
return false;
|
||||||
// The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it
|
// The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it
|
||||||
m_dirSep = first(ProKey("QMAKE_DIR_SEP"));
|
m_dirSep = first(ProKey("QMAKE_DIR_SEP"));
|
||||||
@@ -1161,17 +1161,20 @@ bool QMakeEvaluator::loadSpec()
|
|||||||
QMakeEvaluator evaluator(m_option, m_parser, m_handler);
|
QMakeEvaluator evaluator(m_option, m_parser, m_handler);
|
||||||
if (!m_superfile.isEmpty()) {
|
if (!m_superfile.isEmpty()) {
|
||||||
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
|
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
|
||||||
if (!evaluator.evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
if (evaluator.evaluateFile(
|
||||||
|
m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_conffile.isEmpty()) {
|
if (!m_conffile.isEmpty()) {
|
||||||
valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
|
valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
|
||||||
if (!evaluator.evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
if (evaluator.evaluateFile(
|
||||||
|
m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_cachefile.isEmpty()) {
|
if (!m_cachefile.isEmpty()) {
|
||||||
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
|
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
|
||||||
if (!evaluator.evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
if (evaluator.evaluateFile(
|
||||||
|
m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (qmakespec.isEmpty()) {
|
if (qmakespec.isEmpty()) {
|
||||||
@@ -1207,17 +1210,17 @@ bool QMakeEvaluator::loadSpec()
|
|||||||
m_qmakespec = QDir::cleanPath(qmakespec);
|
m_qmakespec = QDir::cleanPath(qmakespec);
|
||||||
|
|
||||||
if (!m_superfile.isEmpty()
|
if (!m_superfile.isEmpty()
|
||||||
&& !evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!loadSpecInternal())
|
if (!loadSpecInternal())
|
||||||
return false;
|
return false;
|
||||||
if (!m_conffile.isEmpty()
|
if (!m_conffile.isEmpty()
|
||||||
&& !evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_cachefile.isEmpty()
|
if (!m_cachefile.isEmpty()
|
||||||
&& !evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1248,7 +1251,7 @@ void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeEvaluator::evaluateConfigFeatures()
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConfigFeatures()
|
||||||
{
|
{
|
||||||
QSet<QString> processed;
|
QSet<QString> processed;
|
||||||
forever {
|
forever {
|
||||||
@@ -1259,7 +1262,10 @@ void QMakeEvaluator::evaluateConfigFeatures()
|
|||||||
if (!processed.contains(config)) {
|
if (!processed.contains(config)) {
|
||||||
config.detach();
|
config.detach();
|
||||||
processed.insert(config);
|
processed.insert(config);
|
||||||
if (evaluateFeatureFile(config, true)) {
|
VisitReturn vr = evaluateFeatureFile(config, true);
|
||||||
|
if (vr == ReturnError)
|
||||||
|
return vr;
|
||||||
|
if (vr == ReturnTrue) {
|
||||||
finished = false;
|
finished = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1268,6 +1274,7 @@ void QMakeEvaluator::evaluateConfigFeatures()
|
|||||||
if (finished)
|
if (finished)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||||
@@ -1342,13 +1349,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
|||||||
it != m_extraVars.constEnd(); ++it)
|
it != m_extraVars.constEnd(); ++it)
|
||||||
m_valuemapStack.first().insert(it.key(), it.value());
|
m_valuemapStack.first().insert(it.key(), it.value());
|
||||||
|
|
||||||
|
VisitReturn vr;
|
||||||
|
|
||||||
m_handler->aboutToEval(currentProFile(), pro, type);
|
m_handler->aboutToEval(currentProFile(), pro, type);
|
||||||
m_profileStack.push(pro);
|
m_profileStack.push(pro);
|
||||||
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
||||||
if (flags & LoadPreFiles) {
|
if (flags & LoadPreFiles) {
|
||||||
setupProject();
|
setupProject();
|
||||||
|
|
||||||
evaluateFeatureFile(QLatin1String("default_pre.prf"));
|
if ((vr = evaluateFeatureFile(QLatin1String("default_pre.prf"))) == ReturnError)
|
||||||
|
goto failed;
|
||||||
|
|
||||||
evaluateCommand(m_option->precmds, fL1S("(command line)"));
|
evaluateCommand(m_option->precmds, fL1S("(command line)"));
|
||||||
|
|
||||||
@@ -1358,7 +1368,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
debugMsg(1, "visiting file %s", qPrintable(pro->fileName()));
|
debugMsg(1, "visiting file %s", qPrintable(pro->fileName()));
|
||||||
visitProBlock(pro, pro->tokPtr());
|
if ((vr = visitProBlock(pro, pro->tokPtr())) == ReturnError)
|
||||||
|
goto failed;
|
||||||
debugMsg(1, "done visiting file %s", qPrintable(pro->fileName()));
|
debugMsg(1, "done visiting file %s", qPrintable(pro->fileName()));
|
||||||
|
|
||||||
if (flags & LoadPostFiles) {
|
if (flags & LoadPostFiles) {
|
||||||
@@ -1370,15 +1381,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
|||||||
if (!m_extraConfigs.isEmpty())
|
if (!m_extraConfigs.isEmpty())
|
||||||
evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(fL1S(" ")), fL1S("(extra configs)"));
|
evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(fL1S(" ")), fL1S("(extra configs)"));
|
||||||
|
|
||||||
evaluateFeatureFile(QLatin1String("default_post.prf"));
|
if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError)
|
||||||
|
goto failed;
|
||||||
|
|
||||||
evaluateConfigFeatures();
|
if ((vr = evaluateConfigFeatures()) == ReturnError)
|
||||||
|
goto failed;
|
||||||
}
|
}
|
||||||
|
vr = ReturnTrue;
|
||||||
|
failed:
|
||||||
m_profileStack.pop();
|
m_profileStack.pop();
|
||||||
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
||||||
m_handler->doneWithEval(currentProFile());
|
m_handler->doneWithEval(currentProFile());
|
||||||
|
|
||||||
return ReturnTrue;
|
return vr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1585,14 +1600,14 @@ QList<ProStringList> QMakeEvaluator::prepareFunctionArgs(const ushort *&tokPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProStringList QMakeEvaluator::evaluateFunction(
|
ProStringList QMakeEvaluator::evaluateFunction(
|
||||||
const ProFunctionDef &func, const QList<ProStringList> &argumentsList, bool *ok)
|
const ProFunctionDef &func, const QList<ProStringList> &argumentsList, VisitReturn *ok)
|
||||||
{
|
{
|
||||||
bool oki;
|
VisitReturn vr;
|
||||||
ProStringList ret;
|
ProStringList ret;
|
||||||
|
|
||||||
if (m_valuemapStack.count() >= 100) {
|
if (m_valuemapStack.count() >= 100) {
|
||||||
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
|
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
|
||||||
oki = false;
|
vr = ReturnFalse;
|
||||||
} else {
|
} else {
|
||||||
m_valuemapStack.push(ProValueMap());
|
m_valuemapStack.push(ProValueMap());
|
||||||
m_locationStack.push(m_current);
|
m_locationStack.push(m_current);
|
||||||
@@ -1603,8 +1618,9 @@ ProStringList QMakeEvaluator::evaluateFunction(
|
|||||||
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
|
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
|
||||||
}
|
}
|
||||||
m_valuemapStack.top()[statics.strARGS] = args;
|
m_valuemapStack.top()[statics.strARGS] = args;
|
||||||
VisitReturn vr = visitProBlock(func.pro(), func.tokPtr());
|
vr = visitProBlock(func.pro(), func.tokPtr());
|
||||||
oki = (vr != ReturnFalse && vr != ReturnError); // True || Return
|
if (vr == ReturnReturn)
|
||||||
|
vr = ReturnTrue;
|
||||||
ret = m_returnValue;
|
ret = m_returnValue;
|
||||||
m_returnValue.clear();
|
m_returnValue.clear();
|
||||||
|
|
||||||
@@ -1612,8 +1628,8 @@ ProStringList QMakeEvaluator::evaluateFunction(
|
|||||||
m_valuemapStack.pop();
|
m_valuemapStack.pop();
|
||||||
}
|
}
|
||||||
if (ok)
|
if (ok)
|
||||||
*ok = oki;
|
*ok = vr;
|
||||||
if (oki)
|
if (vr == ReturnTrue)
|
||||||
return ret;
|
return ret;
|
||||||
return ProStringList();
|
return ProStringList();
|
||||||
}
|
}
|
||||||
@@ -1622,14 +1638,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction(
|
|||||||
const ProFunctionDef &func, const QList<ProStringList> &argumentsList,
|
const ProFunctionDef &func, const QList<ProStringList> &argumentsList,
|
||||||
const ProString &function)
|
const ProString &function)
|
||||||
{
|
{
|
||||||
bool ok;
|
VisitReturn vr;
|
||||||
ProStringList ret = evaluateFunction(func, argumentsList, &ok);
|
ProStringList ret = evaluateFunction(func, argumentsList, &vr);
|
||||||
if (ok) {
|
if (vr == ReturnTrue) {
|
||||||
if (ret.isEmpty())
|
if (ret.isEmpty())
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
if (ret.at(0) != statics.strfalse) {
|
if (ret.at(0) != statics.strfalse) {
|
||||||
if (ret.at(0) == statics.strtrue)
|
if (ret.at(0) == statics.strtrue)
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
|
bool ok;
|
||||||
int val = ret.at(0).toQString(m_tmp1).toInt(&ok);
|
int val = ret.at(0).toQString(m_tmp1).toInt(&ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (val)
|
if (val)
|
||||||
@@ -1640,8 +1657,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction(
|
|||||||
.arg(ret.join(QLatin1String(" :: "))));
|
.arg(ret.join(QLatin1String(" :: "))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ReturnFalse;
|
||||||
}
|
}
|
||||||
return ReturnFalse;
|
return vr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||||
@@ -1774,16 +1792,16 @@ ProString QMakeEvaluator::first(const ProKey &variableName) const
|
|||||||
return ProString();
|
return ProString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMakeEvaluator::evaluateFile(
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
|
||||||
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
|
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
|
||||||
{
|
{
|
||||||
if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
|
if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
|
||||||
m_locationStack.push(m_current);
|
m_locationStack.push(m_current);
|
||||||
bool ok = (visitProFile(pro, type, flags) == ReturnTrue);
|
VisitReturn ok = visitProFile(pro, type, flags);
|
||||||
m_current = m_locationStack.pop();
|
m_current = m_locationStack.pop();
|
||||||
pro->deref();
|
pro->deref();
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
if (ok) {
|
if (ok == ReturnTrue) {
|
||||||
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
||||||
ProString ifn(fileName);
|
ProString ifn(fileName);
|
||||||
if (!iif.contains(ifn))
|
if (!iif.contains(ifn))
|
||||||
@@ -1794,27 +1812,28 @@ bool QMakeEvaluator::evaluateFile(
|
|||||||
} else {
|
} else {
|
||||||
if (!(flags & LoadSilent) && !IoUtils::exists(fileName))
|
if (!(flags & LoadSilent) && !IoUtils::exists(fileName))
|
||||||
evalError(fL1S("WARNING: Include file %1 not found").arg(fileName));
|
evalError(fL1S("WARNING: Include file %1 not found").arg(fileName));
|
||||||
return false;
|
return ReturnFalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMakeEvaluator::evaluateFileChecked(
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileChecked(
|
||||||
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
|
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
|
||||||
{
|
{
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return false;
|
return ReturnFalse;
|
||||||
QMakeEvaluator *ref = this;
|
QMakeEvaluator *ref = this;
|
||||||
do {
|
do {
|
||||||
foreach (const ProFile *pf, ref->m_profileStack)
|
foreach (const ProFile *pf, ref->m_profileStack)
|
||||||
if (pf->fileName() == fileName) {
|
if (pf->fileName() == fileName) {
|
||||||
evalError(fL1S("Circular inclusion of %1.").arg(fileName));
|
evalError(fL1S("Circular inclusion of %1.").arg(fileName));
|
||||||
return false;
|
return ReturnFalse;
|
||||||
}
|
}
|
||||||
} while ((ref = ref->m_caller));
|
} while ((ref = ref->m_caller));
|
||||||
return evaluateFile(fileName, type, flags);
|
return evaluateFile(fileName, type, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
|
||||||
|
const QString &fileName, bool silent)
|
||||||
{
|
{
|
||||||
QString fn = fileName;
|
QString fn = fileName;
|
||||||
if (!fn.endsWith(QLatin1String(".prf")))
|
if (!fn.endsWith(QLatin1String(".prf")))
|
||||||
@@ -1845,7 +1864,7 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
|||||||
#endif
|
#endif
|
||||||
if (!silent)
|
if (!silent)
|
||||||
evalError(fL1S("Cannot find feature %1").arg(fileName));
|
evalError(fL1S("Cannot find feature %1").arg(fileName));
|
||||||
return false;
|
return ReturnFalse;
|
||||||
|
|
||||||
cool:
|
cool:
|
||||||
ProStringList &already = valuesRef(ProKey("QMAKE_INTERNAL_INCLUDED_FEATURES"));
|
ProStringList &already = valuesRef(ProKey("QMAKE_INTERNAL_INCLUDED_FEATURES"));
|
||||||
@@ -1853,7 +1872,7 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
|||||||
if (already.contains(afn)) {
|
if (already.contains(afn)) {
|
||||||
if (!silent)
|
if (!silent)
|
||||||
languageWarning(fL1S("Feature %1 already included").arg(fileName));
|
languageWarning(fL1S("Feature %1 already included").arg(fileName));
|
||||||
return true;
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
already.append(afn);
|
already.append(afn);
|
||||||
|
|
||||||
@@ -1863,7 +1882,7 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The path is fully normalized already.
|
// The path is fully normalized already.
|
||||||
bool ok = evaluateFile(fn, QMakeHandler::EvalFeatureFile, LoadProOnly);
|
VisitReturn ok = evaluateFile(fn, QMakeHandler::EvalFeatureFile, LoadProOnly);
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_CUMULATIVE
|
#ifdef PROEVALUATOR_CUMULATIVE
|
||||||
m_cumulative = cumulative;
|
m_cumulative = cumulative;
|
||||||
@@ -1871,14 +1890,16 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMakeEvaluator::evaluateFileInto(const QString &fileName, ProValueMap *values, LoadFlags flags)
|
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
|
||||||
|
const QString &fileName, ProValueMap *values, LoadFlags flags)
|
||||||
{
|
{
|
||||||
QMakeEvaluator visitor(m_option, m_parser, m_handler);
|
QMakeEvaluator visitor(m_option, m_parser, m_handler);
|
||||||
visitor.m_caller = this;
|
visitor.m_caller = this;
|
||||||
visitor.m_outputDir = m_outputDir;
|
visitor.m_outputDir = m_outputDir;
|
||||||
visitor.m_featureRoots = m_featureRoots;
|
visitor.m_featureRoots = m_featureRoots;
|
||||||
if (!visitor.evaluateFileChecked(fileName, QMakeHandler::EvalAuxFile, flags))
|
VisitReturn ret = visitor.evaluateFileChecked(fileName, QMakeHandler::EvalAuxFile, flags);
|
||||||
return false;
|
if (ret != ReturnTrue)
|
||||||
|
return ret;
|
||||||
*values = visitor.m_valuemapStack.top();
|
*values = visitor.m_valuemapStack.top();
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
||||||
@@ -1887,7 +1908,7 @@ bool QMakeEvaluator::evaluateFileInto(const QString &fileName, ProValueMap *valu
|
|||||||
if (!iif.contains(ifn))
|
if (!iif.contains(ifn))
|
||||||
iif << ifn;
|
iif << ifn;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeEvaluator::message(int type, const QString &msg) const
|
void QMakeEvaluator::message(int type, const QString &msg) const
|
||||||
|
|||||||
@@ -164,15 +164,15 @@ public:
|
|||||||
QString resolvePath(const QString &fileName) const
|
QString resolvePath(const QString &fileName) const
|
||||||
{ return QMakeInternal::IoUtils::resolvePath(currentDirectory(), fileName); }
|
{ return QMakeInternal::IoUtils::resolvePath(currentDirectory(), fileName); }
|
||||||
|
|
||||||
bool evaluateFile(const QString &fileName, QMakeHandler::EvalFileType type,
|
VisitReturn evaluateFile(const QString &fileName, QMakeHandler::EvalFileType type,
|
||||||
LoadFlags flags);
|
|
||||||
bool evaluateFileChecked(const QString &fileName, QMakeHandler::EvalFileType type,
|
|
||||||
LoadFlags flags);
|
LoadFlags flags);
|
||||||
bool evaluateFeatureFile(const QString &fileName, bool silent = false);
|
VisitReturn evaluateFileChecked(const QString &fileName, QMakeHandler::EvalFileType type,
|
||||||
bool evaluateFileInto(const QString &fileName,
|
LoadFlags flags);
|
||||||
ProValueMap *values, // output-only
|
VisitReturn evaluateFeatureFile(const QString &fileName, bool silent = false);
|
||||||
LoadFlags flags);
|
VisitReturn evaluateFileInto(const QString &fileName,
|
||||||
void evaluateConfigFeatures();
|
ProValueMap *values, // output-only
|
||||||
|
LoadFlags flags);
|
||||||
|
VisitReturn evaluateConfigFeatures();
|
||||||
void message(int type, const QString &msg) const;
|
void message(int type, const QString &msg) const;
|
||||||
void evalError(const QString &msg) const
|
void evalError(const QString &msg) const
|
||||||
{ message(QMakeHandler::EvalError, msg); }
|
{ message(QMakeHandler::EvalError, msg); }
|
||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
|
|
||||||
QList<ProStringList> prepareFunctionArgs(const ushort *&tokPtr);
|
QList<ProStringList> prepareFunctionArgs(const ushort *&tokPtr);
|
||||||
ProStringList evaluateFunction(const ProFunctionDef &func,
|
ProStringList evaluateFunction(const ProFunctionDef &func,
|
||||||
const QList<ProStringList> &argumentsList, bool *ok);
|
const QList<ProStringList> &argumentsList, VisitReturn *ok);
|
||||||
VisitReturn evaluateBoolFunction(const ProFunctionDef &func,
|
VisitReturn evaluateBoolFunction(const ProFunctionDef &func,
|
||||||
const QList<ProStringList> &argumentsList,
|
const QList<ProStringList> &argumentsList,
|
||||||
const ProString &function);
|
const ProString &function);
|
||||||
|
|||||||
Reference in New Issue
Block a user