make error() propagate from requires() and REQUIRES=
that can make sense if a function which determines the availability of a dependency fails to do so for unexpected reasons. Change-Id: If6cd113df25aee66830c120a2fab067c822a4543 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
339b9706cc
commit
1b4ea11332
@ -1200,7 +1200,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
case T_REQUIRES:
|
case T_REQUIRES:
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
checkRequirements(args);
|
if (checkRequirements(args) == ReturnError)
|
||||||
|
return ReturnError;
|
||||||
#endif
|
#endif
|
||||||
return ReturnFalse; // Another qmake breakage
|
return ReturnFalse; // Another qmake breakage
|
||||||
case T_EVAL: {
|
case T_EVAL: {
|
||||||
|
@ -933,7 +933,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
|
|||||||
}
|
}
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
else if (varName == statics.strREQUIRES)
|
else if (varName == statics.strREQUIRES)
|
||||||
checkRequirements(values(varName));
|
return checkRequirements(values(varName));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
@ -1795,12 +1795,17 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditional(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
void QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
QMakeEvaluator::VisitReturn QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
||||||
{
|
{
|
||||||
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
|
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
|
||||||
foreach (const ProString &dep, deps)
|
foreach (const ProString &dep, deps) {
|
||||||
if (evaluateConditional(dep.toQString(), m_current.pro->fileName(), m_current.line) != ReturnTrue)
|
VisitReturn vr = evaluateConditional(dep.toQString(), m_current.pro->fileName(), m_current.line);
|
||||||
|
if (vr == ReturnError)
|
||||||
|
return ReturnError;
|
||||||
|
if (vr != ReturnTrue)
|
||||||
failed << dep;
|
failed << dep;
|
||||||
|
}
|
||||||
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ public:
|
|||||||
|
|
||||||
VisitReturn evaluateConditional(const QString &cond, const QString &where, int line = -1);
|
VisitReturn evaluateConditional(const QString &cond, const QString &where, int line = -1);
|
||||||
#ifdef PROEVALUATOR_FULL
|
#ifdef PROEVALUATOR_FULL
|
||||||
void checkRequirements(const ProStringList &deps);
|
VisitReturn checkRequirements(const ProStringList &deps);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void updateMkspecPaths();
|
void updateMkspecPaths();
|
||||||
|
@ -707,6 +707,20 @@ void tst_qmakelib::addControlStructs()
|
|||||||
<< "VAR = UNDEF\nOKE = UNDEF"
|
<< "VAR = UNDEF\nOKE = UNDEF"
|
||||||
<< "Project ERROR: error"
|
<< "Project ERROR: error"
|
||||||
<< false;
|
<< false;
|
||||||
|
|
||||||
|
QTest::newRow("REQUIRES = error()")
|
||||||
|
<< "REQUIRES = error(error)\n"
|
||||||
|
"OKE = 1"
|
||||||
|
<< "OKE = UNDEF"
|
||||||
|
<< "Project ERROR: error"
|
||||||
|
<< false;
|
||||||
|
|
||||||
|
QTest::newRow("requires(error())")
|
||||||
|
<< "requires(error(error))\n"
|
||||||
|
"OKE = 1"
|
||||||
|
<< "OKE = UNDEF"
|
||||||
|
<< "Project ERROR: error"
|
||||||
|
<< false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_qmakelib::addReplaceFunctions(const QString &qindir)
|
void tst_qmakelib::addReplaceFunctions(const QString &qindir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user