149 Commits

Author SHA1 Message Date
Alexey Edelev
cda51bcd9c Move detecting of USE_TERMINAL flag to a separate function
The logic is generic, make it accessible from the function.

Pick-to: 6.8 6.9
Change-Id: Ib361399722dba689891d301e20b3f713450e676f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-03-26 01:14:33 +01:00
Alexey Edelev
2c86eaee49 Add getter for the path to androiddeployqt executable
Return the androiddeployqt TARGET, which can be used in custom commands
or if the target doesn't exist, fall back to old approach and use
the full path to the host androiddeployqt. If both are not found,
encourage users to reinstall Qt or report the bug.

Pick-to: 6.8 6.9
Change-Id: I9f487b0f0af8703a9387b9c0cf8baae47859658e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-26 01:14:33 +01:00
Alexey Edelev
9819e9c2e0 Move the genex that returns Android SDK tools revision to a function
The genex will be generic, so make it accessible from function.

Pick-to: 6.8 6.9
Change-Id: I83246890e2d81f3cdbbd8fe2b93d59968623a889
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-03-26 01:14:33 +01:00
Alexey Edelev
b434e0be79 Change _qt_internal_android_get_target_android_build_dir signature
Swap the argument order so the "output" is the first argument.

Pick-to: 6.5 6.8 6.9
Change-Id: I1325af97f1d6540c6897b51f1b5736b4534f6412
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-26 01:14:33 +01:00
Alexey Edelev
2adf941060 Prepend '_' to qt_internal_android_get_target_android_build_dir
Adjust the function name according to our naming convention for
private function locating in public cmake scripts.

Pick-to: 6.5 6.8 6.9
Change-Id: I3a108cdb43bd4b3d8cf29ac4c42c7c20c541afc8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-03-26 01:14:32 +01:00
Alexey Edelev
f10f609db9 Move the Android deployment config type detecting to a separate function
Since the deployment config type detecting is generic, move it a
separate function.

Pick-to: 6.8 6.9
Change-Id: If925b6e14ba0d64a003e7f9ae2a5d701b7886920
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-03-26 01:14:32 +01:00
Alexey Edelev
7a6b3e1a9c Ensure <target>_copy_apk_dependencies is called for QtC build
QtC doesn't use the make_[apk|aab|aar] targets, it runs the deployment
manually. The top-level android build target for QtC is the
<target>_prepare_apk_dir target. Make it depending on
<target>_copy_apk_dependencies target, to ensure that all abi-specific
artifacts are copied before running the deployment procedure, from
either QtC or command line.

Amends 44149f9d8b62b5343a5d06628b0c9588f035ccc2

Fixes: QTBUG-133810
Fixes: QTBUG-131862
Pick-to: 6.8 6.9
Change-Id: I4f3630798658a793b0c96a99fc4644ec1dd0504b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-02-18 21:04:21 +01:00
Alexey Edelev
312717d821 Use add_dependencies to add the Android custom target dependencies
According to the CMake documentation we should use the add_dependencies
command to add dependencies on other targets for targets created
using the add_custom_target call.
Adjust the code for the Android targets.

Task-number: QTBUG-131653
Pick-to: 6.5 6.8
Change-Id: Iec9a3036f34f065f067568ecfca838345d35ff93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-11-28 22:14:12 +01:00
Alexey Edelev
8977feb647 Introduce a new way of collecting plugin targets
Use the propagated interface property to collect the plugins for the
android deployment. This method allows collecting plugins from the Qt
libraries without using walk-libs approach with all its disadvantages.

The only limitation is the CMake version, since custom transitive
properties support was added in the CMake version 3.30.

For now it's only uses in Android deployment, will be spread wider
in followup commits.

Fixes: QTBUG-129302
Change-Id: I8d5ae7342d57d215021ad02c51dda44f88c9a920
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-11-14 00:56:12 +01:00
Alexey Edelev
76fef03f19 Android: Do not duplicate copy_if_different command for android target
The CMake copy_if_different command, which copies the android target
library to a libs/<arch> directory could be executed in different code
paths which caused a multiple access to a same file in a filesystem.

Avoid doing this and depend on <target>_prepare_apk_dir target for the
depfile code path too.

Pick-to: 6.5 6.8
Change-Id: Ib62cf24ecc69a17ce1b52cd1f001aeff866051cd
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-11-13 10:59:07 +01:00
Alexandru Croitor
a72dacce21 CMake: Add the android finalizer to Core also during the qtbase build
This will allow running the finalizer properly for Android tests in a
qtbase built with in-tree tests.

