195 Commits

Author SHA1 Message Date
Juha Vuolle
e6aa48dc2c Introduce qt_internal_add_android_permission CMake function
This is a manual cherry-pick from
5efbfcb032d801c7083d4a850d0279a075de7f1a

The function allows setting additional permission attributes like
minSdkVersion and maxSdkVersion. The function's implementation is such
that it should work alongside the older way of directly setting the
QT_ANDROID_PERMISSIONS target property.

Task-number: QTBUG-129944
Task-number: QTBUG-117358
Task-number: QTBUG-112164
Change-Id: I0f40692574848fccdf65f9baedd14351917ce4bf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5efbfcb032d801c7083d4a850d0279a075de7f1a)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-10-31 08:31:08 +02:00
Tatiana Borisova
10680554db qtbase build should't fail with -DFEATURE_process=OFF option
- Added #if QT_CONFIG(process) to the qt code that uses a QProcess

Change-Id: I79b39392bd2f75384256e5564203a8c875169916
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f6dab97455f866243132ed38a070ebb3879a0c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-09 07:45:17 +00:00
Ulf Hermann
874de78012 androiddeployqt: Do not misbehave on QML file and directory imports
Those are generally not in any import path. So far, qmlimportscanner
generates invalid "path" entries for file and directory imports, causing
androiddeployqt to skip them early on. androiddeployqt should rather not
try to read them at all. Then we can fix qmlimportscanner.

Change-Id: Ic87a10bee5845a6b10ee902ba28aed5c060956f0
Task-number: QTBUG-126632
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 67ae983d1e9c75bf31d6fada0b667cfbe2f3fc0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 07:55:17 +00:00
Alexey Edelev
589661c0d5 androiddeployqt: Fix the --sign argument handling ordering
Allow using the follow arguments after '--sign' argument in
androiddeployqt. The previous fix had no effect since we should
consider the argument count first and the type of arguments next.

Amends 9c56a77027db2fedfc2b50f96ceaee5003a7d383

Fixes: QTBUG-128254
Task-number: QTBUG-109619
Pick-to: 6.7 6.5
Change-Id: I34eac4def94c1d0c8d304f383d60c1e21b7dc6a2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fd2c408af2f300e100d94a386743c7cbe74fadef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-21 20:06:32 +00:00
Soheil Armin
c90a8a8c35 Android: Rename opt-in CMake flag that generates QML to Java code
The Java QtQmlComponent has been renamed to QtQuickViewContent
as a part of API reviews.
As a result, we also change the opt-in flag
From QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
To QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS
that adds an entry to the android-deployment-settings.json.
The flags later will be used by androiddeployqt to enable the
generation of QtQuickViewContent extensions.

Task-number: QTBUG-126976
Task-number: QTBUG-127091
Change-Id: Ie08a9430a5e5a16809f78389144a4a6dfd87ce18
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit be2c03064cdb7bef977d05371e535bedcadb3a0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-20 01:28:03 +00:00
Soheil Armin
820098c966 Android: Reflect renaming of QtQmlComponent to QtQuickViewContent
Task-number: QTBUG-126976
Task-number: QTBUG-127083
Change-Id: I001a095c2844c725c85113c03c8640f507c8f11e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 86e34dfcddf6ffd24780a50b3b4c66b9f6726b70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-20 01:28:03 +00:00
Soheil Armin
2aaafce903 Android: Fix duplicate class names when generating QML to Java code
Whe the QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS flag is present the
AndroidDeployQt generates nested classes with the same name as target
and QML module names. When the target name is the same as the QML module
name, the code gets generated successfuly but will fail at compile-time
in the target user project.

With this fix, we detect such cases and fail early, providing a proper
output message

Fixes: QTBUG-125160
Change-Id: I6303d76bc437f7eee806e4429bef81b5fbeb1e27
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit abfeb4542c9107fa40511209d25bc7d0b5db1a8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 20:55:48 +00:00
Ahmad Samir
7c663d04d7 QDirListing: add flags to handle entries filtering
By extending IteratorFlag so that it replaces both QDir::Filter and
QDirIterator::IteratorFlag enums, but with better defaults (based on how
QDir/Iterator is used in 15-20 years worth of code in Qt and KDE).

Make the QDirListing(QDir ~~) ctor private, also change it to use
QDirIterator::IteratatorFlags; it will be used to port existing code.

