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 <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oliver Wolff 2020-04-24 13:52:32 +02:00
parent bfde4f4a96
commit 85dab30b15

View File

@ -279,11 +279,22 @@ contains(all_qt_module_deps, qml): \
for (QMLPATH, QMLPATHS): \ for (QMLPATH, QMLPATHS): \
IMPORTPATHS += -importPath $$system_quote($$QMLPATH) IMPORTPATHS += -importPath $$system_quote($$QMLPATH)
# add qrc files, too # add resources to qmlimportscanner
!isEmpty(RESOURCES) { for (RESOURCE, RESOURCES) {
IMPORTPATHS += -qrcFiles defined($${RESOURCE}.files, var) {
for (RESOURCE, RESOURCES): \ # in case of a "struct", add the struct's files
IMPORTPATHS += $$absolute_path($$system_quote($$RESOURCE), $$_PRO_FILE_PWD_) 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_)
} }