This is similar to what we do with the
_qt_internal_add_qml_deploy_info_finalizer for the Qml module.

Pick-to: 6.8
Task-number: QTBUG-93625
Task-number: QTBUG-112212
Change-Id: I233ce229054b5ce15783cf06b9a69aaa68eb8847
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-10-30 19:18:06 +01:00
Alexandru Croitor
c997e3bb8b CMake: Clean up _qt_internal_finalize_batch
The _qt_internal_finalize_batch function had a bunch of problems,
style-wise and function-wise:
- it called find_package(Qt6) in its body, which broke when
  configuring qtbase with in-tree tests

- it constantly rewrote the merged blacklist file on each
  reconfiguration

- it used file(WRITE) to concatenate content

- it was in the public API file

The changes are:
- Move the function to the internal test helpers file.

- Change it to use qt_configure_file instead of file(WRITE).

- Call it at the end of the qt_build_tests for a repo, or at the end
  of configuring a super build, instead of relying on a finalizer.

- Remove the find_package call. The reason this was added in the first
  place, was to populate the __qt_core_macros_module_base_dir variable
  so that qt_internal_add_resource configure_file call doesn't fail in
  standalone tests build.
  The variable was unset because the finalized function was called in
  the top level directory scope, whereas the very first find_package
  call was in the tests/ scope, meaning the variable was empty.
  This is still a problem in the top-level build where the tests scope
  and the top-level scope are different. Work around it by relying on
  a global property to reset the value if it's empty.

Amends 6a9e89121d7766a34c4281d298057bfbe8af36b3

Pick-to: 6.8
Change-Id: Id6fe41ee86d09b8118bea52cac8a59965d7ecb9e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-10-29 16:09:56 +01:00
Assam Boudjelthia
a905d26f14 CMake:Android: add wrapper scripts to easily run apps
Create a script that allows running an app or a test easily similar
to running on host. This improves development workflow and time by
allowing quick runs without having to manually call the various adb
commands to launch, get a pid of the app and then print the logcat,
let alone passing parameters or environment variables.

For normal apps, the app package name is retrieved by the script, run
and live logcat is printed as long as the app is still running.

For tests, the script calls androidtestrunner, allowing test parameters
to be passed to the test.

For CI debugging, this would save quite a lot of hussle and frustration
trying to run or debug a test app.

One other benefit for this is enabling running Android tests from Qt
Creator's testlib plugin without big changes to Qt Creator to support
androidtestrunner explicitly.

Because file(GENERATE) would fail if called twice for the same file,
I use file(WRITE). This is used because at the time of calling the
target executable finalizer, we don't know if the target is a test
or not, so we rely on writing the script first as a normal target,
then call it if the target is a test where it overrides the script.
For this also, parameters passed to the runner or androidtestrunner
can't handle generator expressions.

[ChangeLog][CMake][Android] Add wrapper scripts to run Android apps and
tests with ease from the host.

Task-number: QTBUG-129889
Change-Id: I84e85ce2bbf6944c8aa20bdc2c2b6d7b956bc748
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-10-16 20:40:08 +03:00
Alexey Edelev
87930bb568 Trigger reconfiguring of android ABI projects when CMake files changed
Remove the stamp files of 'configure' step to ensure that we re-run
cmake for android ABI projects, otherwise the per-ABI projects do not
consider the changes in CMake files when re-running the build.

Task-number: QTBUG-129358
Pick-to: 6.8
Change-Id: I5b5c682358052044a9e550587ed0457694857e09
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-07 08:42:53 +00:00
Alexey Edelev
44149f9d8b Reestablish the dependency chain between Android ABI-specific targets
Actual dependency chain doesn't consider the changes in Android
ABI-specific targets. To make sure we rebuild per-ABI targets this
changes the dependency chain, which looks as following now:

 - <target>_make_<apk|aar|aab>
 - <target>_copy_apk_dependencies (new proxy order-only target)
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies_stamp
 - qt_internal_android_<abi>_<target>_build_stamp
 - <target>

So the <target> dependency on the per-ABI build targets is reversed,
to guarantee that per-ABI targets react on source changes.

