aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qml/qmlcachegen/data/skip.qrc5
-rw-r--r--tests/auto/qml/qmlcachegen/qmlcachegen.pro5
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp14
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf12
4 files changed, 34 insertions, 2 deletions
diff --git a/tests/auto/qml/qmlcachegen/data/skip.qrc b/tests/auto/qml/qmlcachegen/data/skip.qrc
new file mode 100644
index 0000000000..391e4f7508
--- /dev/null
+++ b/tests/auto/qml/qmlcachegen/data/skip.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/not/">
+ <file alias="Skip.qml">Retain.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
index 452bd7d04a..dc1c4dc4dc 100644
--- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro
+++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
@@ -28,11 +28,12 @@ workerscripts_test.prefix = /workerscripts
RESOURCES += \
workerscripts_test \
trickypaths.qrc \
- data/retain.qrc
+ data/retain.qrc \
+ data/skip.qrc
# QTBUG-46375
!win32: RESOURCES += trickypaths_umlaut.qrc
-QTQUICK_COMPILER_RETAINED_RESOURCES += retain.qrc
+QTQUICK_COMPILER_SKIPPED_RESOURCES += data/skip.qrc
QT += core-private qml-private testlib
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index c6ec2eb780..652942b243 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -56,6 +56,7 @@ private slots:
void functionExpressions();
void versionChecksForAheadOfTimeUnits();
void retainedResources();
+ void skippedResources();
void workerScripts();
@@ -411,6 +412,19 @@ void tst_qmlcachegen::retainedResources()
QVERIFY(file.readAll().startsWith("import QtQml 2.0"));
}
+void tst_qmlcachegen::skippedResources()
+{
+ QFile file(":/not/Skip.qml");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY(file.readAll().startsWith("import QtQml 2.0"));
+
+ QQmlMetaType::CachedUnitLookupError error = QQmlMetaType::CachedUnitLookupError::NoError;
+ const QQmlPrivate::CachedQmlUnit *unit = QQmlMetaType::findCachedCompilationUnit(
+ QUrl("qrc:/not/Skip.qml"), &error);
+ QCOMPARE(unit, nullptr);
+ QCOMPARE(error, QQmlMetaType::CachedUnitLookupError::NoUnitFound);
+}
+
void tst_qmlcachegen::workerScripts()
{
QVERIFY(QFile::exists(":/workerscripts/data/worker.js"));
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 2e8e3f91b4..d1b7a5aad5 100644
--- a/tools/qmlcachegen/qtquickcompiler.prf
+++ b/tools/qmlcachegen/qtquickcompiler.prf
@@ -25,6 +25,13 @@ defineReplace(qmlCacheResourceFileOutputName) {
return($${name})
}
+defineTest(qtQuickSkippedResourceFile) {
+ for(skippedRes, QTQUICK_COMPILER_SKIPPED_RESOURCES) {
+ equals(1, $$skippedRes): return(true)
+ }
+ return(false)
+}
+
# Flatten RESOURCES that may contain individual files or objects
load(resources_functions)
qtFlattenResources()
@@ -34,6 +41,11 @@ NEWRESOURCES =
QMLCACHE_RESOURCE_FILES =
for(res, RESOURCES) {
+ qtQuickSkippedResourceFile($$res) {
+ NEWRESOURCES += $$res
+ next()
+ }
+
absRes = $$absolute_path($$res, $$_PRO_FILE_PWD_)
rccContents = $$system($$QMAKE_RCC_DEP -list $$system_quote($$absRes),lines)
contains(rccContents,.*\\.js$)|contains(rccContents,.*\\.qml$)|contains(rccContents,.*\\.mjs$) {