If QDir is ported to use QDirListing::IteratorFlags, instead of
QDir::Filters, a public QDirListing(QDir) constructor can then be added.

Fixes: QTBUG-125504
Task-number: QTBUG-125859
Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e583c3d5163a5512abac85e32359652e28a053f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-27 01:31:40 +00:00
Olli Vuolteenaho
894c1d4a35 Fix path in Java QML component generation
The parameter buildPath comes from QDir:absolutePath(), which gives a
path that starts with '/' or a drive speficiation. When calling
getImportPaths on a Windows machine the path becomes something like
"/C://dev/qt5/...". As a result, androiddeployqt exists with a failure.

On Linux/macOS systems this was not a problem because // = /

Change-Id: I85376253055549344f06c9da9ebd67364e429112
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 776982a14e53e8661c3508c3d05e0efe538bc67e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-10 07:11:02 +00:00
Soheil Armin
7282c54fe6 Android: Add Java QtQmlComponent code generator to androiddeployqt
The QtQmlComponent class is a public Java API in Qt Declarative.
ADQt extracts QML dom info using qmldom tool, and creates concrete
classes, extending QtQmlComponent, by implementing abstract methods
of it, based on target lib, QML modules & QML components.

Additionally, it iterates properties and signals of each component
and adds get/set/connect methods with appropriate arg/return value
types, to each component. Java class generation will be invoked if
generate-java-qml-components is true in the deployment settings
file.

The generated classes will be in the same package name as the target.
If the leaf part of the package has the same name as the target,
a new .java file will be created for each module, else Java code
for all modules will be generated under a root level static class
with the same name as the target name in a single .java file with
the same name as the target name.

The first letter of target name & module names get caplitalized
to match Java naming convension.

Task-number: QTBUG-124846
Change-Id: I1f94e059a6573991c991bccc32838a211f3ee456
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-31 00:58:09 +03:00
Assam Boudjelthia
4438aa5338 Android: use double quotes with androiddeployqt docs
... to avoid coloring mismatch in the generated doc page
of the tool.

Change-Id: I4334d49632c5f119a874e9112d4f13cd4d60e27a
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-05-27 17:14:34 +03:00
Assam Boudjelthia
841bbbe8ec Android: bump min supported SDK to 28 (Android 9)
Bump the minimum supported Android API from 23 to 28 i.e.
Android Oreo 9. This is done to focus more and more on
recent versions.

Fixes: QTBUG-125023
Task-number: QTBUG-124890
Change-Id: I4d510b771f413e5711dd44de454211e019c63db6
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2024-05-23 10:26:20 +03:00
Assam Boudjelthia
fbb35cdb0b Android:CMake: Add QT_ANDROID_PACKAGE_NAME property
Allow setting the package name directly from CMake properties.
If the package name is not set manually under AndroidManifest.xml
nor build.gradle, then the value set by this property is used.
The value is passed to build.gradle as "namespace" which is the
way to set the package name after AGP 7.4 instead of
AndroidManifest.xml "package" attribute.

Task-number: QTBUG-106907
Change-Id: I94bd73c294d751eabfd96c0a10a6b3ff270d8137
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-05-16 16:40:55 +03:00
Soheil Armin
28b3848989 Android: Refactor packagePath() in androiddeployqt
Make the method handle all the different possible
paths in a more clean way.

Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: If0ed1b529011b942c0fb67d0ad7a940896e03c85
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-15 12:34:08 +03:00
Soheil Armin
79f3fe7040 Android: Add facilities to build AAR packages
This adds new aar target, as we do with apk targets, and an option
to androiddeployqt, --build-aar, which builds an AAR instead of APK.

AndroidManifest.xml of an AAR does not include application or activity
nodes, so we add an AAR specific manifest. Also the plugin type in
build.gradle will be com.android.library when choosing to build an
AAR.

Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: Id33ac236f44038a8411ebfecdcc4e404c976e277
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-15 12:34:08 +03:00
Tinja Paavoseppä
e59f310061 androiddeployqt: Add a placeholder for plugin type in build.gradle
This allows to later change the plugin type based on the options
provided for the androiddeployqt, such as when building an AAR.

Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: I6314c8ab9edccbf953ae48543d5a002a9f807581
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-15 12:34:08 +03:00
Assam Boudjelthia
b740cd1f38 Android: account for namespace in build.gradle instead of manifest
AGP version 7.4 deprecated the use of "package" attribute in the
manifest to specify the unique package name, it's instead been
moved to build.gradle file and set using "namespace" property.
This patch adds support of that to androiddeployqt.

