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/qml/Qt6QmlMacros.cmake | |
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/qml/Qt6QmlMacros.cmake')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 68dfe2af26..b80a2db126 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -1022,7 +1022,7 @@ function(qt6_target_compile_qml_to_cpp target) set(args_single NAMESPACE) set(args_multi FILES) - # TODO: add qmltypes argument + # TODO: add qmldir argument # TODO: add qml import path argument cmake_parse_arguments(PARSE_ARGV 1 arg @@ -1555,7 +1555,12 @@ function(qt6_target_qml_sources target) endif() if(NOT no_cachegen AND arg_QML_FILES) - _qt_internal_genex_getproperty(types_file ${target} QT_QML_MODULE_PLUGIN_TYPES_FILE) + + # Even if we don't generate a qmldir file, it still should be here, manually written. + # We can pass it unconditionally. If it's not there, qmlcachegen or qmlsc might warn, + # but that's not fatal. + set(qmldir_file ${output_dir}/qmldir) + _qt_internal_genex_getproperty(qmlcachegen ${target} QT_QMLCACHEGEN_EXECUTABLE) _qt_internal_genex_getproperty(direct_calls ${target} QT_QMLCACHEGEN_DIRECT_CALLS) _qt_internal_genex_getjoinedproperty(arguments ${target} @@ -1575,7 +1580,7 @@ function(qt6_target_qml_sources target) endif() set(cachegen_args ${import_paths} - "$<${have_types_file}:-i$<SEMICOLON>${types_file}>" + -i "${qmldir_file}" "$<${have_direct_calls}:--direct-calls>" "$<${have_arguments}:${arguments}>" ${qrc_resource_args} |