summaryrefslogtreecommitdiff
path: root/src/lib/language
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-09-17 18:20:16 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-09-18 11:47:08 +0200
commitb75e15030f4185c95c936f6edd19f25579f2db2c (patch)
tree3be5277fe62729a93fe8df85cdab2152db1c732c /src/lib/language
parente8d3ee487330f50c06a411e6ba52ca4b304db4cf (diff)
downloadqbs-b75e15030f4185c95c936f6edd19f25579f2db2c.tar.gz
ModuleLoader: Do not descend into disabled Depends items.
We don't care what they contain, and possible errors resulting from loading them might be the reason they are disabled. Change-Id: I3dbd95aa04abd38543284303a103093c3b712c45 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/language')
-rw-r--r--src/lib/language/moduleloader.cpp44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/lib/language/moduleloader.cpp b/src/lib/language/moduleloader.cpp
index 7dd2b2bf3..0a21d5b00 100644
--- a/src/lib/language/moduleloader.cpp
+++ b/src/lib/language/moduleloader.cpp
@@ -180,6 +180,7 @@ void ModuleLoader::handleProduct(ProjectContext *projectContext, Item *item)
checkCancelation();
if (m_logger.traceEnabled())
m_logger.qbsTrace() << "[MODLDR] handleProduct " << item->file()->filePath();
+
ProductContext productContext;
productContext.project = projectContext;
productContext.extraSearchPaths = readExtraSearchPaths(item);
@@ -410,41 +411,31 @@ void ModuleLoader::resolveDependencies(DependsContext *dependsContext, Item *ite
loadBaseModule(dependsContext->product, item);
// Resolve all Depends items.
- QHash<Item *, ItemModuleList> loadedModules;
+ typedef QHash<Item *, ItemModuleList> ModuleHash;
+ ModuleHash loadedModules;
ProductDependencyResults productDependencies;
foreach (Item *child, item->children())
if (child->typeName() == QLatin1String("Depends"))
resolveDependsItem(dependsContext, item, child, &loadedModules[child],
&productDependencies);
- // Check Depends conditions after all modules are loaded.
QSet<QString> loadedModuleNames;
- for (QHash<Item *, ItemModuleList>::const_iterator it = loadedModules.constBegin();
- it != loadedModules.constEnd(); ++it)
- {
- Item *dependsItem = it.key();
- if (checkItemCondition(dependsItem)) {
- foreach (const Item::Module &module, it.value()) {
- const QString fullName = fullModuleName(module.name);
- if (loadedModuleNames.contains(fullName)) {
- m_logger.printWarning(ErrorInfo(Tr::tr("Duplicate dependency '%1'.").arg(fullName),
- item->location()));
- continue;
- }
- loadedModuleNames.insert(fullName);
- item->modules() += module;
- resolveProbes(module.item);
+ foreach (const ItemModuleList &moduleList, loadedModules) {
+ foreach (const Item::Module &module, moduleList) {
+ const QString fullName = fullModuleName(module.name);
+ if (loadedModuleNames.contains(fullName)) {
+ m_logger.printWarning(ErrorInfo(Tr::tr("Duplicate dependency '%1'.").arg(fullName),
+ item->location()));
+ continue;
}
+ loadedModuleNames.insert(fullName);
+ item->modules() += module;
+ resolveProbes(module.item);
}
}
- // Check Depends conditions for all product dependencies.
- for (ProductDependencyResults::const_iterator it = productDependencies.constBegin();
- it != productDependencies.constEnd(); ++it) {
- Item *dependsItem = it->first;
- if (checkItemCondition(dependsItem))
- dependsContext->productDependencies->append(it->second);
- }
+ foreach (const ProductDependencyResult &pd, productDependencies)
+ dependsContext->productDependencies->append(pd.second);
}
void ModuleLoader::resolveDependsItem(DependsContext *dependsContext, Item *item,
@@ -452,6 +443,11 @@ void ModuleLoader::resolveDependsItem(DependsContext *dependsContext, Item *item
ProductDependencyResults *productResults)
{
checkCancelation();
+ if (!checkItemCondition(dependsItem)) {
+ if (m_logger.traceEnabled())
+ m_logger.qbsTrace() << "Depends item disabled, ignoring.";
+ return;
+ }
const QString name = m_evaluator->property(dependsItem, "name").toString();
const QStringList nameParts = name.split('.');
if (Q_UNLIKELY(nameParts.count() > 2)) {