Commit 92cd92bb authored by Fawzi Mohamed's avatar Fawzi Mohamed

ios: improve kit generation

* remove all unknown autodetected iphone* kits
* update more thoughly existing kits

Change-Id: Ia71328a3f88eaede28f9199f1c301f23a88ad58b
Reviewed-by: default avatarCaroline Chao <caroline.chao@digia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 9a9ec06d
...@@ -113,7 +113,8 @@ void IosConfigurations::updateAutomaticKitList() ...@@ -113,7 +113,8 @@ void IosConfigurations::updateAutomaticKitList()
iter.next(); iter.next();
const Platform &p = iter.value(); const Platform &p = iter.value();
if (p.compilerPath == toolchain->compilerCommand() if (p.compilerPath == toolchain->compilerCommand()
&& p.backendFlags == toolchain->platformCodeGenFlags()) { && p.backendFlags == toolchain->platformCodeGenFlags()
&& !platformToolchainMap.contains(p.name)) {
platformToolchainMap[p.name] = toolchain; platformToolchainMap[p.name] = toolchain;
found = true; found = true;
} }
...@@ -251,7 +252,7 @@ void IosConfigurations::updateAutomaticKitList() ...@@ -251,7 +252,7 @@ void IosConfigurations::updateAutomaticKitList()
qDebug() << "skipping existing kit with deviceKind " << deviceKind.toString(); qDebug() << "skipping existing kit with deviceKind " << deviceKind.toString();
continue; continue;
} }
if (!k->isAutoDetected()) // use also used set kits? if (!k->isAutoDetected())
continue; continue;
existingKits << k; existingKits << k;
kitMatched << false; kitMatched << false;
...@@ -285,15 +286,20 @@ void IosConfigurations::updateAutomaticKitList() ...@@ -285,15 +286,20 @@ void IosConfigurations::updateAutomaticKitList()
QList<BaseQtVersion *> qtVersions = qtVersionsForArch.value(arch); QList<BaseQtVersion *> qtVersions = qtVersionsForArch.value(arch);
foreach (BaseQtVersion *qt, qtVersions) { foreach (BaseQtVersion *qt, qtVersions) {
Kit *kitAtt = 0;
bool kitExists = false; bool kitExists = false;
for (int i = 0; i < existingKits.size(); ++i) { for (int i = 0; i < existingKits.size(); ++i) {
Kit *k = existingKits.at(i); Kit *k = existingKits.at(i);
if (DeviceTypeKitInformation::deviceTypeId(k) == pDeviceType if (DeviceTypeKitInformation::deviceTypeId(k) == pDeviceType
&& ToolChainKitInformation::toolChain(k) == pToolchain && ToolChainKitInformation::toolChain(k) == pToolchain
&& SysRootKitInformation::sysRoot(k) == p.sdkPath
&& QtKitInformation::qtVersion(k) == qt) && QtKitInformation::qtVersion(k) == qt)
{ {
QTC_CHECK(!kitMatched.value(i, true));
// as we generate only two kits per qt (one for device and one for simulator)
// we do not compare the sdk (thus automatically upgrading it in place if a
// new Xcode is used). Change?
kitExists = true; kitExists = true;
kitAtt = k;
if (debugProbe) if (debugProbe)
qDebug() << "found existing kit " << k->displayName() << " for " << p.name qDebug() << "found existing kit " << k->displayName() << " for " << p.name
<< "," << qt->displayName(); << "," << qt->displayName();
...@@ -302,74 +308,65 @@ void IosConfigurations::updateAutomaticKitList() ...@@ -302,74 +308,65 @@ void IosConfigurations::updateAutomaticKitList()
break; break;
} }
} }
if (kitExists) if (kitExists) {
continue; kitAtt->blockNotification();
if (debugProbe) } else {
qDebug() << "setting up new kit for " << p.name; if (debugProbe)
Kit *newKit = new Kit; qDebug() << "setting up new kit for " << p.name;
newKit->setAutoDetected(true); kitAtt = new Kit;
QString baseDisplayName = tr("%1 %2").arg(p.name, qt->displayName()); kitAtt->setAutoDetected(true);
QString displayName = baseDisplayName; QString baseDisplayName = tr("%1 %2").arg(p.name, qt->displayName());
for (int iVers = 1; iVers < 100; ++iVers) { QString displayName = baseDisplayName;
bool unique = true; for (int iVers = 1; iVers < 100; ++iVers) {
foreach (const Kit *k, existingKits) { bool unique = true;
if (k->displayName() == displayName) { foreach (const Kit *k, existingKits) {
unique = false; if (k->displayName() == displayName) {
break; unique = false;
break;
}
} }
if (unique) break;
displayName = baseDisplayName + QLatin1String("-") + QString::number(iVers);
} }
if (unique) break; kitAtt->setDisplayName(displayName);
displayName = baseDisplayName + QLatin1String("-") + QString::number(iVers);
} }
newKit->setDisplayName(displayName); kitAtt->setIconPath(Utils::FileName::fromString(
newKit->setIconPath(Utils::FileName::fromString(
QLatin1String(Constants::IOS_SETTINGS_CATEGORY_ICON))); QLatin1String(Constants::IOS_SETTINGS_CATEGORY_ICON)));
DeviceTypeKitInformation::setDeviceTypeId(newKit, pDeviceType); DeviceTypeKitInformation::setDeviceTypeId(kitAtt, pDeviceType);
ToolChainKitInformation::setToolChain(newKit, pToolchain); ToolChainKitInformation::setToolChain(kitAtt, pToolchain);
QtKitInformation::setQtVersion(newKit, qt); QtKitInformation::setQtVersion(kitAtt, qt);
//DeviceKitInformation::setDevice(newKit, device); if ((!Debugger::DebuggerKitInformation::debugger(kitAtt)
if (!debuggerId.isValid()) || !Debugger::DebuggerKitInformation::debugger(kitAtt)->isValid()
Debugger::DebuggerKitInformation::setDebugger(newKit, || Debugger::DebuggerKitInformation::debugger(kitAtt)->engineType() != Debugger::LldbEngineType)
&& debuggerId.isValid())
Debugger::DebuggerKitInformation::setDebugger(kitAtt,
debuggerId); debuggerId);
newKit->setMutable(DeviceKitInformation::id(), true); kitAtt->setMutable(DeviceKitInformation::id(), true);
newKit->setSticky(QtKitInformation::id(), true); kitAtt->setSticky(QtKitInformation::id(), true);
newKit->setSticky(ToolChainKitInformation::id(), true); kitAtt->setSticky(ToolChainKitInformation::id(), true);
newKit->setSticky(DeviceTypeKitInformation::id(), true); kitAtt->setSticky(DeviceTypeKitInformation::id(), true);
newKit->setSticky(SysRootKitInformation::id(), true); kitAtt->setSticky(SysRootKitInformation::id(), true);
kitAtt->setSticky(Debugger::DebuggerKitInformation::id(), false);
SysRootKitInformation::setSysRoot(newKit, p.sdkPath); SysRootKitInformation::setSysRoot(kitAtt, p.sdkPath);
// QmakeProjectManager::QmakeKitInformation::setMkspec(newKit, // QmakeProjectManager::QmakeKitInformation::setMkspec(newKit,
// Utils::FileName::fromString(QLatin1String("macx-ios-clang"))); // Utils::FileName::fromString(QLatin1String("macx-ios-clang")));
KitManager::registerKit(newKit); if (kitExists) {
existingKits << newKit; kitAtt->unblockNotification();
} else {
KitManager::registerKit(kitAtt);
existingKits << kitAtt;
}
} }
} }
} }
for (int i = 0; i < kitMatched.size(); ++i) { for (int i = 0; i < kitMatched.size(); ++i) {
// deleting extra (old) kits // deleting extra (old) kits
if (!kitMatched.at(i) && !existingKits.at(i)->isValid()) { if (!kitMatched.at(i)) {
qDebug() << "deleting kit " << existingKits.at(i)->displayName(); qDebug() << "deleting kit " << existingKits.at(i)->displayName();
KitManager::deregisterKit(existingKits.at(i)); KitManager::deregisterKit(existingKits.at(i));
} }
// fix old kits
if (kitMatched.at(i)) {
Kit *kit = existingKits.at(i);
kit->blockNotification();
const Debugger::DebuggerItem *debugger = Debugger::DebuggerKitInformation::debugger(kit);
if ((!debugger || !debugger->isValid()) && debuggerId.isValid())
Debugger::DebuggerKitInformation::setDebugger(kit, debuggerId);
if (!kit->isMutable(DeviceKitInformation::id())) {
kit->setMutable(DeviceKitInformation::id(), true);
kit->setSticky(QtKitInformation::id(), true);
kit->setSticky(ToolChainKitInformation::id(), true);
kit->setSticky(DeviceTypeKitInformation::id(), true);
kit->setSticky(SysRootKitInformation::id(), true);
}
if (kit->isSticky(Debugger::DebuggerKitInformation::id()))
kit->setSticky(Debugger::DebuggerKitInformation::id(), false);
kit->unblockNotification();
}
} }
} }
......
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