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.8
Change-Id: I7f5e132c2600bf5079850c99dc500b1dff7e6a96
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 60f78212379ba2b4a7a9bfadc5088a60309e923c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia 2024-12-13 14:45:47 +02:00 committed by Qt Cherry-pick Bot
parent 7ab145a9ef
commit 440dcaca27

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;
}
}