forked from qt-creator/qt-creator
add requires() function and REQUIRES magic variable
follow suit with qmake ... Change-Id: I6afc3898a01cc9926b9652b7f0f66becc255f01b Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -1023,8 +1023,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
}
|
||||
}
|
||||
return ReturnFalse;
|
||||
#if 0
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
case T_REQUIRES:
|
||||
checkRequirements(args);
|
||||
return ReturnFalse; // Another qmake breakage
|
||||
#endif
|
||||
case T_EVAL: {
|
||||
VisitReturn ret = ReturnFalse;
|
||||
|
||||
@@ -117,6 +117,9 @@ void QMakeEvaluator::initStatics()
|
||||
statics.strforever = QLatin1String("forever");
|
||||
statics.strhost_build = QLatin1String("host_build");
|
||||
statics.strTEMPLATE = ProString("TEMPLATE");
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
statics.strREQUIRES = ProString("REQUIRES");
|
||||
#endif
|
||||
|
||||
statics.fakeValue = ProStringList(ProString("_FAKE_")); // It has to have a unique begin() value
|
||||
|
||||
@@ -837,6 +840,10 @@ void QMakeEvaluator::visitProVariable(
|
||||
|
||||
if (varName == statics.strTEMPLATE)
|
||||
setTemplate();
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
else if (varName == statics.strREQUIRES)
|
||||
checkRequirements(values(varName));
|
||||
#endif
|
||||
}
|
||||
|
||||
void QMakeEvaluator::setTemplate()
|
||||
@@ -1527,6 +1534,16 @@ bool QMakeEvaluator::evaluateConditional(const QString &cond, const QString &con
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
void QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
||||
{
|
||||
ProStringList &failed = valuesRef(ProString("QMAKE_FAILED_REQUIREMENTS"));
|
||||
foreach (const ProString &dep, deps)
|
||||
if (!evaluateConditional(dep.toQString(), fL1S("(requires)")))
|
||||
failed << dep;
|
||||
}
|
||||
#endif
|
||||
|
||||
ProValueMap *QMakeEvaluator::findValues(const ProString &variableName, ProValueMap::Iterator *rit)
|
||||
{
|
||||
for (int i = m_valuemapStack.size(); --i >= 0; ) {
|
||||
|
||||
@@ -166,6 +166,9 @@ public:
|
||||
VisitReturn evaluateConditionalFunction(const ProString &function, const ushort *&tokPtr);
|
||||
|
||||
bool evaluateConditional(const QString &cond, const QString &context);
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
void checkRequirements(const ProStringList &deps);
|
||||
#endif
|
||||
|
||||
QStringList qmakeMkspecPaths() const;
|
||||
QStringList qmakeFeaturePaths() const;
|
||||
|
||||
@@ -51,6 +51,9 @@ struct QMakeStatics {
|
||||
QString strforever;
|
||||
QString strhost_build;
|
||||
ProString strTEMPLATE;
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
ProString strREQUIRES;
|
||||
#endif
|
||||
QHash<ProString, int> expands;
|
||||
QHash<ProString, int> functions;
|
||||
QHash<ProString, ProString> varMap;
|
||||
|
||||
Reference in New Issue
Block a user