Commit dcab956d authored by Eike Ziller's avatar Eike Ziller
Browse files

iOS: Do not drag unused QSettings objects around.



Change-Id: I5f641ba713e11c7a5376f94babf745f35ccbdba2
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent ba9787a0
......@@ -131,15 +131,14 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
foreach (const QFileInfo &fInfo, platforms) {
if (fInfo.isDir() && fInfo.suffix() == QLatin1String("platform")) {
qCDebug(probeLog) << indent << QString::fromLatin1("Setting up %1").arg(fInfo.fileName());
QSettingsPtr infoSettings(new QSettings(
fInfo.absoluteFilePath() + QLatin1String("/Info.plist"),
QSettings::NativeFormat));
if (!infoSettings->contains(QLatin1String("Name"))) {
QSettings infoSettings(fInfo.absoluteFilePath() + QLatin1String("/Info.plist"),
QSettings::NativeFormat);
if (!infoSettings.contains(QLatin1String("Name"))) {
qCWarning(probeLog) << indent << QString::fromLatin1("Missing platform name in Info.plist of %1")
.arg(fInfo.absoluteFilePath());
continue;
}
QString name = infoSettings->value(QLatin1String("Name")).toString();
QString name = infoSettings.value(QLatin1String("Name")).toString();
if (name != QLatin1String("macosx") && name != QLatin1String("iphoneos")
&& name != QLatin1String("iphonesimulator"))
{
......@@ -148,9 +147,9 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
}
// prepare default platform properties
QVariantMap defaultProp = infoSettings->value(QLatin1String("DefaultProperties"))
QVariantMap defaultProp = infoSettings.value(QLatin1String("DefaultProperties"))
.toMap();
QVariantMap overrideProp = infoSettings->value(QLatin1String("OverrideProperties"))
QVariantMap overrideProp = infoSettings.value(QLatin1String("OverrideProperties"))
.toMap();
QMapIterator<QString, QVariant> i(overrideProp);
while (i.hasNext()) {
......@@ -184,7 +183,6 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
clangProfile.platformKind = 0;
clangProfile.name = clangFullName;
clangProfile.platformPath = Utils::FileName(fInfo);
clangProfile.platformInfo = infoSettings;
clangProfile.compilerPath = Utils::FileName(clangFileInfo);
QStringList flags = extraFlags;
flags << QLatin1String("-dumpmachine");
......@@ -208,7 +206,6 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
gccProfile.platformKind = 0;
// use the arm-apple-darwin10-llvm-* variant and avoid the extraFlags if available???
gccProfile.platformPath = Utils::FileName(fInfo);
gccProfile.platformInfo = infoSettings;
gccProfile.compilerPath = Utils::FileName(gccFileInfo);
QStringList flags = extraFlags;
flags << QLatin1String("-dumpmachine");
......@@ -223,7 +220,6 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
// set SDKs/sysroot
QString sysRoot;
QSettingsPtr sdkSettings;
{
QString sdkName;
if (defaultProp.contains(QLatin1String("SDKROOT")))
......@@ -234,12 +230,12 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
foreach (const QFileInfo &sdkDirInfo, sdks.entryInfoList(QDir::Dirs
| QDir::NoDotAndDotDot)) {
indent = QLatin1String(" ");
QSettingsPtr sdkInfo(new QSettings(sdkDirInfo.absoluteFilePath()
+ QLatin1String("/SDKSettings.plist"),
QSettings::NativeFormat));
QString versionStr = sdkInfo->value(QLatin1String("Version")).toString();
QVariant currentSdkName = sdkInfo->value(QLatin1String("CanonicalName"));
bool isBaseSdk = sdkInfo->value((QLatin1String("isBaseSDK"))).toString()
QSettings sdkInfo(sdkDirInfo.absoluteFilePath()
+ QLatin1String("/SDKSettings.plist"),
QSettings::NativeFormat);
QString versionStr = sdkInfo.value(QLatin1String("Version")).toString();
QVariant currentSdkName = sdkInfo.value(QLatin1String("CanonicalName"));
bool isBaseSdk = sdkInfo.value((QLatin1String("isBaseSDK"))).toString()
.toLower() != QLatin1String("no");
if (!isBaseSdk) {
qCDebug(probeLog) << indent << QString::fromLatin1("Skipping non base Sdk %1")
......@@ -250,11 +246,9 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (maxVersion.isEmpty() || compareVersions(maxVersion, versionStr) > 0) {
maxVersion = versionStr;
sdkPath = sdkDirInfo.canonicalFilePath();
sdkSettings = sdkInfo;
}
} else if (currentSdkName == sdkName) {
sdkPath = sdkDirInfo.canonicalFilePath();
sdkSettings = sdkInfo;
}
}
if (!sdkPath.isEmpty())
......@@ -265,15 +259,12 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (hasClang && !sysRoot.isEmpty()) {
m_platforms[clangFullName].platformKind |= Platform::BasePlatform;
m_platforms[clangFullName].sdkPath = Utils::FileName::fromString(sysRoot);
m_platforms[clangFullName].sdkSettings = sdkSettings;
m_platforms[clang11FullName].platformKind |= Platform::BasePlatform;
m_platforms[clang11FullName].sdkPath = Utils::FileName::fromString(sysRoot);
m_platforms[clang11FullName].sdkSettings = sdkSettings;
}
if (hasGcc && !sysRoot.isEmpty()) {
m_platforms[gccFullName].platformKind |= Platform::BasePlatform;
m_platforms[gccFullName].sdkPath = Utils::FileName::fromString(sysRoot);
m_platforms[gccFullName].sdkSettings = sdkSettings;
}
}
indent = QLatin1String(" ");
......
......@@ -37,8 +37,6 @@
namespace Ios {
typedef QSharedPointer<QSettings> QSettingsPtr;
class Platform
{
public:
......@@ -56,8 +54,6 @@ public:
Utils::FileName compilerPath;
QString architecture;
QStringList backendFlags;
QSettingsPtr platformInfo;
QSettingsPtr sdkSettings;
};
class IosProbe
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment