aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-07-06 17:27:11 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-07 03:27:57 +0000
commite2bdd5c114ab8caee2fb7747ba197c31eb3d1cdb (patch)
tree83a23e8ad9407f079e2da67d202cd5fa18cb8075 /tools
parente6e357aab9ba51f122b96936afb4ab538ffb67f8 (diff)
CMake: Run qmllint on the qml files in the source tree
In order to use the source tree files, qmllint needs to know where they will end up in the resource system. The source files could be at any arbitrary location and have their resource path set by a QT_RESOURCE_ALIAS source file property. Therefore, we have to give the generated .qrc files to qmllint so it can work out where each source file will end up. The qmllint command previously only supported a single --resource option, but now we need to potentially pass more than one .qrc file. Extend qmllint to allow multiple --resource options to be given, in the same way that multiple -I options can be given. Task-number: QTBUG-94761 Change-Id: Ibeb6541e1f54bea6eeeccd07426dd238b0459ff2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit 7365b0d1c64fcde54ae5a043b28550f44797d236) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp
index 178af18c1a..e1dd71af84 100644
--- a/tools/qmllint/main.cpp
+++ b/tools/qmllint/main.cpp
@@ -61,7 +61,7 @@ constexpr int JSON_LOGGING_FORMAT_REVISION = 1;
static bool lint_file(const QString &filename, const bool silent, QJsonArray *json,
const QStringList &qmlImportPaths, const QStringList &qmltypesFiles,
- const QString &resourceFile,
+ const QStringList &resourceFiles,
const QMap<QString, QQmlJSLogger::Option> &options, QQmlJSImporter &importer)
{
QJsonArray warnings;
@@ -189,10 +189,10 @@ static bool lint_file(const QString &filename, const bool silent, QJsonArray *js
}
};
- if (resourceFile.isEmpty()) {
+ if (resourceFiles.isEmpty()) {
check(nullptr);
} else {
- QQmlJSResourceFileMapper mapper({ resourceFile });
+ QQmlJSResourceFileMapper mapper(resourceFiles);
check(&mapper);
}
}
@@ -388,11 +388,11 @@ All warnings can be set to three levels:
}
}
- QString resourceFile;
+ QStringList resourceFiles;
if (parser.isSet(resourceOption))
- resourceFile = parser.value(resourceOption);
+ resourceFiles << parser.values(resourceOption);
else if (settings.isSet(resourceSetting))
- resourceFile = settings.value(resourceSetting).toString();
+ resourceFiles << settings.value(resourceSetting).toStringList();
#else
bool silent = false;
@@ -400,8 +400,9 @@ All warnings can be set to three levels:
bool warnUnqualified = true;
bool warnWithStatement = true;
bool warnInheritanceCycle = true;
- QStringList qmlImportPahs {};
+ QStringList qmlImportPaths {};
QStringList qmltypesFiles {};
+ QStringList resourceFiles {};
#endif
bool success = true;
QQmlJSImporter importer(qmlImportPaths, nullptr);
@@ -419,7 +420,7 @@ All warnings can be set to three levels:
for (const QString &filename : arguments) {
#endif
success &= lint_file(filename, silent, useJson ? &jsonFiles : nullptr, qmlImportPaths,
- qmltypesFiles, resourceFile, options, importer);
+ qmltypesFiles, resourceFiles, options, importer);
}
if (useJson) {