Removing the "package" attribute from the default manifest would
break Qt Creator 13 and below because Qt Creator would fail to
deploy apps without such attribute in the manifest. For that reason
we'll defer removing it until a later version, for example Qt 6.10,
to allow some buffer for a Qt Creator that can handle that to be
adopted by users to reduce breakage.

[ChangeLog][Android] Add support for namespace in build.gradle instead
of the package attribute in the manifest.

Pick-to: 6.7
Task-number: QTBUG-106907
Change-Id: Ib0f0d6a6fbb3b38f605aadfdcc497067daf90297
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-05-15 12:34:08 +03:00
Marc Mutz
0a48730d08 androiddeplyqt: port to RAII handling of popen()ed FILE*s
Coverity found several FILE* leaks (since fixed) in the code, so make
sure that those can't happen anymore, by using unique_ptr to manage
the pclose() of the openProcess() FILE handles.

Keep the actual type of the unique_ptr instantiation local to
openProcess() so that creation and destruction are defined close
together, notwithstanding the occasional explicit pclose() calls to
capture the error code.

As a drive-by, port a naked popen() to openProcess(), make some
variables const and replace 0 with nullptr.

Pick-to: 6.7 6.5
Coverity-Id: 378357
Coverity-Id: 378442
Change-Id: I2b06b99cba1e4eb5b8963a9c5d2cb398eb25a8b3
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-05-15 07:10:46 +02:00
Marc Mutz
db240d99cf androiddeplyqt: fix more missing pclose() on early returns
Found by Coverity.

This code predates the move of androiddeployqt to qtbase.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Coverity-Id: 378442
Change-Id: Icc24918159132c55a3817eaf19c96ea212dfa6dc
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2024-04-18 10:31:01 +01:00
Marc Mutz
c64b30129d androiddeplyqt: fix missing pclose() on early return
Found by Coverity.

Amends 5bb178c479a247720fbc3fbb7f06a32b725193ac.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Coverity-Id: 378357
Change-Id: I8839280ce15d8e7d9e1f4024ca796c2d8b4ed930
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2024-04-18 10:31:01 +01:00
Ahmad Samir
7cf39bd785 Port to QDirListing
Use QDirListing in the Bootstrap build instead of QDirIterator.

Drive-by changes:
- more const variables
- use emplace_back() instead of append() where appropriate

Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-03 14:02:07 +02:00
Ahmad Samir
56e151663e androiddeployqt: fix QDirIterator::next() usage
The code inside the loop body uses it.next() twice, however hasNext() is
called only once; each call to next() advances the iterator.

Amends 4041610cb202699a47268975e5aaecaa1f182c0a.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Idb96cfbddc56e0d7ed38ab1b0279f40592c75175
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-03-01 23:12:56 +00:00
André Klitzing
ad8047daf1 Fix documentation of used digest and signature algorithm
SHA-256 is used since 2019.
This amends c9f8893000249bd5701674c53d18a823b4a1c629.

Pick-to: 6.7 6.6 6.5
Change-Id: I005aa3414e4606045c8c3b01d71547efcf4122ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-15 16:24:29 +00:00
Alexey Edelev
438837ce27 Add the support of the qt_import_plugins functionality to androiddeployqt
qt_import_plugins allows to control application deployment on
non-Android platforms. This adds support for the pre-defined plugin list
that is computed using the qt_import_plugins input.

Task-number: QTBUG-118829
Change-Id: Iaa9c3f600533a4b5a3079ab228fabf212d9ce5a5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-11 18:40:34 +01:00
Marc Mutz
2a0b9f0b90 tools: port away from QPair
Pick-to: 6.7
Task-number: QTBUG-115841
Change-Id: If122a1c17b1b4092b115521cec814ce3b508cd80
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-12-14 20:29:45 +01:00
Rami Potinkara
7b84cd62b0 Android: bump Android target API level to 34
Bumped on network related .gradle files too.

Fixes: QTBUG-119145
Change-Id: I95f70e6cda1aad7a6bd7246c623eb6f143a829cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-30 08:57:55 +02:00
Nikunj Arora
1e7fa7dbe8 androiddeployqt: Copy templates and stdcpp lib in auxillary mode
[ChangeLog][Android][Deployment Changes]  Now the auxillary mode
of androiddeployqt also copies the templates and the stdcpp lib
file without building the APK.

