aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-11-05 14:04:16 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2013-11-05 14:24:28 +0100
commit89a1e502e0d33ce775515dd55ebb40ddbc4143b2 (patch)
tree5a4ff6918bee44ca818997cbc61d3f514e3c7a59
parentd25952d28b1bf3a3f08b5664c05faf84cdc80a23 (diff)
Fix look-up of scalar module properties.v1.1.0
These must not be searched for recursively. For instance, if such a property is set to different values in different instantiating modules, there is no sensible heuristic which value should be used. The current implementation just takes the one found first, which is just as wrong as any other solution that looks beyond what is set directly in the product or artifact. Change-Id: I65c29538a437872e2d1e1c4043f2c5cfa301ebb9 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/lib/tools/propertyfinder.cpp15
-rw-r--r--src/lib/tools/propertyfinder.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/tools/propertyfinder.cpp b/src/lib/tools/propertyfinder.cpp
index 4e5f32825..8d8c935d8 100644
--- a/src/lib/tools/propertyfinder.cpp
+++ b/src/lib/tools/propertyfinder.cpp
@@ -38,9 +38,8 @@ QVariantList PropertyFinder::propertyValues(const QVariantMap &properties,
{
m_moduleName = moduleName;
m_key = key;
- m_findOnlyOne = false;
m_values.clear();
- findModuleValues(properties);
+ findModuleValues(properties, true);
if (mergeType == DoMergeLists)
mergeLists(&m_values);
return m_values;
@@ -51,15 +50,14 @@ QVariant PropertyFinder::propertyValue(const QVariantMap &properties, const QStr
{
m_moduleName = moduleName;
m_key = key;
- m_findOnlyOne = true;
m_values.clear();
- findModuleValues(properties);
+ findModuleValues(properties, false);
QBS_ASSERT(m_values.count() <= 1, return QVariant());
return m_values.isEmpty() ? QVariant() : m_values.first();
}
-void PropertyFinder::findModuleValues(const QVariantMap &properties)
+void PropertyFinder::findModuleValues(const QVariantMap &properties, bool searchRecursively)
{
QVariantMap moduleProperties = properties.value(QLatin1String("modules")).toMap();
@@ -72,10 +70,13 @@ void PropertyFinder::findModuleValues(const QVariantMap &properties)
moduleProperties.erase(modIt);
}
+ if (!searchRecursively)
+ return;
+
// These are the non-matching modules.
for (QVariantMap::ConstIterator it = moduleProperties.constBegin();
- it != moduleProperties.constEnd() && (m_values.isEmpty() || !m_findOnlyOne); ++it) {
- findModuleValues(it->toMap());
+ it != moduleProperties.constEnd(); ++it) {
+ findModuleValues(it->toMap(), true);
}
}
diff --git a/src/lib/tools/propertyfinder.h b/src/lib/tools/propertyfinder.h
index d8da245df..206ef42c8 100644
--- a/src/lib/tools/propertyfinder.h
+++ b/src/lib/tools/propertyfinder.h
@@ -47,14 +47,13 @@ public:
const QString &key);
private:
- void findModuleValues(const QVariantMap &properties);
+ void findModuleValues(const QVariantMap &properties, bool searchRecursively);
void addToList(const QVariant &value);
static void mergeLists(QVariantList *values);
QString m_moduleName;
QString m_key;
QVariantList m_values;
- bool m_findOnlyOne;
};
} // namespace Internal