refactor pre, post and CONFIG feature inclusion

actually use evaluateFeatureFile() instead of hand-crafting stuff
This commit is contained in:
Oswald Buddenhagen
2009-07-22 11:03:01 +02:00
parent 2e9a9cfa4a
commit 42ee63384c

View File

@@ -802,19 +802,21 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProFile(ProFile * pr
m_profileStack.push(pro); m_profileStack.push(pro);
const QString mkspecDirectory = propertyValue(QLatin1String("QMAKE_MKSPECS")); if (m_parsePreAndPostFiles) {
if (!mkspecDirectory.isEmpty() && m_parsePreAndPostFiles) { const QString mkspecDirectory = propertyValue(QLatin1String("QMAKE_MKSPECS"));
bool cumulative = m_cumulative; if (!mkspecDirectory.isEmpty()) {
m_cumulative = false; bool cumulative = m_cumulative;
evaluateFile(mkspecDirectory + QLatin1String("/default/qmake.conf")); m_cumulative = false;
evaluateFile(mkspecDirectory + QLatin1String("/features/default_pre.prf")); evaluateFile(mkspecDirectory + QLatin1String("/default/qmake.conf"));
m_cumulative = cumulative;
}
evaluateFeatureFile(QLatin1String("default_pre.prf"));
QStringList tmp = m_valuemap.value(QLatin1String("CONFIG")); QStringList tmp = m_valuemap.value(QLatin1String("CONFIG"));
tmp.append(m_addUserConfigCmdArgs); tmp.append(m_addUserConfigCmdArgs);
foreach(const QString &remove, m_removeUserConfigCmdArgs) foreach (const QString &remove, m_removeUserConfigCmdArgs)
tmp.removeAll(remove); tmp.removeAll(remove);
m_valuemap.insert(QLatin1String("CONFIG"), tmp); m_valuemap.insert(QLatin1String("CONFIG"), tmp);
m_cumulative = cumulative;
} }
return returnBool(QDir::setCurrent(pro->directoryName())); return returnBool(QDir::setCurrent(pro->directoryName()));
@@ -828,33 +830,25 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitEndProFile(ProFile * pro)
PRE(pro); PRE(pro);
m_lineNo = pro->lineNumber(); m_lineNo = pro->lineNumber();
if (m_profileStack.count() == 1 && !m_oldPath.isEmpty()) { if (m_profileStack.count() == 1 && !m_oldPath.isEmpty()) {
const QString &mkspecDirectory = propertyValue(QLatin1String("QMAKE_MKSPECS")); if (m_parsePreAndPostFiles) {
if (!mkspecDirectory.isEmpty()) { evaluateFeatureFile(QLatin1String("default_post.prf"));
if (m_parsePreAndPostFiles) {
bool cumulative = m_cumulative;
m_cumulative = false;
evaluateFile(mkspecDirectory + QLatin1String("/features/default_post.prf")); QSet<QString> processed;
forever {
QSet<QString> processed; bool finished = true;
forever { QStringList configs = valuesDirect(QLatin1String("CONFIG"));
bool finished = true; for (int i = configs.size() - 1; i >= 0; --i) {
QStringList configs = valuesDirect(QLatin1String("CONFIG")); const QString config = configs[i].toLower();
for (int i = configs.size() - 1; i >= 0; --i) { if (!processed.contains(config)) {
const QString config = configs[i].toLower(); processed.insert(config);
if (!processed.contains(config)) { if (evaluateFeatureFile(config)) {
processed.insert(config); finished = false;
if (evaluateFile(mkspecDirectory + QLatin1String("/features/") break;
+ config + QLatin1String(".prf"))) {
finished = false;
break;
}
} }
} }
if (finished)
break;
} }
m_cumulative = cumulative; if (finished)
break;
} }
} }