Pick-to: 6.8
Fixes: QTBUG-129358
Change-Id: Id4d5fb0d45a213cd49c8a6aefa72c5db6609d714
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
2024-10-02 11:23:28 +00:00
Juha Vuolle
c76c888556 Introduce qt_add_android_permission CMake function
qt_add_android_permission function can be used to set
Android permissions on target executable. This allows
setting new permissions, or overriding permissions set
by Qt modules, without needing to supply a manual application
AndroidManifest.xml.

The change consists of:
- New public CMake function for setting the permissions
  on the target + documentation
- Writing these application permissions into the deployment
  settings json file
- Reading and handling these permissions at
  androiddeployqt side
- Moving some pre-existing permission functionality from
  QtAndroidHelpers.cmake to Qt6AndroidMacros.cmake
  so that they can be reused also in the context
  of application CMakeLists.txt processing
- Documentation update for Android permission handling

In future this same mechanism can be extended for Android
features.

[ChangeLog][CMake] Added qt_add_android_permission function
for setting Android permissions from application CMake

Fixes: QTBUG-128280
Change-Id: Ia22951fb435598be00b5da5eae11b9f35f704795
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-09-16 11:59:49 +03:00
Assam Boudjelthia
a9ebb97436 CMake:Android: add property QT_ANDROID_COMPILE_SDK_VERSION
This allows to set the compile SDK version from CMakeLists.txt
instead of a parameter to androiddeployqt to give more flexibility.

Fixes: QTBUG-128364
Change-Id: I797e8f9b3c35dcb822c1b7e2b67e6b76387775ca
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-09-09 18:49:04 +03:00
Assam Boudjelthia
fe9c7dcae0 CMake:Android: add property QT_ANDROID_APP_ICON to set app icon
This allows users to set an app icon directly from CMake
without needing to manage a custom AndroidManifest.xml file.

Fixes: QTBUG-92013
Change-Id: Ic2f44978697d0f4833bde7f66630943d3032e982
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-09-09 18:49:04 +03:00
Assam Boudjelthia
c768ec64bb CMake:Android: add property QT_ANDROID_APP_NAME to set app name
With this property, a user can set the app's name directly from CMake
without having to manaully manage a custom AndroidManifest.xml file.

Fixes: QTBUG-87982
Fixes: QTBUG-121825
Fixes: QTCREATORBUG-17863
Change-Id: Ic12e13b58efbc4fb2f18be6fc854b585988485bf
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-09-09 18:49:04 +03:00
Alexey Edelev
58542f9c36 Filter the Android SDK build tools directories
Avoid using non-version like directories from the android build-tools
directory.

Fixes: QTBUG-94956
Pick-to: 6.8 6.7 6.5 6.2
Change-Id: Ib201c43db2c5ee4a67bea90027ae5363a8d06709
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-26 13:36:16 +00:00
Soheil Armin
be2c03064c 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.

Pick-to: 6.8
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>
2024-08-20 03:05:07 +03:00
Alexey Edelev
924dd10afc Make the android multi-ABI builds with Unix Makefiles pure sequential
Add the missing dependency between qt_internal_android_<abi>_configure
and the last target from previous ABI-specific step in the chain.

This slows the Unix Makefiles builds, but ensures that there is no race
condition when executing configuring step.

Also as a driven-by fix the _qt_android_abi_steps property list, by removing
the parazite -NOTFOUND entries.

Pick-to: 6.5 6.7 6.8
Fixes: QTBUG-127414
Change-Id: Ibb69dcdebd2052a7aa1d4bd0c3f657cdeb312f37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-07-24 14:37:54 +02:00
Alexey Edelev
1313c5d360 Propagate QT_USE_TARGET_ANDROID_BUILD_DIR value to ABI-specific projects
The android multi-ABI builds should consider the
QT_USE_TARGET_ANDROID_BUILD_DIR value too. Propagate the value to
the ABI-specific projects when building Android applications.

Fixes: QTBUG-126678
Pick-to: 6.8 6.7 6.5
Change-Id: Ifada0d1be7b4f11a82758ba0ee6f69051a2d53d5
Reviewed-by: Tero Koponen <tero.koponen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-06-26 21:48:56 +02:00
Alexey Edelev
69a661e88e Make the access to QT_USE_TARGET_ANDROID_BUILD_DIR explicit
CMake somehow doesn't treat the access to the cache variable in
condition as the usage. Replace the check of the
CACHE{QT_USE_TARGET_ANDROID_BUILD_DIR} value with the check of the
CACHE variable definition and the check of the CACHE and non-CACHE
value equality.

