aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/moduleloader.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-04-20 17:28:54 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-04-27 08:54:09 +0000
commitf66a0df5b91fc38e261c0c857191064f9e02342c (patch)
treecac749b2260970f751bf5a3c4c634cc94b4f3e6f /src/lib/corelib/language/moduleloader.cpp
parentf9df74c5348ab5fab1b49014e43b72fa5407ef42 (diff)
ModuleLoader: Add convenience function for shadow products
It tells us whether a product is a shadow product and if so, what the name of the real product is. We will make more use of it in a follow-up commit. Change-Id: I2d7f9f08c78f303058d33b7ce004af8751bc1ed4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/moduleloader.cpp')
-rw-r--r--src/lib/corelib/language/moduleloader.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 9dceff7a6..1adcdbc50 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -938,8 +938,8 @@ void ModuleLoader::adjustDependenciesForMultiplexing(const ModuleLoader::Product
continue;
QStringList multiplexIds;
- const bool isShadowProduct = product.name.startsWith(shadowProductPrefix())
- && product.name.mid(shadowProductPrefix().size()) == name;
+ const ShadowProductInfo shadowProductInfo = getShadowProductInfo(product);
+ const bool isShadowProduct = shadowProductInfo.first && shadowProductInfo.second == name;
for (const ProductContext *dependency : dependencies) {
const bool depMatchesShadowProduct = isShadowProduct
&& dependency->item == product.item->parent();
@@ -1030,7 +1030,7 @@ void ModuleLoader::prepareProduct(ProjectContext *projectContext, Item *productI
projectContext->products.push_back(productContext);
- if (!hasExportItems || productContext.name.startsWith(shadowProductPrefix()))
+ if (!hasExportItems || getShadowProductInfo(productContext).first)
return;
// This "shadow product" exists only to pull in a dependency on the actual product
@@ -1928,6 +1928,14 @@ void ModuleLoader::checkProductNamesInOverrides()
}
}
+ModuleLoader::ShadowProductInfo ModuleLoader::getShadowProductInfo(
+ const ModuleLoader::ProductContext &product) const
+{
+ const bool isShadowProduct = product.name.startsWith(shadowProductPrefix());
+ return std::make_pair(isShadowProduct, isShadowProduct
+ ? product.name.mid(shadowProductPrefix().size()) : QString());
+}
+
void ModuleLoader::collectProductsByName(const TopLevelProjectContext &topLevelProject)
{
for (ProjectContext * const project : topLevelProject.projects) {