summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6AndroidGradleHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Add signing support for modern android bundlesAlexey Edelev2025-07-241-6/+79
| | | | | | | | | | | | | | | | Use gradle based signing mechanism for the modern Android bundles. From the interface perspective signing remains unchanged: QT_ANDROID_SIGN_<AAB|APK> flags control if the package should be signed. The credentials are taken from the QT_ANDROID_KEYSTORE_* environment variables. Signing is done in separate CMake script to avoid storing passwords inside build scripts. Scripts reads passwords from the environment when the respective signing rule is running. Change-Id: Id1097b2b6d011a63c58e5a441c5360a1a5d97e8f Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Use _qt_internal_android_get_gradle_property for ROOT_PROJECT_NAMEAlexey Edelev2025-07-241-7/+2
| | | | | | | | | _qt_internal_android_get_gradle_property makes the same generator expression as the one created manually for the ROOT_PROJECT_NAME substitution. Generalize this. Change-Id: I4c17d5fa2ac75b057b0ed98dc1a92142cb1ea20e Reviewed-by: Alexandru Croitor <[email protected]>
* Release AndroidManifest.xml template from genex placeholdersAlexey Edelev2025-07-071-3/+8
| | | | | | | | | | | | | | | Read the template and substitute symbols that are sensitive for generator expression processor with the respective generator expressions implictily, instead of forcing users to use them in templates. Side effect of this change - users cannot specify generator expressions directly in templates anymore, not that we already anounced this feature, but is worth mentioning. Change-Id: I565b0c0780211801467627ed4f3de3629b8efa08 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Add dynamic feature supportAlexey Edelev2025-07-071-8/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce the qt6_add_android_dynamic_features function. The function marks the targets specified in the FEATURE_TARGETS argument as dynamic features, assigned to the specific Android application target. The dynamic feature target must be the SHARED_LIBRARY and not the Android target of type different from the DYNAMIC_FEATURE type. The design allows many-to-many component linking, so multiple Android applications may use same dynamic feature, and single Android application may use many dynamic features. Dynamic features are deployed as part of the main Android application aab and use the QT_ANDROID_MODERN_BUNDLE as the required pre-requisite. Limitations: - Dynamic features only implemented for the single ABI builds. - Dynamic features are not tested and proved in multi-config builds. - Qt disallowed to provide the store API to load dynamic features. Users need to follow Qt guidelines and documentation to implement own feature delivery. Task-number: QTBUG-116683 Task-number: QTBUG-124600 Change-Id: Idf10d481cedfe1cb5bd08c86e57a844e502bd6ff Reviewed-by: Assam Boudjelthia <[email protected]>
* Generate features in AndroidManifest.xmlAlexey Edelev2025-07-071-0/+11
| | | | | | | | Use the transitive INTERFACE_QT_ANDROID_FEATURES property to generate user feature declarations in AndroidManifest.xml. Change-Id: I6d49da12dc708abe125546241a268bb4ed6937d1 Reviewed-by: Alexandru Croitor <[email protected]>
* Rework android permission handlingAlexey Edelev2025-07-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current QT_ANDROID_PERMISSIONS property format is inconvenient for use in the CMake generator expressions and mixes attribute syntax with CMake list syntax. This suggests the new format for the QT_ANDROID_PERMISSIONS property. Each element is encoded the following way: <android:name>\;<permission>\\\;<extra1>\;<value>\\\;<extra2>\;<value> Elements are separated using standard CMake semicolons. QT_ANDROID_PERMISSIONS is now transitive LINK property. This feature deprecates the '<permission' records in the Qt6<Module>-android-dependencies.xml files. If application links Qt Module that requires specific permissions, these permissions will be written to the application deployment-settings.json file. The 'permissions' record in the application deployment-settings.json file is changed too, the new format is following: "permissions": [{ "name": "permission", "extra1": "value", "extra2": "value" }] Comparing to the previous format each extra attribute is stored under a separate key in permission object. IMPORTANT: androiddeployqt has no backward compatibility with the old format. With QT_USE_ANDROID_MODERN_BUNDLE enabled permissions are written directly to the AndroidManifest.xml without androiddeployqt involved. Supply tests for the Android permissions, that reads the manifest-declared permissions in test using the Android PackageManager API. Change-Id: I691df33c70acc6c7139302b119edc791fef8d5ef Reviewed-by: Assam Boudjelthia <[email protected]>
* Add function to generate AndroidManifest from templateAlexey Edelev2025-07-071-15/+77
| | | | | | | | | | | | | | | | | | This now generates AndroidManifest.xml for the Qt applications in CMake space if QT_USE_ANDROID_MODERN_BUNLDE is enabled. The generated CMake AndroidManifest.xml has less functionality comparing to the one that is generated by androiddeployqt. But the missing parts will be implemented later. Known issue: androiddeployqt still provides its own AndroidManifest.xml, so there is an issue in the iterative builds, since there is no declaration in CMake that androiddeployqt actually writes this file. This will be fixed in further patchsets. Change-Id: I219b7f7c85a76c070b0c98c6fe72a68a38fe92bf Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* Make dependencies property more flexible in its syntaxAlexey Edelev2025-07-071-3/+3
| | | | | | | | | | Allow using varios quotes in android gradle dependency definitions, so dependencies are not necessarly in 'package:component:version' format. The syntax unlocks the use of gradle functions. Change-Id: If9fcca3c850258edc0a33e04304a9dc0b2f1eb69 Reviewed-by: Alexandru Croitor <[email protected]>
* Add DEPLOYMENT_DIR argument in gradle scripts generating functionsAlexey Edelev2025-07-071-6/+17
| | | | | | | | | This allow to use the respective functions more flexible and pass a path to the deployment directory from outside. Change-Id: Iaa7b0cdb5167f8b05312f15478ba3927dc3b9983 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* Add support for QT_ANDROID_PACKAGE_SOURCE_DIR to modern bundlesAlexey Edelev2025-07-071-17/+115
| | | | | | | | | | | | | | Copy contents of QT_ANDROID_PACKAGE_SOURCE_DIR to the target android build directory. Comparing to the non-modern bundle deployment, this also support the partial template deployment. This means that known template files in QT_ANDROID_PACKAGE_SOURCE_DIR are evaluated first and only then copied. Cover QT_ANDROID_PACKAGE_SOURCE_DIR with tests. Change-Id: Iae1517f0b5bb359a815c7bec576a12f6232649f2 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Introduce _qt_internal_android_get_template_pathAlexey Edelev2025-07-071-15/+50
| | | | | | | | Function considers the user-provided Android deployment templates, when generating deployment scripts for modern bundles. Change-Id: I69262802bb80953a52dd6216a131e566d1332f5c Reviewed-by: Alexandru Croitor <[email protected]>
* Adjust Android templates directory structureAlexey Edelev2025-07-071-2/+2
| | | | | | | | Reflect the Android project directory structure in Android templates. Change-Id: If8fd31a556ec233bbea36c6db63af68e583616cd Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Read gradle dependencies from CMake propertiesAlexey Edelev2025-07-071-6/+24
| | | | | | | | | Allow changing/adding gradle depdendencies using the CMake properties. The property is pure private at the moment. Android applications use dependencies from the default build.gradle template. Change-Id: I0eab8d1d86953e30f1adfbc41f27f9d4513410eb Reviewed-by: Alexandru Croitor <[email protected]>
* Make Android gradle source sets configurableAlexey Edelev2025-07-071-11/+44
| | | | | | | | | | | Add properties that control the Android gradle source sets. Properties are internal only. Android applications default these properties to the values we have in reference build.gradle template. These properties only work for modern Android bundles. Change-Id: I573293778ea18576411dd86695bbade6e25c4f56 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Migrate to the gradle.settings approach when generating Android projectsAlexey Edelev2025-07-071-0/+305
This approach is more flexible and modernizes the gradle project structure for Qt apps. We now try to reproduce the CMake Android project structure of user applications, in the modern Android project structure described here: https://developer.android.com/build The new structure using the module based application build and unlocks the support for the use of dynamic features and Android libraries(aar). All gradle-related rules are generated by CMake and androiddeployqt is used in the auxiliary mode only(--aux-mode option). Update gradle templates. To opt-in the modern deployment use the QT_ANDROID_MODERN_BUNDLE variable. Task-number: QTBUG-116683 Task-number: QTBUG-124600 Change-Id: I343b884dea77a7b3b9059cf876a81c3693d0294b Reviewed-by: Assam Boudjelthia <[email protected]>