Pick-to: 6.7 6.8
Change-Id: I07d940d457ebbc4ce3cefef2f73394009d52f367
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-06-10 21:29:03 +02:00
Soheil Armin
876991d8b7 Android: Add variable to opt-in QtQmlComponent code generation
The CMake variable QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
will add "is_generate_java_qml_components" property to the
android-deployment-settings.json file to be read by
androiddeployqt, that enables/disables QtQmlComponent Java
code generation of QML components.

Task-number: QTBUG-124846
Change-Id: I5b3dc009aaa18beaa533296ce489e09c09d864e0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-05-31 00:58:13 +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
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
Alexey Edelev
018504f4f3 Move QtInstallPaths.cmake to the Qt6 package
QtInstallPaths needs to be loaded at early stages

Change-Id: Ie275ad2a8855b7555b110c35814ebadafe1817c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-22 15:31:40 +01:00
Alexey Edelev
df8c3d40c8 Use the correctly versioned variable when resolving ABI-specific cmake directory
Use the QT_CMAKE_EXPORT_NAMESPACE prefixed INSTALL_LIBS variable when
resolving the cmake path of the ABI-specific cmake directory.

Pick-to: 6.7 6.6 6.5
Change-Id: Ibc4a1b152135d840de104c15a183b13fca0739ea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-21 12:50:22 +01:00
Alexey Edelev
31a91d2e93 Ensure that per-ABI builds are sequential
The current approach doesn't work correctly because external project
steps that we run on per-ABI build directories look as
'cmake --build <abi/build/dir> --target <target_name>'. When the
project has a single APK this works perfectly fine. But when building
more than one apk this leads to the simultanous build in the same
'abi/build/dir' which causes undefined behavior and concurrent access
to the build artifacts. This is especially sensible when APK targets
have the common dependencies.

The solution is split for two usecases:
- Ninja-like generators, that support job pools.
- Other generator.

For Ninja-like generators we now create job pools per-ABI with job number 1,
this convinces ninja to run only one 'cmake --build' command in single ABI
scope.

For other generators the solution is not that good. We create the dependency
chain between all APK targets and this leads to the build of the unwanted
dependencies. For example if project has apkA and apkB targets, then
apkB_x86 will depend on apkA_x86(assuming x86 is not the main ABI). This is
the only way we may ensure that 'cmake --build' commands won't be running
simultanously.

Fixes: QTBUG-122838
Pick-to: 6.7
Change-Id: I6f48fae57047a29129836168c28e14cde4eaa958
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-14 15:54:54 +01:00
Alexey Edelev
356b0aee0e Disable depfile support for the external projects when building for Android
androiddeployqt rules that support depfiles cause creation of rules that
interfere each other and cause the test build flakiness in CI.
This disables depfile support for ABI-specific external project until the
rootcase is found.

Task-number: QTBUG-122838
Pick-to: 6.5 6.6 6.7
Change-Id: I12e85f43494331c943c9b516d9494593facf9180
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-29 16:30:31 +01:00
Alexey Edelev
bb68cc5844 Remove QT_ANDROID_DEPLOY_RELEASE variable
We assume that we can remove the variable handling and replace with the
warning, since variable was never out from TP.

Pick-to: 6.7
Task-number: QTBUG-121706
Change-Id: Iee29c0b5327d62cd3d7e77419e14e555fadcec2c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-20 17:25:25 +01:00
André Klitzing
d588924d11 Add USES_TERMINAL to add_custom_target and add_custom_command
This shows the output immediately to the console.

Pick-to: 6.7
Change-Id: Ia7f40c10ea24e4c95d5d8fa95fd1bc2bd76d61ca
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-13 23:12:40 +01:00
Alexey Edelev
d954d53c1d Use separate property to store implicitly detected QT_QML_ROOT_PATHs
Use _qt_internal_qml_root_path when collecting the qml root paths using
_qt_internal_collect_qml_root_paths. The property is only applicable for
Android builds. This suppresses the QTP0002 warning for the cases when
android application has both QML executable and QML library modules.

Amends 575b8a7fa289a2e27984a6c322069f9e1b499024

Pick-to: 6.6 6.7
Change-Id: Iccadbe1f6ed697a94dba11af3dd054baec8daf9e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-02-01 20:25:42 +01:00
Alexey Edelev
5f0575256a Use target-specific android-build directory
This fix allows using multiple executable targets in a single
CMakeLists.txt when building for android. Previously artifacts for both
targes were collected in a common android-build directory, that led to
artifacts overlaping and broke the deployment process.