Fixes: QTBUG-115241
Change-Id: I3d4647277e7f62f079c683645443462ef8026948
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-19 16:32:11 +03:00
Volker Krause
d25438ebbd Search extra library paths for Android dependency XML files as well
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.

After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.

Pick-to: 6.5 6.6
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-07 09:44:00 +00:00
Assam Boudjelthia
b74f180ac0 Android: bump Android target API level to 33
To follow latest Play Store requirement.

Pick-to: 6.6.0 6.6 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-09-23 17:38:23 +00:00
Alexey Edelev
630d3328dd Iterate over all extraPrefixDirs when collecting "directories"
When collecting plugins required for the android application according
to linked targets we should take into account all prefix directories.
But not only the first one. Otherwise the order we use when adding
paths to extraPrefixDirs will affect collecting of the plugins. This
specifically leads to the issue if the user project builds custom Qt
plugins. The plugin directory from user project build tree will be
found first and all plugins from Qt installation directory are
discarded.

Pick-to: 6.6 6.5
Fixes: QTBUG-116920
Change-Id: Id94ebaf5ccd1a279a74b38b59ff535f45230e1b4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-15 12:48:57 +02:00
Anton Kudryavtsev
9c819c9073 tools: use const methods more
to avoid implicit detach

Change-Id: I6268d4397631a2a2ff54263dfd0b28a7990c5993
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:36 +03:00
Aaron McCarthy
c27798da2f androiddeployqt: Fix generation of qtDataDirectory
Commit 9db5ca87897340873a4606c651a37e0356e8f1a0 sets the default
qtDataDirectory to the value of qtInstallDirectory, which results in an
invalid path when appended to the SDK. This results in build failures
for Android when building with qbs. cmake builds are not affected as
the data directory is explicitly set in the build scripts.

Pick-to: 6.6 6.5
Change-Id: Ia29c5bae7648f5fccefe019c225e187985bd2592
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-15 16:18:41 +00:00
Assam Boudjelthia
a43f349f9c Android: allow using string based versions in compileSdkVersion
Some platform sdk packages have names that contains non-integer
characters such as android-33-ext5 or android-UpsideDownCake
which fail building with androiddeployqt because build.gradle
expects an integer only. This allows using string based versions
and also fallbacks to setting an integer only value if it finds
that the build.gradle of the project is still explicitly
converting to integer (this to avoid breaking existing projects).

Fixes: QTBUG-112465
Pick-to: 6.5 6.2 5.15
Change-Id: If8cfc0fb84f0880a43644dc0a4188671736d3e21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Assam Boudjelthia
4521dfe75a Android: fix manual deployment with ANDROID_DEPLOYMENT_DEPENDENCIES
Fix the qtforandroid (i.e. libplugins_platforms_qtforandroid) check
and avoid calling llvm-readobj on non-library files and only add them
to the dependency list.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5
Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Assam Boudjelthia
b92854aed3 Android: don't break when finding opengl plugin
avoid breaking when looking for the android plugin when the dependencies
include opengl lib, since that was valid only in the early days where
the Android plugin was separated into two raster and opengl. Now, that
assumption is wrong and might affect the way the manual dependency
works.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5 5.15
Change-Id: I025a5c8b2b064bb43a356a4ad5cb4a1ada41b09b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Fabio Falsini
dffc67e6f2 Change android target SDK version to 31
Play Store now accept only app with target
SDK version set to 31 or above

Change-Id: I7f7fb677798c3f2d3ce327226ac13a69f0bab442
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2023-03-21 14:49:08 +01:00
Assam Boudjelthia
a9c8870b5e Android: demistify the "No platform plugin" androiddeployqt error
Make the error message clearly mention that a Qt for Android app
require linking to Qt Gui library.

