From 85dab30b157babc5c59920ddc8a1710fb6d9efd1 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 24 Apr 2020 13:52:32 +0200 Subject: Fix building of autotests for certain configurations When a configuration is static and has builtin_testdata defined, it was possible that the "testdata" resource that is generated in testcase.prf was used for a qmlimportscan directly. This generated test data resource is no file though. It's a "qmake struct" that contains files and a base folder so that we should add every file from the "file list" of that struct. It is possible, that the generated resource has a base, but no files. Thus we need two loops or we can end up with a command line that ends with "-qmldir". If qmlimportscanner decided to warn/error out in this case in the future this feature could be broken and the point of breakage might not be obvious. Change-Id: I2111f594f7d5cf40521b8fe9236a8be9e2ed1b07 Reviewed-by: Edward Welbourne Reviewed-by: Joerg Bornemann --- mkspecs/features/qt.prf | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index fc46bcb74b..6fe0059bf7 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -279,11 +279,22 @@ contains(all_qt_module_deps, qml): \ for (QMLPATH, QMLPATHS): \ IMPORTPATHS += -importPath $$system_quote($$QMLPATH) - # add qrc files, too - !isEmpty(RESOURCES) { - IMPORTPATHS += -qrcFiles - for (RESOURCE, RESOURCES): \ - IMPORTPATHS += $$absolute_path($$system_quote($$RESOURCE), $$_PRO_FILE_PWD_) + # add resources to qmlimportscanner + for (RESOURCE, RESOURCES) { + defined($${RESOURCE}.files, var) { + # in case of a "struct", add the struct's files + base = $$RESOURCE.base + for (f, $$RESOURCE.files): SCANNERRESOURCES += "$$base/$$f" + } else { + # if the resource is a file, just add it + SCANNERRESOURCES += $$RESOURCE + } + } + + !isEmpty(SCANNERRESOURCES) { + IMPORTPATHS += -qrcFiles + for (RESOURCE, SCANNERRESOURCES) + IMPORTPATHS += $$absolute_path($$system_quote($$RESOURCE), $$_PRO_FILE_PWD_) } -- cgit v1.2.3