Android: handle quotes in hard-coded namespace in build.gradle

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 <ivan.solovev@qt.io>
This commit is contained in:
Assam Boudjelthia 2024-12-13 14:45:47 +02:00
parent 11518e92c2
commit 60f7821237

View File

@ -799,7 +799,14 @@ GradleBuildConfigs gradleBuildConfigs(const QString &path)
if (trimmedLine.contains("compileSdkVersion androidCompileSdkVersion.toInteger()")) {
configs.usesIntegerCompileSdkVersion = true;
} else if (trimmedLine.contains("namespace")) {
configs.appNamespace = QString::fromUtf8(extractValue(trimmedLine));
const QString value = QString::fromUtf8(extractValue(trimmedLine));
const bool singleQuoted = value.startsWith(u'\'') && value.endsWith(u'\'');
const bool doubleQuoted = value.startsWith(u'\"') && value.endsWith(u'\"');
if (singleQuoted || doubleQuoted)
configs.appNamespace = value.mid(1, value.length() - 2);
else
configs.appNamespace = value;
}
}