Along the way get rid of the libqtforandroidGL mention which
was valid when Qt for Android had separate plugins for raster
and opengl, which was removed some time ago in
8a9bd001c947e6888d37e99fc456339fd2b51b36.

Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-111933
Task-number: QTBUG-111934
Task-number: QTBUG-108643
Task-number: QTBUG-97636
Task-number: QTBUG-83997
Fixes: QTBUG-85544
Task-number: QTBUG-93185
Change-Id: I24f6c08f619d805e0d82758d35aebaf32038206c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-15 17:49:50 +00:00
Bartlomiej Moskal
f4d897f04e androiddeployqt: remove infinity loop in deleteMissingFiles
There was a possibility of infinite loop and eventually crash when
androiddeployqt was used for the second time. Everything because of
deleteMissingFiles function for clean up previous build.

When we find the same names and those are directories, we call
recursively deleteMissingFiles. The parameters we use are absoluteDir,
not absoluteFilePath. As we use parent of found dir, deleteMissingFiles
is called with the same values as before.

This commit removes possibility of infinite loop by using
absoluteFilePath. That allows to avoid calling deleteMissingFiles with
the same parameters.

There is still a possibility, that directory that was found is not the
same as we were looking for. That will cause not needed files removing,
but those file will be copied again later.

This regression was created by 7dc05252a0df829bb5ea3994160d425bb0da26cb
commit

Pick-to: 6.5 6.2
Fixes: QTBUG-111027
Change-Id: I195b4c407068b14e2ef94800ad1945adc66408cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-03-15 12:42:15 +00:00
Ville Voutilainen
1ebf8c529d androiddeployqt: make --help documentation-friendly
Change-Id: I08558d23230ec162928fea2c413ae8e2498617d7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-02-07 18:53:44 +02:00
Alexey Edelev
871f7a05db Revert "Revert "Add support for MultiABI with custom install dir of the android-build""
This reverts commit d7e8d5bb1b5a9c4b21a3d824780c672eaf4e56b1.

Reason for revert: Found a working solution for the issue.

Change-Id: Ia720cc63ece9dfb1a24067cdd9c3d79d4edbe3be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-02-02 19:03:36 +01:00
Alexandru Croitor
d7e8d5bb1b Revert "Add support for MultiABI with custom install dir of the android-build"
This reverts commit 979a21dc4ee0c6f483c6b55e9242a153d659ab6f.

Reason for revert: Caused QTBUG-110836

Task-number: QTBUG-110836
Change-Id: I4f31018954e6bb0f4e7b6db0df76d04c0a56d9b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-01 16:18:55 +00:00
Fab Stz
979a21dc4e Add support for MultiABI with custom install dir of the android-build
Right now, "multi abi builds" of android projects works only if the
android-build installation doesn't use custom install dirs
(INSTALL_PREFIX, INSTALL_BINDIR...)

At the same time, it fixes QTBUG-106533. The patches are the same as the
ones in that bugreport.

Add new items to android-*-deployment-settings.json:

    qtDataDirectory
    qtLibsDirectory
    qtLibExecsDirectory
    qtPluginsDirectory
    qtQmlDirectory

Update androiddeployqt to be able to get files from their install location

BTW (fixes QTBUG-106533):
    Install src/android/templates into INSTALL_DATADIR
    Install src/3rdparty/gradle into INSTALL_DATADIR
    Install src/android/java files into INSTALL_DATADIR
    Install all jars into INSTALL_DATADIR

Add missing path to target_qt.conf
    Update target_qt.conf to have all path. Otherwise qmake wouldn't have
    the path when installing the android-build with custom install dirs
    like INSTALL_LIBDIR & friends

Add support for a new cmake variable that can be set at build time of the
android projects: QT_ANDROID_PATH_CMAKE_DIR_${abi} (Name chosen as
brother of QT_HOST_PATH_CMAKE_DIR)

Pick-to: 6.5
Fixes: QTBUG-106533
Fixes: QTBUG-107207
Change-Id: Ia3751362ab1b5f877ecafbe02f263feac167119c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-30 14:08:14 +01:00
Alexey Edelev
9c56a77027 Move '--sign' argument to the end of the androiddeployqt command
The '--sign' argument may and may not accept two follow arguments
to specify signing path and alias from the command line. This
functionality breaks the parsing of command line arguments that
follow the '--sign' argument and expect that '--sign' is used with
no follow arguments. It does make sense to check if the arguments
passed after the --sign staring with '--' to make sure that '--sign'
with no arguments is meant to be used.

Pick-to: 6.4 6.5
Fixes: QTBUG-109619
Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-02 14:50:51 +01:00
Lu YaNing
e62a3383fb Clean up unused variables
Amends commit 5bb178c479a247720fbc3fbb7f06a32b725193ac and
c8b07f7da3ff55f92378a1e98522f318bbc43077

