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
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>
(cherry picked from commit 440dcaca27d28259276f8271d0abf059f04ccca7)
This commit is contained in:
Assam Boudjelthia 2024-12-13 14:45:47 +02:00 committed by Qt Cherry-pick Bot
parent 933128d266
commit 29a793f3ff

View File

@ -800,7 +800,14 @@ GradleBuildConfigs gradleBuildConfigs(const QString &path)
} else 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;
}
}