summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-05-16 10:47:26 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-05-16 11:07:25 +0000
commit5c1973d4b74e0823b4f4fedc896ac342520ae852 (patch)
treeea85859dcc6182add6df35e1ed9319aa5ec6b652 /src
parentce626e5e919cabb32a7fa1be35025837196b8204 (diff)
downloadqbs-5c1973d4b74e0823b4f4fedc896ac342520ae852.tar.gz
Loader: Do not error out when encountering duplicate multiplex values
In qbs, values of list properties specified in a project file are merged with those from the profile. As of fb52fed84a1510a7de0172e643d6fd66a780e2e8, this is also true for the special multiplexing properties ("qbs.architectures", "qbs.buildVariants" etc). This means it can now happen that we end up with duplicate entries in these lists implicitly. Therefore, it no longer makes sense to throw an error when such duplicates are encountered, as they were not necessarily specified verbatim. Instead, we simply ignore the duplicate value and carry on normally. Change-Id: Ie4fed2081bebd2b0dd62aa873cafed769b308e97 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/corelib/loader/productitemmultiplexer.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/corelib/loader/productitemmultiplexer.cpp b/src/lib/corelib/loader/productitemmultiplexer.cpp
index aec0400d2..53937aa92 100644
--- a/src/lib/corelib/loader/productitemmultiplexer.cpp
+++ b/src/lib/corelib/loader/productitemmultiplexer.cpp
@@ -181,11 +181,8 @@ MultiplexInfo ProductItemMultiplexer::Private::extractMultiplexInfo(Item *produc
if (mappedKey.isEmpty())
throw ErrorInfo(Tr::tr("There is no entry for '%1' in 'qbs.multiplexMap'.").arg(key));
- if (!uniqueMultiplexByQbsProperties.insert(mappedKey).second) {
- throw ErrorInfo(Tr::tr("Duplicate entry '%1' in Product.%2.")
- .arg(mappedKey, StringConstants::multiplexByQbsPropertiesProperty()),
- productItem->location());
- }
+ if (!uniqueMultiplexByQbsProperties.insert(mappedKey).second)
+ continue;
const ScopedJsValue arr(ctx, evaluator.value(qbsModuleItem, key));
if (JS_IsUndefined(arr))
@@ -198,23 +195,20 @@ MultiplexInfo ProductItemMultiplexer::Private::extractMultiplexInfo(Item *produc
continue;
MultiplexRow mprow;
- mprow.resize(arrlen);
+ mprow.reserve(arrlen);
QVariantList entriesForKey;
for (quint32 i = 0; i < arrlen; ++i) {
const ScopedJsValue sv(ctx, JS_GetPropertyUint32(ctx, arr, i));
const QVariant value = getJsVariant(ctx, sv);
- if (entriesForKey.contains(value)) {
- throw ErrorInfo(Tr::tr("Duplicate entry '%1' in qbs.%2.")
- .arg(value.toString(), key), productItem->location());
- }
+ if (entriesForKey.contains(value))
+ continue;
entriesForKey << value;
- mprow[i] = VariantValue::create(value);
+ mprow.push_back(VariantValue::create(value));
}
multiplexInfo.table = combine(multiplexInfo.table, mprow);
multiplexInfo.properties.push_back(mappedKey);
}
return multiplexInfo;
-
}
MultiplexTable ProductItemMultiplexer::Private::combine(const MultiplexTable &table,