Change-Id: I709390e52263bf0fadb083d6f2c29562b1877a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-22 19:16:03 +08:00
Alessandro Portale
724329b79e androiddeployqt: Avoid extra modifying of gradle's *.properties files
On each run of androiddeployqt involving gradle, the "merging" of
gradle's *.properties files inserted empty lines.

Change-Id: I7a8314cd0adf4d85663f17ac22967a08cab42b91
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-02 10:34:52 +00:00
Alexey Edelev
10372c074b Make sure that module can be imported by the provided QML import path
When resolving QML module dependencies we scan the produced by the
build system import paths for the required QML modules. Previously the
check in androiddeployqt only was confirming that the required import
starts with the one of import paths. This worked well unless the
required import is nested in higher level import path. In the situation
when we have the following build structure:
  build_dir/
    imports/
       MyModule/
          ...
and both 'build_dir' and 'build_dir/imports' directories are in QML
import paths, the MyModule QML module is resolved by the
'build_dir/imports'. But androiddeployqt assumed that it's found by
'build_dir' import path and copied the whole 'imports' directory as
the 'MyModule' QML module. The resulting bundle then had the
following content:
  qml/
    imports/
      MyModule/
        ...
  ...
instead of the correct one:
  qml/
    MyModule/
      ...
  ...

This checks if import path contains the required url-based module
path before using it as the base directory to copy the module.

Amends 0a73fb10005053945571e6cdb0b03d916715c112

Pick-to: 6.2 6.4
Fixes: QTBUG-108194
Change-Id: I79e1a8a67f62e5ae4a899ba1a4f49ee4ad44ebf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
2022-11-08 14:08:51 +01:00
Alexey Edelev
b813a5b120 Remove the special handling of the qml directory when parsing xml deps
The 'qml-root-path' option is not mandatory to have value when using
CMake, even if Qml/Quick is used in the project. This happens when
the project doesn't use .qml files. In this case the 'qml' directory
from Qt6Quick_<abi>-android-dependencies.xml is treated as a normal
folder for scanning and androiddeployqt deploys all the QML plugins
with their dependencies.

It looks like the 'qml' directory was added to bundled file in times
when qmlimportscanner was not implemented, so the need of its use is
redundant. This removes both adding the 'qml' directory as the bundled
dependency and the special case that avoids its scanning. This fix is
applicable for both CMake and qmake.

Amends 54c959643ea92c0b87a7807c64f2351328cdce7d

Task-number: QTBUG-106035
Task-number: QTBUG-107589
Change-Id: Idd55617b8ca8ab1d210cce737548ee486ea94986
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-03 09:16:42 +01:00
Alexey Edelev
769a28242e androiddeployqt: Add the missing return value check
The check doesn't affect the flow, since the same check fails the
androiddeployqt execution later, when resolving all elf dependencies.
Skipping the dependency from xml at earlier stage will allow to continue
deployment procedure, without the missing plugins and their dependencies.

Amends 54c959643ea92c0b87a7807c64f2351328cdce7d

Task-number: QTBUG-106035
Task-number: QTBUG-107589
Change-Id: Ic3d38e05f8ad283244c87858fee29d1035a0da15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-11-03 09:16:04 +01:00
Ville Voutilainen
b82c5f9b7f Android: Fix signing of APKs that are generated when an AAB is also built
To simplify matters, this removes the support for signing APKs with
just jarsigner. apksigner is always used for APKs, and jarsigner is
used for AABs. I consider that to be just fine, you _have_ to start
using apksigner eventually, and the time for that is long past.

Pick-to: 6.4 6.2 5.15
Task-number: QTBUG-91255
Change-Id: I211ae796db0f2619265deb1f30ab3cc5d1ecfbc9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-11-02 13:32:37 +02:00
Alexey Edelev
720d5cc1a4 Add flag that skips Qml import scanning to android deployment settings
If Qml module is not found it doesn't make sense to run any
functionality that is related to Qml inside androiddeployqt. Add the
deployment setting option that indicates this explicitly and set it
to true when Qml module is not found by CMake or by qmake.

Task-number: QTBUG-106939
Pick-to: 6.4 6.2
Change-Id: I1e6cffbdd230007feffe7448617097c10238a6c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-31 15:39:14 +02:00