aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-12-08 19:38:22 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-12-20 21:25:10 +0100
commit493546feef5801cca45d32dcc5d29627120c983f (patch)
tree03b3c2136c3c39f4d2580a355a3d3698e2af56d1 /tools
parent35a981e2d2a570f000514110de6653c9aa86ebc8 (diff)
Add prefer record to the output of qmlimportscanner
Task-number: QTBUG-95984 Change-Id: I2e126db655ef986b23d66a465e8b28b9fb17bbb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit e0a6ee877dce82bdeff3fae64af0d4d95426d19a) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlimportscanner/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index c14fda2422..15ff387486 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -75,6 +75,7 @@ inline QString linkTargetLiteral()
}
inline QString componentsLiteral() { return QStringLiteral("components"); }
inline QString scriptsLiteral() { return QStringLiteral("scripts"); }
+inline QString preferLiteral() { return QStringLiteral("prefer"); }
void printUsage(const QString &appNameIn)
{
@@ -183,7 +184,6 @@ QVariantMap pluginsForModulePath(const QString &modulePath, const QString &versi
pluginNameList.append(plugin.name);
isOptional = plugin.optional;
}
-
pluginInfo[pluginsLiteral()] = pluginNameList.join(QLatin1Char(' '));
if (plugins.size() > 1) {
@@ -253,6 +253,10 @@ QVariantMap pluginsForModulePath(const QString &modulePath, const QString &versi
pluginInfo[componentsLiteral()] = componentFiles;
if (!scriptFiles.isEmpty())
pluginInfo[scriptsLiteral()] = scriptFiles;
+
+ if (!parser.preferredPath().isEmpty())
+ pluginInfo[preferLiteral()] = parser.preferredPath();
+
return pluginInfo;
}
@@ -346,6 +350,7 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
QString classnames = plugininfo.value(classnamesLiteral()).toString();
QStringList components = plugininfo.value(componentsLiteral()).toStringList();
QStringList scripts = plugininfo.value(scriptsLiteral()).toStringList();
+ QString prefer = plugininfo.value(preferLiteral()).toString();
if (!linkTarget.isEmpty())
import.insert(linkTargetLiteral(), linkTarget);
if (!plugins.isEmpty())
@@ -377,6 +382,9 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
scripts.removeDuplicates();
import.insert(scriptsLiteral(), scripts);
}
+ if (!prefer.isEmpty()) {
+ import.insert(preferLiteral(), prefer);
+ }
}
import.remove(versionLiteral());
done.append(import);