Commit Graph

11 Commits

Author SHA1 Message Date
Assam Boudjelthia 9bdfea7f1f Android: various test fixes
2nd round of test failures fixes for Android. Mostly resource bundling
related issues still.

Pick-to: 6.2 6.3
Task-number: QTBUG-97056
Change-Id: I2fac0710a7b5528fcef4480babd0cbf749e488b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-03-02 15:21:09 +02:00
Ulf Hermann bf38043b61 CMake: Include upper case .js and .mjs files in qmldir
You can use them as singletons.

Pick-to: 6.2 6.3
Fixes: QTBUG-100326
Change-Id: I8e07600657bd43ba8376279ffe39cfa5d3213c38
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-01 15:21:27 +01:00
Ulf Hermann 14a3b34906 Fix generation of names in qmldir files
Dots in QML module names are useless because you cannot instantiate a
component with a dot in its name. We might as well strip all the
extensions when adding components to a qmldir file. This takes care of
.ui.qml as well.

Furthermore, JavaScript files must not be listed because they cannot be
instantiated as QML components.

Change-Id: I9782420ea79fef1d5eedef97cf7a748b96ddbe2b
Pick-to: 6.2 6.2.0
Fixes: QTBUG-96301
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
2021-09-08 22:19:44 +02:00
Craig Scott f4d5e27080 Add NO_RESOURCE_TARGET_PATH option for executable backing targets
For tooling to work when a QML module is associated with an
executable rather than a library, it still needs the standard QML
directory structure in the build directory. But the source tree
is often not structured that way for the .qml files that are part
of the executable's QML module. The NO_RESOURCE_TARGET_PATH option
allows the project to essentially keep the structure from the
source tree in the resources, but use the standard QML structure
in the build directory for tooling.

Task-number: QTBUG-95598
Pick-to: 6.2
Change-Id: I53145ced0e57d7ea4795bb5260dd464f6458f444
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-08-18 11:31:54 +10:00
Craig Scott 40f4f8d6ec Fix plugin importing in tst_qmlbasicapp
We get no automatic static plugin importing and linking for QML, so we
have to do it manually ourselves. This includes all of the Qt QML
modules we reference too.

This also uncovered that the tst_qmlbasicapp test requires QtQuick, but
no check was added in ccd3907b12 where
the dependency was introduced. Add that check so that the test is now
only added if QtQuick is enabled.

And because the tst_qmlbasicapp test defines static plugins,
we need CMake 3.21 or later to avoid linker command line
ordering issues. Make adding the test conditional on that too.

Pick-to: 6.2
Change-Id: I0f41352fb2fe9bd6548bf30eb8ed93366cefd263
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-29 20:31:05 +10:00
Fabian Kosmale ccd3907b12 Add test for Q_IMPORT_QML_PLUGIN
The CMake API needs to be adjusted to make this more convenient, but the
test shows that the basic idea works.

Pick-to: 6.2
Change-Id: I523069f33f8e3a8418224b8872b191d4229548b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-20 10:43:56 +02:00
Ulf Hermann 79d0517a12 CMake: Always add the qmldir to the resource file system
We want to be able to load modules directly from the resource file
system, no matter if we build statically or dynamically. It's limited by
the need to load plugins, of course, but as most plugins are optional an
application can easily go this way and never include any plain QML files
in an application bundle.

Pick-to: 6.2
Change-Id: I94657a43b47e442722a83e1fb306680aa50b1bc3
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2021-07-01 13:25:56 +02:00
Ulf Hermann bae18ecd34 QtQml: Key plugins by URI where possible
This allows us to associate different qmldir files for the same module
with one another. Typically there is one qmldir file in the resource
file system and one in the QML import path. We cannot load plugins for
the latter, but usually we have already loaded any plugins we need. Now
we can detect this.

This requires us to construct a proper URI for implicit imports. The
easiest way to do this is to just use the URI from the qmldir if
available.

Modules with versions encoded in their paths and modules with multiple
plugins cannot be resolved by URI only. These continue to be keyed by
path. However, as we do not generate such modules, we will not
automatically get two instances of those, and we won't have to fall back
from one to the other.

Pick-to: 6.2
Change-Id: Ic79add936d263a8e559fd998fca15a6ae160952e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-30 10:08:03 +02:00
Ulf Hermann 88424ba1bf CMake: Add qmldir classname entry only if there is a plugin
A class name without a plugin is pointless.

Pick-to: 6.2
Change-Id: I3cfd95bc7d9dd9e80d7f23fbd6e2c2b2b855763d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-24 10:53:18 +02:00
Ulf Hermann c9e901db89 CMake: Copy RESOURCES files to the build directory, too
We need to treat them exactly like QML_FILES.

Pick-to: 6.2
Change-Id: I5582ad933c844c55f9015478672607e6d1218d84
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-24 10:53:18 +02:00
Ulf Hermann 5e78dc847d Add basic QML application to test CMake API for QML modules
An application with two modules which allows us to check that all the
files end up in the right places.

Pick-to: 6.2
Change-Id: I58557d453e644e13f2eb646ec3195bba2654f569
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-24 10:53:18 +02:00