From be2c03064cdb7bef977d05371e535bedcadb3a0f Mon Sep 17 00:00:00 2001 From: Soheil Armin Date: Mon, 22 Jul 2024 15:02:00 +0300 Subject: [PATCH] Android: Rename opt-in CMake flag that generates QML to Java code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Nicholas Bennett --- src/corelib/Qt6AndroidMacros.cmake | 8 ++++---- .../doc/src/cmake/cmake-configure-variables.qdoc | 10 +++++----- src/tools/androiddeployqt/main.cpp | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index 218611150bb..d108d713d69 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -300,13 +300,13 @@ function(qt6_android_generate_deployment_settings target) string(APPEND file_contents " \"zstdCompression\": ${is_zstd_enabled},\n") - if(QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS) - set(is_generate_java_qml_components "true") + if(QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS) + set(is_generate_java_qtquickview_contents "true") else() - set(is_generate_java_qml_components "false") + set(is_generate_java_qtquickview_contents "false") endif() string(APPEND file_contents - " \"generate-java-qml-components\": ${is_generate_java_qml_components},\n") + " \"generate-java-qtquickview-contents\": ${is_generate_java_qtquickview_contents},\n") # Last item in json file # base location of stdlibc++, will be suffixed by androiddeploy qt diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc index 8422a688f0d..66032b54069 100644 --- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc +++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc @@ -322,10 +322,10 @@ The mentioned variables are used internally by \l{androiddeployqt}. \ingroup cmake-variables-qtcore \ingroup cmake-android-build-properties -\title QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS -\target cmake-variable-QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS +\title QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS +\target cmake-variable-QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS -\summary {Enables the generation of QtQmlComponent-based classes.} +\summary {Enables the generation of QtQuickViewContent-based classes.} \cmakevariablesince 6.8 \preliminarycmakevariable \cmakevariableandroidonly @@ -335,8 +335,8 @@ generated code will be included in the resulting package. The Java package name classes will be the same as the Android app package. If the leaf part of the package name is not the same as the target executable, an extra static class with the same name as the capitalized target executable will surround all QML modules enclosing Java classes. Each QML -module class, again in a capitalized form, will contain QtQmlComponent extension classes that -represent QML components of that module. +module class, again in a capitalized form, will contain QtQuickViewContent extension classes +that represent QML components of that module. */ \sa{androiddeployqt} diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index ec19cbb9317..9ff9ab277f0 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1302,13 +1302,13 @@ bool readInputFile(Options *options) } { - const QJsonValue genJavaQmlComponents = jsonObject.value("generate-java-qml-components"_L1); + const QJsonValue genJavaQmlComponents = jsonObject.value("generate-java-qtquickview-contents"_L1); if (!genJavaQmlComponents.isUndefined() && genJavaQmlComponents.isBool()) { options->generateJavaQmlComponents = genJavaQmlComponents.toBool(false); if (options->generateJavaQmlComponents && !options->buildAar) { fprintf(stderr, - "Warning: Skipping the generation of Java components from QML as it can be " - "enabled only for an AAR target.\n"); + "Warning: Skipping the generation of Java QtQuickView contents from QML " + "as it can be enabled only for an AAR target.\n"); options->generateJavaQmlComponents = false; } } @@ -1321,7 +1321,7 @@ bool readInputFile(Options *options) } else if (options->generateJavaQmlComponents) { fprintf(stderr, "No qmldom binary defined in json file which is required when " - "building with QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS flag.\n"); + "building with QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS flag.\n"); return false; } } @@ -3708,7 +3708,7 @@ int generateJavaQmlComponents(const Options &options) if (moduleInfo.moduleName == libName) { fprintf(stderr, "A QML module name (%s) cannot be the same as the target name when building " - "with QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS flag.\n", + "with QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS flag.\n", qPrintable(moduleInfo.moduleName)); return false; }