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 Fixes: QTBUG-125160 Change-Id: I6303d76bc437f7eee806e4429bef81b5fbeb1e27 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit abfeb4542c9107fa40511209d25bc7d0b5db1a8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a721428478
commit
2aaafce903
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user