Users need to set the QT_USE_TARGET_ANDROID_BUILD_DIR to TRUE to enable
the new android-build directories naming.

This change need QtC adjustments that will take a new directory naming
into account.

Task-number: QTBUG-117443
Pick-to: 6.5 6.6 6.7
Change-Id: I47568798e2a2e8550ddab1990a33611967183761
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-11 22:56:51 +01: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
Laszlo Agocs
abdef932b8 Android: add opt-out for release package signing
Release and RelWithDebInfo builds always default to passing
--release to androiddeployqt. There is an opt-in variable
(QT_ANDROID_DEPLOY_RELEASE), presumably for Debug builds,
but there is no opt-out for non-Debug builds. Instead,
there is a hack for autotests.

In addition to tests, there are situations during development
where we want to deploy a release build, but do not have or
want to set up the release signing infrastructure. Having a
variable to opt-out is then very useful.

Change-Id: I6c6b9aaccad7d9d4f86745f3ed7d3c475b383ad3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-17 19:06:34 +01:00
Alexey Edelev
1c82e92202 Make sure we initialize moc rcc and uic for manual test targets
If manual test target is created using the standard Qt API but not
qt_internal_add_manual_test command, we need initialize autotools
for these targets. Add the generic functionality that ensures that
autotools are inialized for all manual tests.

Pick-to: 6.5 6.6
Change-Id: Ic048760390174d1be2f01096d70e84458f1c870f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-16 14:34:17 +01:00
Alexey Edelev
9349e463d4 Use the actual target name as base name for android deployment settings
QtC is unable to find the deployment settigns if target uses custom
OUTPUT_NAME. There is no particular reason for using the target
OUTPUT_NAME property as the base name for android deployment settings.

[ChangeLog][General][Android] The target name is used as a base name of
android deployment settings, but not the OUTPUT_NAME property.

Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-117509
Change-Id: I1ac3b0ad305dc55289bef39c6e946bcf684e772f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-27 17:44:59 +00:00
Alexey Edelev
0e3815a7a8 Fix the android paths check
Expand the prop_name.

Amends 575b8a7fa289a2e27984a6c322069f9e1b499024

Fixes: QTBUG-116007
Task-number: QTBUG-115119
Pick-to: 6.6
Change-Id: I66537a6dbb97c89fdff1f721d091eae1d02907e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-14 18:05:43 +02:00
Alexey Edelev
575b8a7fa2 Check the QTP0002 policy only if paths are set
It doesn't make sense to disturb users with the policy warning if they
don't specify Android paths. Suppress the policy check if Android
paths are not set for the target.

Fixes: QTBUG-115119
Pick-to: 6.6
Change-Id: Ice9d0459c01feb505857133bb942b1b6e775e55a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-21 17:39:16 +02:00
Alexandru Croitor
b9b5ed3aa6 CMake: Don't set QT_BUILDING_QT for single standalone tests
Standalone test projects have the following condition in the
beginning of their project:

 if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
     find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST)
 endif()

When configuring the project the first time, QT_BUILDING_QT is not
set, find_package is called, configuration succeeds.
But because standalone projects implicitly include QtSetup.cmake,
that file sets the QT_BUILDING_QT cache var to true, and upon test
reconfiguration, cmake errors out with:
 Unknown CMake command "qt_internal_add_test"
or similar.

This happens because QT_BUILDING_QT is true on the second
reconfiguration and the find_package mentioned above is not executed
anymore, leading to unknown internal command errors.

Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect
a standalone test and check for its value in QtSetup so we don't
set QT_BUILDING_QT to TRUE anymore.

Adjust a few code locations where QT_BUILDING_QT being false might
trigger different behavior for standalone tests.

Task-number: QTBUG-93020
Change-Id: I5413b9f37653225175a1006f7626e023045b5979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-12 18:38:31 +00:00
Alexey Edelev
0be35f3a7b Evaluate the QT_ANDROID_DEPLOYMENT_SETTINGS_FILE property
Make sure that QT_ANDROID_DEPLOYMENT_SETTINGS_FILE is expanded
correctly and completely when using it in custom commands.

