diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-18 08:45:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-19 11:32:23 +0200 |
commit | d5f3e7a7e319c6bd8fa8b79d8da7a6fd62b50f01 (patch) | |
tree | 00cee94731290b1ade5ee869c0e4adf022f51b59 /tools/qmlcachegen/qmlcachegen.cpp | |
parent | 567fc7b40efb451f12eddd9615bae892dcba707f (diff) |
Fix regression when using CONFIG+=QtQuickCompiler and .qrc files in subdirs
Commit 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c removed the processing
of .qrc files that removed .qml/etc. files. Since the chaining of
resources remains critical to ensure that the cached compilation units
are loaded, the build system copied the input .qrc file to a new one.
That mere copying caused the build to break when the copied .qrc file
was not in the same directory as the original one, as file paths within
the .qrc file are interpreted as relative to the .qrc file, which was
now in a different location. To fix this, this patch brings back the
"filtering" code that rewrites the paths to the source files in the .qrc
file.
Fixes: QTBUG-78253
Change-Id: Ie1d56f3248e713a964260bc2da37c9374f7b6a36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qmlcachegen/qmlcachegen.cpp')
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 41171b3f07..920f451b84 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -47,6 +47,7 @@ using namespace QQmlJS; +int filterResourceFile(const QString &input, const QString &output); bool generateLoader(const QStringList &compiledFiles, const QString &output, const QStringList &resourceFileMappings, QString *errorString); QString symbolNamespaceForPath(const QString &relativePath); @@ -417,6 +418,8 @@ int main(int argc, char **argv) parser.addHelpOption(); parser.addVersionOption(); + QCommandLineOption filterResourceFileOption(QStringLiteral("filter-resource-file"), QCoreApplication::translate("main", "Filter out QML/JS files from a resource file that can be cached ahead of time instead")); + parser.addOption(filterResourceFileOption); QCommandLineOption resourceFileMappingOption(QStringLiteral("resource-file-mapping"), QCoreApplication::translate("main", "Path from original resource file to new one"), QCoreApplication::translate("main", "old-name:new-name")); parser.addOption(resourceFileMappingOption); QCommandLineOption resourceOption(QStringLiteral("resource"), QCoreApplication::translate("main", "Qt resource file that might later contain one of the compiled files"), QCoreApplication::translate("main", "resource-file-name")); @@ -462,6 +465,10 @@ int main(int argc, char **argv) if (outputFileName.isEmpty()) outputFileName = inputFile + QLatin1Char('c'); + if (parser.isSet(filterResourceFileOption)) { + return filterResourceFile(inputFile, outputFileName); + } + if (target == GenerateLoader) { ResourceFileMapper mapper(sources); |