diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-09-27 13:06:09 +0300 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2021-09-27 12:13:03 +0000 |
commit | 389301dffd0ba7e02fa110aab7237296f5925f7e (patch) | |
tree | 3ccb6032a17122b8def3c804b9d543ec63201d90 | |
parent | 647897e3c966c1349a4d1d7f60ba457803509e85 (diff) | |
download | qbs-389301dffd0ba7e02fa110aab7237296f5925f7e.tar.gz |
qmlcache: fix qmlcachegen with Qt >= 5.15
Since 5.15, qmlcachegen does not filter out js and qml files
(see [0], [1]) but merely copies the content. QMake does this
unconditionally - otherwise, qml files present in .qrc are not visible
from program via QFile.
Match QMake behavior and always create a new .qrc file.
[0] 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c
[1] d5f3e7a7e319c6bd8fa8b79d8da7a6fd62b50f01
Fixes: QBS-1676
Change-Id: I495df71e14091e4b1daa50ca79a97f4685bd929a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.js | 3 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.qbs | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js index ad433736c..ec1402345 100644 --- a/share/qbs/module-providers/Qt/templates/quick.js +++ b/share/qbs/module-providers/Qt/templates/quick.js @@ -67,12 +67,13 @@ function qtQuickResourceFileOutputName(fileName) { } function contentFromQrc(product, qrcFilePath) { + var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering; var filesInQrc = scanQrc(product, qrcFilePath); var qmlJsFiles = filesInQrc.filter(function (filePath) { return (/\.(js|qml)$/).test(filePath); } ); var content = {}; - if (filesInQrc.length - qmlJsFiles.length > 0) { + if (!supportsFiltering || filesInQrc.length - qmlJsFiles.length > 0) { content.newQrcFileName = qtQuickResourceFileOutputName(input.fileName); } content.qmlJsFiles = qmlJsFiles.map(function (filePath) { diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs index ac3ab5b26..e4a1eef9e 100644 --- a/share/qbs/module-providers/Qt/templates/quick.qbs +++ b/share/qbs/module-providers/Qt/templates/quick.qbs @@ -66,6 +66,8 @@ QtModule { readonly property bool _compilerIsQmlCacheGen: Utilities.versionCompare(Qt.core.version, "5.11") >= 0 + readonly property bool _supportsQmlJsFiltering: Utilities.versionCompare(Qt.core.version, + "5.15") < 0 readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen ? "qmlcache_loader.cpp" : "qtquickcompiler_loader.cpp" @@ -156,6 +158,7 @@ QtModule { var cmds = []; var qmlCompiler = product.Qt.quick.compilerFilePath; var useCacheGen = product.Qt.quick._compilerIsQmlCacheGen; + var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering; var cmd; var loaderFlags = []; @@ -175,6 +178,8 @@ QtModule { loaderFlags.push("--resource-file-mapping=" + FileInfo.fileName(info.qrcFilePath) + ":" + info.newQrcFileName); + // Qt 5.15 doesn't really filter anyting but merely copies the qrc + // content to the new location var args = ["--filter-resource-file", info.qrcFilePath]; if (useCacheGen) |