summaryrefslogtreecommitdiffstats
path: root/src/tools/androiddeployqt/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix androiddeployqt copying build directoryJani Korteniemi2025-06-121-0/+4
| | | | | | | | | | | | | | | When project's Android package source directory is set to the project level (instead of project/android) androiddeployqt keeps copying the build directory under itself infinitely. Add check to copyFiles: -If android source dir is the same as project source dir -And if current directory copied is in build directory path Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-126743 Change-Id: If45766152c6cbf9e2ee916baa5a15282d3fedaf2 Reviewed-by: Assam Boudjelthia <[email protected]>
* Copy Android files from the application source in aux modeAaron McCarthy2025-06-111-7/+6
| | | | | | | | | | | | The application provided overrides of the Android files were not being used in aux mode. In aux mode androiddeployqt was only copying the Android files from the Qt sources and updating them. With this change androiddeployqt also copies the Android files from the application source, allowing overrides prior to template processing. Change-Id: Idf790f1c270691dab8fe093c20e84bed79bf481d Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Support multi-arg signal generation in androiddeployqtPetri Virkkunen2025-06-101-13/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces support for generating Java code for multi-argument QML signals. Pre-existing code remains unchanged, and the new code is only executed when the number of params in a signal is above 1. Multi-arg signals are handled with a new generated interface type, named after the signal, which has a default method that takes an Object[] array and calls the user-implemented signal method with the arguments cast to the desired types. For example, a QML signal with the following signature: signal manyTypeArgSignal(intValue: int, boolValue: bool, doubleValue: double, stringValue: string) Is generated into this Java code: @FunctionalInterface public interface manyTypeArgSignalListener { default void onSignalEmitted(Object[] args) { onSignalEmitted((Integer) args[0], (Boolean) args[1], (Double) args[2], (String) args[3]); } void onManyTypeArgSignal(Integer intValue, Boolean boolValue, Double doubleValue, String stringValue); } public int connectManyTypeArgSignalListener(manyTypeArgSignalListener signalListener) { return connectSignalListener("manyTypeArgSignal", new Class[]{ Integer.class, Boolean.class, Double.class, String.class }, signalListener); } Task-number: QTBUG-124489 Change-Id: I94e3e88e807017bcbeba16cf0e34263e28e5885f Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Don't reparse same paths in QML to Java codegenOlli Vuolteenaho2025-06-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | appImports can have the same directory added multiple times - first if it's found in the xxx_conf.rsp file and secondly for the inner qmldir scanner. This is because the xxx_conf.rsp file can have both the qmlModule directory and the parent of that directory as importPaths. For example like this (the paths are truncated to save characters): -importPath .../build/qt_generated/qtquickview/qmlModule -importPath .../build/qt_generated/qtquickview In this case when the "inner qmldir" finder processes the later path, it would go to ./qmlModule, find the qmldir and add another .../build/qt_generated/qtquickview/qmlModule to appImports. Also, if there were other qmldir files somewhere under qmlModule those would also get added twice, which would increase generation time yet again. This commits solves the issue by removing duplicates from appImports. Amends 7ed88eb565d40b195aa868e67777872ef07a5ea2. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-137316 Change-Id: I641065479aec0f3d9ae1a8727a03bf62eb169ad6 Reviewed-by: Assam Boudjelthia <[email protected]>
* [Android] Skip goodToCopy checkAlexey Edelev2025-05-221-0/+3
| | | | | | | | | | | | | Skip the goodToCopy check for the libraries that do not belong to the main ABI. The rationale of this descision - goodToCopy was passing in per-ABI build already, so we don't need to take care about this check in main-ABI build. Also we indroduced the last-stand check of bundled libraries in 7499fd0229d63f969bf6ca58d3b764b96395bed2. Fixes: QTBUG-136493 Pick-to: 6.8 6.9 Change-Id: I438af867b0f25e0ea557bb5066f1c243bb6ab356 Reviewed-by: Bartlomiej Moskal <[email protected]>
* [Android] Store the main ABI in deployment settingsAlexey Edelev2025-05-221-0/+6
| | | | | | | | | | Add the main Android ABI to the deployment settings. It's useful for skipping functionality that is done in per-ABI builds. Task-number: QTBUG-136493 Pick-to: 6.5 6.8 6.9 Change-Id: I9f59ffb1cae3107bbe695d99c33dd3426c163e6e Reviewed-by: Joerg Bornemann <[email protected]>
* Android: bump Android target API level to 35Rami Potinkara2025-03-061-1/+1
| | | | | | | | | | | | This patch -updated target API level to 35 into build tools -updated target API level to 35 in build.gradle files Task-number: QTBUG-129461 Task-number: QTBUG-130284 Pick-to: 6.9 6.9.0 Change-Id: Iebdc99e6f607352652c3f0022f17de60eae97d58 Reviewed-by: Assam Boudjelthia <[email protected]>
* AndroidDeployQt: explitly constuct the qmlDomCommand args listAssam Boudjelthia2025-01-201-9/+6
| | | | | | | | | | | | | Construct the arguments list explicilty to QStringList to avoid calling QProcess::splitCommand() and potentially splitting a path with spaces that shouldn't, this also saves from having to deal with shell quotes. Fixes: QTBUG-132891 Pick-to: 6.9 6.8 Change-Id: I48f6c219830269c507f146b654bcfa025f0e3203 Reviewed-by: Olli Vuolteenaho <[email protected]> Reviewed-by: Petri Virkkunen <[email protected]> Reviewed-by: Soheil Armin <[email protected]>
* Android: Handle dotted URI QML Modules in Java code genSoheil Armin2025-01-171-71/+82
| | | | | | | | | | | | | | | | | | | | | | | | | A QML module can have URI that include dot character. In this change, we refactor the code generator to create the same hierarchies as a Java package structure. Each QML module URI will be appended to the base application package name to form a package that represents the QML module as a Java package. Then the generated code of each QML component will be placed in a single file. This change, also refactor how to generated code should be written in the file, by buffering the generated code to a QByteArray first, and then flushing it into the target file. We also create a marker file inside the directories of each module, so that we can entirely remove the directory and all its files before generating new code during the next build. Fixes: QTBUG-125891 Fixes: QTBUG-125970 Fixes: QTBUG-125971 Pick-to: 6.8 6.9 Change-Id: Iebce6495d9d29af32c3f1f97274c252444d2864e Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Improve qmldir discovery of QML to Java codegenSoheil Armin2025-01-171-5/+23
| | | | | | | | | | | | | | | | | Recursively find all qml modules, built by this project. Later, the qmldir of these modules will be used to generated to code. The command line argument -i of qmldom tool had to be replaced with -I. The -i was incorrect as it expects the qmldir file while -I accepts a QML directory to be included. Fixes: QTBUG-125892 Fixes: QTBUG-125970 Pick-to: 6.8 6.9 Change-Id: I4099e488d3d7f4b79566e6ea19eca95f57f7c2fd Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Fix for multi-ABI build in androiddeployqtBartlomiej Moskal2024-12-171-2/+7
| | | | | | | | | | | | | | | | | | 7499fd0229d63f969bf6ca58d3b764b96395bed2 commit cleans up the localLibs to not add dependencies to the libs.xml file as they will not be satisfied. Mentioned change created a regression with multi-ABI build. It happens because in qtDependencies[ARCH] container, some libs just have different atchitecture prefix. This commit remove architecture prefix when checking libs in qtDependencies container. Fixes: QTBUG-131707 Pick-to: 6.8 6.9 Change-Id: Iae54779bfa4bd143ec35353604724d8ec4e35ef2 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: handle quotes in hard-coded namespace in build.gradleAssam Boudjelthia2024-12-131-1/+8
| | | | | | | | | | Remove quotes from the namespace values if they're set directly to build.gradle. Fixes: QTBUG-132150 Pick-to: 6.9 6.8 Change-Id: I7f5e132c2600bf5079850c99dc500b1dff7e6a96 Reviewed-by: Ivan Solovev <[email protected]>
* AndroidDeployQt: don't use QFile pointerAssam Boudjelthia2024-11-291-13/+12
| | | | | | | | | The file is used only in the local scope so no need to have it as a pointer. As a pass-by, use WriteOnly open mode. Pick-to: 6.8 Change-Id: I9999f4aed0f888af9a3e08ed6c3573432c29d195 Reviewed-by: Petri Virkkunen <[email protected]>
* AndroidDeployQt: Remove not satisfied dependenciesBartlomiej Moskal2024-11-051-1/+12
| | | | | | | | | | | | | | | | | | | | In 438837ce274fdc1457b66179b25df40f33b23a15 commit, we stopped to copy all dependent libs that are kept in plugin directory. This change sounds reasonable, as we do not want to deploy unused libs. Due to the mentioned change, when dependencies.xml contains *.so libraries, they are not copied at all now. They are added to localLibs (later pasted into libs.xml), but are not shipped with the apk. So at the end we have dependencies in libs.xml on some libraries that were not delievered. This commit cleans up the localLibs to not add dependencies to the libs.xml file as they will not be satisfied Fixes: QTBUG-129946 Pick-to: 6.8 Change-Id: I7157e2e65cb928adbe9d7c077e50b2ebcac94490 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: support uncompressed native libs within APKsAssam Boudjelthia2024-10-051-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android 6 and above produces uncompressed native libraries that are only part of the APK by default. However, Qt had this behavior explicitly disabled via packagingOptions.jniLibs.useLegacyPackaging Gradle flag (previously extractNativeLibs manifest flag) because we didn't support loading libraries directly from the APK. This patch adds support for reading and loading shared libraries directly from the APK without having them extracted to disk. Enabling this might increase slightly the total size of produced APKs, but saves on disk space after installation and also on update sizes from the Play Store and slightly faster startups [1][2]. Loading libraries on the Java side is handled by System.loadLibrary(). On C++, dlopen(3) can directly handle library paths relative to the APK file [3] which would save us the need to add custom code that calls android_dlopen_ext() [4] which works with compressed libraries then using AssetFileDescriptor and having to manage its file descriptor manually. To ensure proper integration with various Qt APIs and modules, this adds a QAbstractFileEngine/Iterator implementations to allow reading and listing APK files. Since, the files are expected to not change, they are cached once at startup and re-used thereafter. The engine implementation allows reading the libraries content using Android's AssetManager. Also, it allows mapping the libraries directly to memory to allow proper integration with QPluginLoader. For plugins, the native libs dir inside the APK is added to Qt and QML plugins search paths. With this patch, both compressed and uncompressed libs should work, to ensure this, an auto test is added with 'useLegacyPackaging true' to make sure both scenarios still works. [ChangeLog][Android] Add support for uncompressed native libraries within APKs. [1] https://android-developers.googleblog.com/2016/07/improvements-for- smaller-app-downloads.html [2] https://developer.android.com/guide/topics/manifest/application- element#extractNativeLibs [3] https://android.googlesource.com/platform/bionic/+/master/android- changes-for-ndk-developers.md#Opening-shared-libraries-directly-from-an- APK [4] https://developer.android.com/ndk/reference/group/ libdl#android_dlopen_ext Fixes: QTBUG-61072 Fixes: QTBUG-97650 Change-Id: Ica6c4cc9e5bd8f3610829b76b64bf599339435d9 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Use QIODevice::readLineInto() instead of readLine() in loopsRym Bouabid2024-09-201-4/+5
| | | | | | | | | | | | | | Most of the callers of QIODevice::readLine() are reading a device line by line in a loop. Instead, use one QByteArray and modify it in every iteration using QIODevice::readLineInto(). Use a QByteArrayView instead of QByteArray when calling trimmed() as it's an expensive operation. Fixes: QTBUG-103108 Change-Id: Ic1af487a2fbf352cc21d76a41717944d034d3709 Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* Introduce qt_add_android_permission CMake functionJuha Vuolle2024-09-161-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Alexey Edelev <[email protected]>
* CMake:Android: add property QT_ANDROID_COMPILE_SDK_VERSIONAssam Boudjelthia2024-09-091-7/+19
| | | | | | | | | 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 <[email protected]>
* CMake:Android: add property QT_ANDROID_APP_ICON to set app iconAssam Boudjelthia2024-09-091-0/+16
| | | | | | | | | 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 <[email protected]>
* CMake:Android: add property QT_ANDROID_APP_NAME to set app nameAssam Boudjelthia2024-09-091-1/+10
| | | | | | | | | | | 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 <[email protected]>
* qtbase build should't fail with -DFEATURE_process=OFF optionTatiana Borisova2024-09-081-0/+7
| | | | | | | | - Added #if QT_CONFIG(process) to the qt code that uses a QProcess Pick-to: 6.8 Change-Id: I79b39392bd2f75384256e5564203a8c875169916 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Get rid of init classes mechanismAssam Boudjelthia2024-08-261-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | Make it more the responsibility of the module to ensure any initialization is done under JNI_OnLoad(). Qt for Android have these mechanism to set the context to Java static classes used by various modules, where the QtLoader tries to look for setContext(Context), setActivity(Activity) and setService(Service) methods defined under certain modules where it uses reflection to, for example, assign the context to them before actually loading their respective shared libraries where some initialization is needed and requires the context to be already set. This mechanism is not really necessary, since the respective libraries are going to be loaded first anyways, and they could ensure to init the context, if needed, under JNI_OnLoad() instead of those static classes and through reflection which requires the class to be public. Also, this way it would be more explicit behavior where the context is set exactly before it's needed by the module's library. Fixes: QTBUG-126478 Change-Id: I4cb39b8ef057ff7a99b66c268d85ba6da0c591ce Reviewed-by: Ville Voutilainen <[email protected]>
* androiddeployqt: Do not misbehave on QML file and directory importsUlf Hermann2024-08-231-1/+4
| | | | | | | | | | | | 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 Pick-to: 6.8 Task-number: QTBUG-126632 Reviewed-by: Fabian Kosmale <[email protected]>
* Prioritize Android permissions of the application manifestJuha Vuolle2024-08-221-2/+15
| | | | | | | | | | | | | | Users may use their own AndroidManifest.xml and define permissions. However in case the manifest defines a permission that a Qt module also sets when the <!-- %%INSERT_PERMISSIONS --> template replacement is done, an error will occur during the application build (duplicate permission definition). This patch prioritizes such manual permissions and removes any previous ones a Qt module might have set. Change-Id: If94c218928aa5672686dd468a8d66995508d591f Reviewed-by: Assam Boudjelthia <[email protected]>
* Prioritize Android permissions without additional attributesJuha Vuolle2024-08-221-1/+6
| | | | | | | | | | | | | | | Android permissions may have additional attributes such as 'minSdkLevel' and 'maxSdkLevel'. When generating the default AndroidManifest.xml there may be duplicate permission entries, stemming for example from two different Qt modules. With this change the permission without any additional attributes is given priority. The underlying assumption is that such permission is likely the most permissive. Change-Id: Id0416290780b68289c2cca0bc03dde40997d3c16 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* Introduce qt_internal_add_android_permission CMake functionJuha Vuolle2024-08-221-5/+6
| | | | | | | | | | | | 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-117358 Task-number: QTBUG-112164 Change-Id: I0f40692574848fccdf65f9baedd14351917ce4bf Reviewed-by: Alexandru Croitor <[email protected]>
* androiddeployqt: Fix the --sign argument handling orderingAlexey Edelev2024-08-211-9/+5
| | | | | | | | | | | | | | 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.5 6.7 6.8 Change-Id: I34eac4def94c1d0c8d304f383d60c1e21b7dc6a2 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Rename opt-in CMake flag that generates QML to Java codeSoheil Armin2024-08-201-5/+5
| | | | | | | | | | | | | | | | | | 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ä <[email protected]> Reviewed-by: Nicholas Bennett <[email protected]>
* Android: Reflect renaming of QtQmlComponent to QtQuickViewContentSoheil Armin2024-08-201-3/+3
| | | | | | | | Pick-to: 6.8 Task-number: QTBUG-126976 Task-number: QTBUG-127083 Change-Id: I001a095c2844c725c85113c03c8640f507c8f11e Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: Fix duplicate class names when generating QML to Java codeSoheil Armin2024-07-011-0/+8
| | | | | | | | | | | | | | | | | 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 Pick-to: 6.8 Fixes: QTBUG-125160 Change-Id: I6303d76bc437f7eee806e4429bef81b5fbeb1e27 Reviewed-by: Rami Potinkara <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* QDirListing: add flags to handle entries filteringAhmad Samir2024-06-271-1/+1
| | | | | | | | | | | | | | | | | | 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. Pick-to: 6.8 Fixes: QTBUG-125504 Task-number: QTBUG-125859 Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7 Reviewed-by: Thiago Macieira <[email protected]>
* Fix path in Java QML component generationOlli Vuolteenaho2024-06-101-1/+1
| | | | | | | | | | | | | 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 // = / Pick-to: 6.8 Change-Id: I85376253055549344f06c9da9ebd67364e429112 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Add Java QtQmlComponent code generator to androiddeployqtSoheil Armin2024-05-311-1/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Android: use double quotes with androiddeployqt docsAssam Boudjelthia2024-05-271-2/+2
| | | | | | | | ... to avoid coloring mismatch in the generated doc page of the tool. Change-Id: I4334d49632c5f119a874e9112d4f13cd4d60e27a Reviewed-by: Alexey Edelev <[email protected]>
* Android: bump min supported SDK to 28 (Android 9)Assam Boudjelthia2024-05-231-3/+3
| | | | | | | | | | | 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 <[email protected]>
* Android:CMake: Add QT_ANDROID_PACKAGE_NAME propertyAssam Boudjelthia2024-05-161-16/+47
| | | | | | | | | | | | | 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ä <[email protected]>
* Android: Refactor packagePath() in androiddeployqtSoheil Armin2024-05-151-38/+29
| | | | | | | | | | 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 <[email protected]>
* Android: Add facilities to build AAR packagesSoheil Armin2024-05-151-2/+44
| | | | | | | | | | | | | | | 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 <[email protected]>
* androiddeployqt: Add a placeholder for plugin type in build.gradleTinja Paavoseppä2024-05-151-0/+1
| | | | | | | | | | 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 <[email protected]>
* Android: account for namespace in build.gradle instead of manifestAssam Boudjelthia2024-05-151-49/+67
| | | | | | | | | | | | | | | | | | | | | | 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ä <[email protected]>
* androiddeplyqt: port to RAII handling of popen()ed FILE*sMarc Mutz2024-05-151-43/+36
| | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* androiddeplyqt: fix more missing pclose() on early returnsMarc Mutz2024-04-181-0/+4
| | | | | | | | | | | 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 <[email protected]>
* androiddeplyqt: fix missing pclose() on early returnMarc Mutz2024-04-181-0/+1
| | | | | | | | | | | 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 <[email protected]>
* Port to QDirListingAhmad Samir2024-03-031-12/+10
| | | | | | | | | | | 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 <[email protected]>
* androiddeployqt: fix QDirIterator::next() usageAhmad Samir2024-03-011-2/+3
| | | | | | | | | | | 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 <[email protected]>
* Fix documentation of used digest and signature algorithmAndré Klitzing2024-02-151-2/+2
| | | | | | | | | | SHA-256 is used since 2019. This amends c9f8893000249bd5701674c53d18a823b4a1c629. Pick-to: 6.7 6.6 6.5 Change-Id: I005aa3414e4606045c8c3b01d71547efcf4122ba Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Alexey Edelev <[email protected]>
* Add the support of the qt_import_plugins functionality to androiddeployqtAlexey Edelev2024-01-111-22/+48
| | | | | | | | | | 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 <[email protected]>
* tools: port away from QPairMarc Mutz2023-12-141-2/+2
| | | | | | | | Pick-to: 6.7 Task-number: QTBUG-115841 Change-Id: If122a1c17b1b4092b115521cec814ce3b508cd80 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* Android: bump Android target API level to 34Rami Potinkara2023-11-301-1/+1
| | | | | | | | Bumped on network related .gradle files too. Fixes: QTBUG-119145 Change-Id: I95f70e6cda1aad7a6bd7246c623eb6f143a829cb Reviewed-by: Assam Boudjelthia <[email protected]>
* androiddeployqt: Copy templates and stdcpp lib in auxillary modeNikunj Arora2023-10-191-7/+6
| | | | | | | | | | [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ä <[email protected]>