diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-09 11:22:52 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-12-13 16:31:51 +0000 |
commit | 17feb7753607c51eee8a624fd9e4e19d48a0a793 (patch) | |
tree | c3307e0931216f0fcbdcd67204c9e82518515caa /src/qmllint | |
parent | 9d2bd53fda855dd8795bca583cbcb3eca66a6bc6 (diff) |
Pass qmldir to qmlcachegen, qmllint and qmltc, not the qmltypes file
The tools will still grudgingly accept qmltypes files being passed via
the -i option. We generally expect qmldir files, though. Ignoring the
qmldir file and importing the qmltypes directly, ignores qmldir imports,
dependencies and other component entries. This leads to unresolvable
types.
[ChangeLog][QML Tooling] qmllint expects qmldir files, not qmltypes
files to be passed via the -i option now. This enables it to see the
imports and dependencies of the module being imported. For backwards
compatibility it still accepts qmltypes files, with a warning.
Fixes: QTBUG-99043
Change-Id: I5ed32d7e78df1e604aaf1bfa2ebda09d5d57b628
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 576fafd1e69429d7387e4c35f6d15fc42af6513e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmllint')
-rw-r--r-- | src/qmllint/codegen.cpp | 4 | ||||
-rw-r--r-- | src/qmllint/codegen_p.h | 2 | ||||
-rw-r--r-- | src/qmllint/findwarnings.cpp | 4 | ||||
-rw-r--r-- | src/qmllint/findwarnings_p.h | 2 | ||||
-rw-r--r-- | src/qmllint/qqmllinter.cpp | 6 | ||||
-rw-r--r-- | src/qmllint/qqmllinter_p.h | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/qmllint/codegen.cpp b/src/qmllint/codegen.cpp index 8a7cb9389f..ecc991b6ef 100644 --- a/src/qmllint/codegen.cpp +++ b/src/qmllint/codegen.cpp @@ -39,8 +39,8 @@ QT_BEGIN_NAMESPACE Codegen::Codegen(QQmlJSImporter *importer, const QString &fileName, - const QStringList &qmltypesFiles, QQmlJSLogger *logger, QQmlJSTypeInfo *typeInfo) - : QQmlJSAotCompiler(importer, fileName, qmltypesFiles, logger) + const QStringList &qmldirFiles, QQmlJSLogger *logger, QQmlJSTypeInfo *typeInfo) + : QQmlJSAotCompiler(importer, fileName, qmldirFiles, logger) , m_typeInfo(typeInfo) { } diff --git a/src/qmllint/codegen_p.h b/src/qmllint/codegen_p.h index b9182f234a..ddf7cc3c4a 100644 --- a/src/qmllint/codegen_p.h +++ b/src/qmllint/codegen_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class Codegen : public QQmlJSAotCompiler { public: - Codegen(QQmlJSImporter *importer, const QString &fileName, const QStringList &qmltypesFiles, + Codegen(QQmlJSImporter *importer, const QString &fileName, const QStringList &qmldirFiles, QQmlJSLogger *logger, QQmlJSTypeInfo *typeInfo); void setDocument(const QmlIR::JSCodeGen *codegen, const QmlIR::Document *document) override; diff --git a/src/qmllint/findwarnings.cpp b/src/qmllint/findwarnings.cpp index b3312352b9..cd45f66541 100644 --- a/src/qmllint/findwarnings.cpp +++ b/src/qmllint/findwarnings.cpp @@ -44,12 +44,12 @@ QT_BEGIN_NAMESPACE FindWarningVisitor::FindWarningVisitor(QQmlJSImporter *importer, QQmlJSLogger *logger, - QStringList qmltypesFiles, + QStringList qmldirFiles, QList<QQmlJS::SourceLocation> comments) : QQmlJSImportVisitor( importer, logger, implicitImportDirectory(logger->fileName(), importer->resourceFileMapper()), - qmltypesFiles) + qmldirFiles) { parseComments(comments); } diff --git a/src/qmllint/findwarnings_p.h b/src/qmllint/findwarnings_p.h index 91e08561c9..e0cf7aa1d3 100644 --- a/src/qmllint/findwarnings_p.h +++ b/src/qmllint/findwarnings_p.h @@ -58,7 +58,7 @@ class FindWarningVisitor : public QQmlJSImportVisitor Q_DISABLE_COPY_MOVE(FindWarningVisitor) public: explicit FindWarningVisitor(QQmlJSImporter *importer, QQmlJSLogger *logger, - QStringList qmltypesFiles, QList<QQmlJS::SourceLocation> comments); + QStringList qmldirFiles, QList<QQmlJS::SourceLocation> comments); ~FindWarningVisitor() override = default; bool check(); diff --git a/src/qmllint/qqmllinter.cpp b/src/qmllint/qqmllinter.cpp index b75e61b884..feefa3e1a4 100644 --- a/src/qmllint/qqmllinter.cpp +++ b/src/qmllint/qqmllinter.cpp @@ -54,7 +54,7 @@ QQmlLinter::QQmlLinter(const QStringList &importPaths, bool useAbsolutePath) bool QQmlLinter::lintFile(const QString &filename, const QString *fileContents, const bool silent, QJsonArray *json, const QStringList &qmlImportPaths, - const QStringList &qmltypesFiles, const QStringList &resourceFiles, + const QStringList &qmldirFiles, const QStringList &resourceFiles, const QMap<QString, QQmlJSLogger::Option> &options) { // Make sure that we don't expose an old logger if we return before a new one is created. @@ -198,7 +198,7 @@ bool QQmlLinter::lintFile(const QString &filename, const QString *fileContents, FindWarningVisitor v { &m_importer, m_logger.get(), - qmltypesFiles, + qmldirFiles, engine.comments(), }; @@ -231,7 +231,7 @@ bool QQmlLinter::lintFile(const QString &filename, const QString *fileContents, ? u':' + resourcePaths.first() : filename; - Codegen codegen { &m_importer, resolvedPath, qmltypesFiles, m_logger.get(), &typeInfo }; + Codegen codegen { &m_importer, resolvedPath, qmldirFiles, m_logger.get(), &typeInfo }; codegen.setTypeResolver(std::move(typeResolver)); QQmlJSSaveFunction saveFunction = [](const QV4::CompiledData::SaveableUnitPointer &, const QQmlJSAotFunctionMap &, diff --git a/src/qmllint/qqmllinter_p.h b/src/qmllint/qqmllinter_p.h index 164ed313fe..d361942719 100644 --- a/src/qmllint/qqmllinter_p.h +++ b/src/qmllint/qqmllinter_p.h @@ -56,7 +56,7 @@ public: bool lintFile(const QString &filename, const QString *fileContents, const bool silent, QJsonArray *json, const QStringList &qmlImportPaths, - const QStringList &qmltypesFiles, const QStringList &resourceFiles, + const QStringList &qmldirFiles, const QStringList &resourceFiles, const QMap<QString, QQmlJSLogger::Option> &options); const QQmlJSLogger *logger() const { return m_logger.get(); } |