Task-number: QTBUG-114888
Pick-to: 6.5 6.6
Change-Id: I87c9cb052ea6afedd129fec0a1c415ad38e8eeb5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-06-28 11:13:16 +00:00
Bartlomiej Moskal
a273ea7f41 Android: fix problem with release package for cmake based builds
After 9efaf8bae914958a09d29a4cdbf62e345f3e6369 commit there was no
possibility to create release package for cmake based builds.
The new cmake variable (QT_ANDROID_DEPLOY_RELEASE) was already added to
allow turning on release build manually

This commit sets the --release flag automatically for androiddeployqt
tool for Release, RelWithDebInfo and MinSizeRel build types.

The --release flag is not set automatically if QT_BUILD_TESTS variable
is set. This is the workaround for tests. Release package need to be
signed. Signing is currently not supported by CI. What is more, also
androidtestrunner is not working on release APKs.

Fixes: QTBUG-112921
Fixes: QTBUG-108132
Task-number: COIN-882
Pick-to: 6.5
Change-Id: Ia81465f4a0f0e5b8dfa50c44028658f7a2346c1a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-24 12:58:27 +02:00
Alexey Edelev
f71eb4a642 Avoid littering CMake logs with QTP0002 warnings
It doesn't make any sense to setup and get policy when we build either
Qt or standalone tests, since the value will be ignored anyway. So
skip the policy setup for Qt builds to avoid littering the CMake logs
with QTP0002 warnings.

Amends c4debab927671de802d377f31e4fff4136da9104

Change-Id: Iacae8f9ecbb6c9da2f3af77b2016454c8d4194e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-12 17:55:21 +02:00
Alexey Edelev
a3cb388eaa Check if next property in the list is not empty before adding a comma
Property merging genex only checks if previous value is not empty, but
doesn't check if an actual value that we concatenate is not empty too.
Add the check to make sure we don't have trailing comma in the json
lists.

Fixes: QTBUG-112885
Pick-to: 6.5
Change-Id: I1a5265ddf1b12f763650daf3c6e3538ed52a1674
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-05-12 14:20:28 +00:00
Bartlomiej Moskal
64db65ae90 Android: fix problem with release package for cmake based builds
After 9efaf8bae914958a09d29a4cdbf62e345f3e6369 commit there is no
possibility to create release package for cmake based builds.

Added a new cmake variable (QT_ANDROID_DEPLOY_RELEASE) to allow turning
on release build manually.

Task-number: QTBUG-112921
Task-number: QTBUG-108132
Task-number: COIN-882
Pick-to: 6.5
Change-Id: Idf015b4ad3f8cba792aab75a01e1c81225cad4f0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-05-11 12:47:52 +02:00
Assam Boudjelthia
65d79fb5f3 Android:CMake: use correct key for manual deployment dependencies
androiddeployqt expects a key deployment-dependencies for dependencies
provided by QT_ANDROID_DEPLOYMENT_DEPENDENCIES.

Pick-to: 6.2 6.5
Task-number: QTBUG-94232
Change-Id: I3fc32e0677db3ee69e24b3aeca74bedd9c7ced58
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-05 00:04:28 +01:00
Alexey Edelev
c4debab927 Introduce QTP0002 policy for android-specific target properties
The policy controls the behavior of the android-specific target
properties that specify paths.

The OLD behavior of this policy doesn't allow generator expressions
in the target properties that specify android-specific paths but
implicitly converts the specified paths to the valid JSON strings.

The NEW behavior of this policy allows using generator expressions
in the target properties that specify android-specific paths but they
must evaluate to valid JSON strings.

[ChangeLog][Android] Target properties that specify android-specific
paths now support generator expressions, but these generator
expressions must be evaluated to valid JSON strings. The behavior is
controlled by the policy QTP0002. The OLD policy behavior is deprecated
and the NEW behavior is preferred for use.

Fixes: QTBUG-107988
Change-Id: I8484c4b5d5ace25eb04f8bc8a79ddbaa9a79b19b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-28 16:10:40 +02:00
Alexey Edelev
478a5248f3 Expose files locating in QT_ANDROID_PACKAGE_SOURCE_DIR to IDE
"GLOB_RECURSE" files in the QT_ANDROID_PACKAGE_SOURCE_DIR directory
if it's specified and expose them to IDE.

Fixes: QTBUG-110810
Pick-to: 6.5
Change-Id: I3c4d4fdf0dff8965fd277672ef9d77453839b4cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 12:59:40 +01:00