diff options
author | Soheil Armin <[email protected]> | 2024-06-26 11:52:20 +0300 |
---|---|---|
committer | Soheil Armin <[email protected]> | 2024-07-01 22:23:34 +0300 |
commit | abfeb4542c9107fa40511209d25bc7d0b5db1a8c (patch) | |
tree | b0499cb4ea6601bd84e56f296a67b6010dd45638 /src/tools/androiddeployqt/main.cpp | |
parent | c7c830057589a91cc369375775d018c5057ba46a (diff) |
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
Pick-to: 6.8
Fixes: QTBUG-125160
Change-Id: I6303d76bc437f7eee806e4429bef81b5fbeb1e27
Reviewed-by: Rami Potinkara <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/tools/androiddeployqt/main.cpp')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index f4c96edc55d..c91f9297005 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -3705,6 +3705,14 @@ int generateJavaQmlComponents(const Options &options) const QString moduleClassname = moduleInfo.moduleName[0].toUpper() + moduleInfo.moduleName.last(moduleInfo.moduleName.size() - 1); + 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", + qPrintable(moduleInfo.moduleName)); + return false; + } + int indentBase = 4; if (leafEqualsLibname) { indentBase = 0; |