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>
(cherry picked from qtbase/1b4ea11332f74984a62a4cc4597ad49f5b5269dc)
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Oswald Buddenhagen
2016-06-30 16:02:29 +02:00
parent 3fe303ebfe
commit 32f3eccade
3 changed files with 12 additions and 6 deletions

View File

@@ -1194,7 +1194,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: {

View File

@@ -925,7 +925,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;
@@ -1787,12 +1787,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

View File

@@ -213,7 +213,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();