ios: convert to new logging infrastructure

Change-Id: Ia62a585acfb55c35aa859553d24cb0e20600b46a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-07-07 09:24:17 +02:00
parent 730997b2d8
commit 0664aa146b
9 changed files with 86 additions and 109 deletions

View File

@@ -198,8 +198,8 @@ QStringList IosBuildStep::defaultArguments() const
case BuildConfiguration::Unknown : case BuildConfiguration::Unknown :
break; break;
default: default:
qDebug() << "IosBuildStep had an unknown buildType " qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
<< target()->activeBuildConfiguration()->buildType(); << target()->activeBuildConfiguration()->buildType();
} }
if (tc->type() == QLatin1String("gcc") || tc->type() == QLatin1String("clang")) { if (tc->type() == QLatin1String("gcc") || tc->type() == QLatin1String("clang")) {
GccToolChain *gtc = static_cast<GccToolChain *>(tc); GccToolChain *gtc = static_cast<GccToolChain *>(tc);

View File

@@ -61,7 +61,9 @@ using namespace QtSupport;
using namespace Utils; using namespace Utils;
using namespace Debugger; using namespace Debugger;
const bool debugProbe = false; namespace {
Q_LOGGING_CATEGORY(kitSetupLog, "qtc.ios.kitSetup")
}
namespace Ios { namespace Ios {
namespace Internal { namespace Internal {
@@ -84,9 +86,8 @@ void IosConfigurations::updateAutomaticKitList()
|| !p.compilerPath.toString().contains(QLatin1String("clang"))) || !p.compilerPath.toString().contains(QLatin1String("clang")))
iter = platforms.erase(iter); iter = platforms.erase(iter);
else { else {
if (debugProbe) qCDebug(kitSetupLog) << "keeping" << p.name << " " << p.compilerPath.toString() << " "
qDebug() << "keeping" << p.name << " " << p.compilerPath.toString() << " " << p.backendFlags;
<< p.backendFlags;
++iter; ++iter;
} }
} }
@@ -123,20 +124,18 @@ void IosConfigurations::updateAutomaticKitList()
found = true; found = true;
if (p.architecture == QLatin1String("i386") if (p.architecture == QLatin1String("i386")
&& toolchain->targetAbi().wordWidth() != 32) { && toolchain->targetAbi().wordWidth() != 32) {
if (debugProbe) qCDebug(kitSetupLog) << "resetting api of " << toolchain->displayName();
qDebug() << "resetting api of " << toolchain->displayName();
toolchain->setTargetAbi(Abi(Abi::X86Architecture, toolchain->setTargetAbi(Abi(Abi::X86Architecture,
Abi::MacOS, Abi::GenericMacFlavor, Abi::MacOS, Abi::GenericMacFlavor,
Abi::MachOFormat, 32)); Abi::MachOFormat, 32));
} }
platformToolchainMap[p.name] = toolchain; platformToolchainMap[p.name] = toolchain;
if (debugProbe) qCDebug(kitSetupLog) << p.name << " -> " << toolchain->displayName();
qDebug() << p.name << " -> " << toolchain->displayName();
} }
} }
if (!found && (tc->displayName().startsWith(QLatin1String("iphone")) if (!found && (tc->displayName().startsWith(QLatin1String("iphone"))
|| tc->displayName().startsWith(QLatin1String("mac")))) { || tc->displayName().startsWith(QLatin1String("mac")))) {
qDebug() << "removing toolchain" << tc->displayName(); qCWarning(kitSetupLog) << "removing toolchain" << tc->displayName();
ToolChainManager::deregisterToolChain(tc); ToolChainManager::deregisterToolChain(tc);
} }
} }
@@ -173,13 +172,11 @@ void IosConfigurations::updateAutomaticKitList()
toolchain->setPlatformLinkerFlags(p.backendFlags); toolchain->setPlatformLinkerFlags(p.backendFlags);
toolchain->setCompilerCommand(p.compilerPath); toolchain->setCompilerCommand(p.compilerPath);
if (p.architecture == QLatin1String("i386")) { if (p.architecture == QLatin1String("i386")) {
if (debugProbe) qCDebug(kitSetupLog) << "setting toolchain Abi for " << toolchain->displayName();
qDebug() << "setting toolchain Abi for " << toolchain->displayName();
toolchain->setTargetAbi(Abi(Abi::X86Architecture,Abi::MacOS, Abi::GenericMacFlavor, toolchain->setTargetAbi(Abi(Abi::X86Architecture,Abi::MacOS, Abi::GenericMacFlavor,
Abi::MachOFormat, 32)); Abi::MachOFormat, 32));
} }
if (debugProbe) qCDebug(kitSetupLog) << "adding toolchain " << p.name;
qDebug() << "adding toolchain " << p.name;
ToolChainManager::registerToolChain(toolchain); ToolChainManager::registerToolChain(toolchain);
platformToolchainMap.insert(p.name, toolchain); platformToolchainMap.insert(p.name, toolchain);
QMapIterator<QString, Platform> iter2(iter); QMapIterator<QString, Platform> iter2(iter);
@@ -196,8 +193,7 @@ void IosConfigurations::updateAutomaticKitList()
} }
QMap<Abi::Architecture, QList<BaseQtVersion *> > qtVersionsForArch; QMap<Abi::Architecture, QList<BaseQtVersion *> > qtVersionsForArch;
foreach (BaseQtVersion *qtVersion, QtVersionManager::versions()) { foreach (BaseQtVersion *qtVersion, QtVersionManager::versions()) {
if (debugProbe) qCDebug(kitSetupLog) << "qt type " << qtVersion->type();
qDebug() << "qt type " << qtVersion->type();
if (qtVersion->type() != QLatin1String(Constants::IOSQT)) { if (qtVersion->type() != QLatin1String(Constants::IOSQT)) {
if (qtVersion->qmakeProperty("QMAKE_PLATFORM").contains(QLatin1String("ios")) if (qtVersion->qmakeProperty("QMAKE_PLATFORM").contains(QLatin1String("ios"))
|| qtVersion->qmakeProperty("QMAKE_XSPEC").contains(QLatin1String("ios"))) { || qtVersion->qmakeProperty("QMAKE_XSPEC").contains(QLatin1String("ios"))) {
@@ -208,8 +204,7 @@ void IosConfigurations::updateAutomaticKitList()
qtVersion->isAutodetected(), qtVersion->isAutodetected(),
qtVersion->autodetectionSource()); qtVersion->autodetectionSource());
if (iosVersion && iosVersion->type() == QLatin1String(Constants::IOSQT)) { if (iosVersion && iosVersion->type() == QLatin1String(Constants::IOSQT)) {
if (debugProbe) qCDebug(kitSetupLog) << "converting QT to iOS QT for " << qtVersion->qmakeCommand().toUserOutput();
qDebug() << "converting QT to iOS QT for " << qtVersion->qmakeCommand().toUserOutput();
QtVersionManager::removeVersion(qtVersion); QtVersionManager::removeVersion(qtVersion);
QtVersionManager::addVersion(iosVersion); QtVersionManager::addVersion(iosVersion);
qtVersion = iosVersion; qtVersion = iosVersion;
@@ -225,8 +220,7 @@ void IosConfigurations::updateAutomaticKitList()
QList<Abi> qtAbis = qtVersion->qtAbis(); QList<Abi> qtAbis = qtVersion->qtAbis();
if (qtAbis.empty()) if (qtAbis.empty())
continue; continue;
if (debugProbe) qCDebug(kitSetupLog) << "qt arch " << qtAbis.first().architecture();
qDebug() << "qt arch " << qtAbis.first().architecture();
foreach (const Abi &abi, qtAbis) foreach (const Abi &abi, qtAbis)
qtVersionsForArch[abi.architecture()].append(qtVersion); qtVersionsForArch[abi.architecture()].append(qtVersion);
} }
@@ -240,8 +234,7 @@ void IosConfigurations::updateAutomaticKitList()
Core::Id deviceKind = DeviceTypeKitInformation::deviceTypeId(k); Core::Id deviceKind = DeviceTypeKitInformation::deviceTypeId(k);
if (deviceKind != Constants::IOS_DEVICE_TYPE if (deviceKind != Constants::IOS_DEVICE_TYPE
&& deviceKind != Constants::IOS_SIMULATOR_TYPE) { && deviceKind != Constants::IOS_SIMULATOR_TYPE) {
if (debugProbe) qCDebug(kitSetupLog) << "skipping existing kit with deviceKind " << deviceKind.toString();
qDebug() << "skipping existing kit with deviceKind " << deviceKind.toString();
continue; continue;
} }
if (!k->isAutoDetected()) if (!k->isAutoDetected())
@@ -259,17 +252,14 @@ void IosConfigurations::updateAutomaticKitList()
if (!pToolchain) if (!pToolchain)
continue; continue;
Core::Id pDeviceType; Core::Id pDeviceType;
if (debugProbe) qCDebug(kitSetupLog) << "guaranteeing kit for " << p.name ;
qDebug() << "guaranteeing kit for " << p.name ;
if (p.name.startsWith(QLatin1String("iphoneos-"))) { if (p.name.startsWith(QLatin1String("iphoneos-"))) {
pDeviceType = Constants::IOS_DEVICE_TYPE; pDeviceType = Constants::IOS_DEVICE_TYPE;
} else if (p.name.startsWith(QLatin1String("iphonesimulator-"))) { } else if (p.name.startsWith(QLatin1String("iphonesimulator-"))) {
pDeviceType = Constants::IOS_SIMULATOR_TYPE; pDeviceType = Constants::IOS_SIMULATOR_TYPE;
if (debugProbe) qCDebug(kitSetupLog) << "pDeviceType " << pDeviceType.toString();
qDebug() << "pDeviceType " << pDeviceType.toString();
} else { } else {
if (debugProbe) qCDebug(kitSetupLog) << "skipping non ios kit " << p.name;
qDebug() << "skipping non ios kit " << p.name;
// we looked up only the ios qt build above... // we looked up only the ios qt build above...
continue; continue;
//pDeviceType = Constants::DESKTOP_DEVICE_TYPE; //pDeviceType = Constants::DESKTOP_DEVICE_TYPE;
@@ -292,9 +282,8 @@ void IosConfigurations::updateAutomaticKitList()
// new Xcode is used). Change? // new Xcode is used). Change?
kitExists = true; kitExists = true;
kitAtt = k; kitAtt = k;
if (debugProbe) qCDebug(kitSetupLog) << "found existing kit " << k->displayName() << " for " << p.name
qDebug() << "found existing kit " << k->displayName() << " for " << p.name << "," << qt->displayName();
<< "," << qt->displayName();
if (i<kitMatched.size()) if (i<kitMatched.size())
kitMatched.replace(i, true); kitMatched.replace(i, true);
break; break;
@@ -303,8 +292,7 @@ void IosConfigurations::updateAutomaticKitList()
if (kitExists) { if (kitExists) {
kitAtt->blockNotification(); kitAtt->blockNotification();
} else { } else {
if (debugProbe) qCDebug(kitSetupLog) << "setting up new kit for " << p.name;
qDebug() << "setting up new kit for " << p.name;
kitAtt = new Kit; kitAtt = new Kit;
kitAtt->setAutoDetected(true); kitAtt->setAutoDetected(true);
QString baseDisplayName = tr("%1 %2").arg(p.name, qt->displayName()); QString baseDisplayName = tr("%1 %2").arg(p.name, qt->displayName());
@@ -356,7 +344,7 @@ void IosConfigurations::updateAutomaticKitList()
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)) { if (!kitMatched.at(i)) {
qDebug() << "deleting kit " << existingKits.at(i)->displayName(); qCWarning(kitSetupLog) << "deleting kit " << existingKits.at(i)->displayName();
KitManager::deregisterKit(existingKits.at(i)); KitManager::deregisterKit(existingKits.at(i));
} }
} }

View File

@@ -30,10 +30,11 @@
#define IOSCONSTANTS_H #define IOSCONSTANTS_H
#include <QtGlobal> #include <QtGlobal>
#include <utils/logging.h>
namespace Ios { namespace Ios {
namespace Internal { namespace Internal {
Q_DECLARE_LOGGING_CATEGORY(iosLog)
} // namespace Internal } // namespace Internal
namespace IosDeviceType { namespace IosDeviceType {

View File

@@ -51,7 +51,9 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
static bool debugDeviceDetection = false; namespace {
Q_LOGGING_CATEGORY(detectLog, "qtc.ios.deviceDetect")
}
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
static QString CFStringRef2QString(CFStringRef s) static QString CFStringRef2QString(CFStringRef s)
@@ -247,13 +249,11 @@ void IosDeviceManager::deviceConnected(const QString &uid, const QString &name)
IosDevice *newDev = new IosDevice(uid); IosDevice *newDev = new IosDevice(uid);
if (!name.isNull()) if (!name.isNull())
newDev->setDisplayName(name); newDev->setDisplayName(name);
if (debugDeviceDetection) qCDebug(detectLog) << "adding ios device " << uid;
qDebug() << "adding ios device " << uid;
devManager->addDevice(IDevice::ConstPtr(newDev)); devManager->addDevice(IDevice::ConstPtr(newDev));
} else if (dev->deviceState() != IDevice::DeviceConnected && } else if (dev->deviceState() != IDevice::DeviceConnected &&
dev->deviceState() != IDevice::DeviceReadyToUse) { dev->deviceState() != IDevice::DeviceReadyToUse) {
if (debugDeviceDetection) qCDebug(detectLog) << "updating ios device " << uid;
qDebug() << "updating ios device " << uid;
IosDevice *newDev = 0; IosDevice *newDev = 0;
if (dev->type() == devType) { if (dev->type() == devType) {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data()); const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
@@ -268,23 +268,21 @@ void IosDeviceManager::deviceConnected(const QString &uid, const QString &name)
void IosDeviceManager::deviceDisconnected(const QString &uid) void IosDeviceManager::deviceDisconnected(const QString &uid)
{ {
if (debugDeviceDetection) qCDebug(detectLog) << "detected disconnection of ios device " << uid;
qDebug() << "detected disconnection of ios device " << uid;
DeviceManager *devManager = DeviceManager::instance(); DeviceManager *devManager = DeviceManager::instance();
Core::Id baseDevId(Constants::IOS_DEVICE_ID); Core::Id baseDevId(Constants::IOS_DEVICE_ID);
Core::Id devType(Constants::IOS_DEVICE_TYPE); Core::Id devType(Constants::IOS_DEVICE_TYPE);
Core::Id devId = baseDevId.withSuffix(uid); Core::Id devId = baseDevId.withSuffix(uid);
IDevice::ConstPtr dev = devManager->find(devId); IDevice::ConstPtr dev = devManager->find(devId);
if (dev.isNull() || dev->type() != devType) { if (dev.isNull() || dev->type() != devType) {
qDebug() << "ignoring disconnection of ios device " << uid; // should neve happen qCWarning(detectLog) << "ignoring disconnection of ios device " << uid; // should neve happen
} else { } else {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data()); const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
if (iosDev->m_extraInfo.isEmpty() if (iosDev->m_extraInfo.isEmpty()
|| iosDev->m_extraInfo.value(QLatin1String("deviceName")) == QLatin1String("*unknown*")) { || iosDev->m_extraInfo.value(QLatin1String("deviceName")) == QLatin1String("*unknown*")) {
devManager->removeDevice(iosDev->id()); devManager->removeDevice(iosDev->id());
} else if (iosDev->deviceState() != IDevice::DeviceDisconnected) { } else if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
if (debugDeviceDetection) qCDebug(detectLog) << "disconnecting device " << iosDev->uniqueDeviceID();
qDebug() << "disconnecting device " << iosDev->uniqueDeviceID();
devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected); devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected);
} }
} }
@@ -326,8 +324,7 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
if (info.contains(devNameKey)) if (info.contains(devNameKey))
newDev->setDisplayName(info.value(devNameKey)); newDev->setDisplayName(info.value(devNameKey));
newDev->m_extraInfo = info; newDev->m_extraInfo = info;
if (debugDeviceDetection) qCDebug(detectLog) << "updated info of ios device " << uid;
qDebug() << "updated info of ios device " << uid;
dev = IDevice::ConstPtr(newDev); dev = IDevice::ConstPtr(newDev);
devManager->addDevice(dev); devManager->addDevice(dev);
} }
@@ -397,8 +394,7 @@ void deviceConnectedCallback(void *refCon, io_iterator_t iterator)
QString name; QString name;
if (KERN_SUCCESS == kr) if (KERN_SUCCESS == kr)
name = QString::fromLocal8Bit(deviceName); name = QString::fromLocal8Bit(deviceName);
if (debugDeviceDetection) qCDebug(detectLog) << "ios device " << name << " in deviceAddedCallback";
qDebug() << "ios device " << name << " in deviceAddedCallback";
CFStringRef cfUid = static_cast<CFStringRef>(IORegistryEntryCreateCFProperty( CFStringRef cfUid = static_cast<CFStringRef>(IORegistryEntryCreateCFProperty(
usbDevice, usbDevice,
@@ -413,10 +409,10 @@ void deviceConnectedCallback(void *refCon, io_iterator_t iterator)
} }
} }
catch (std::exception &e) { catch (std::exception &e) {
qDebug() << "Exception " << e.what() << " in iosdevice.cpp deviceConnectedCallback"; qCWarning(detectLog) << "Exception " << e.what() << " in iosdevice.cpp deviceConnectedCallback";
} }
catch (...) { catch (...) {
qDebug() << "Exception in iosdevice.cpp deviceConnectedCallback"; qCWarning(detectLog) << "Exception in iosdevice.cpp deviceConnectedCallback";
throw; throw;
} }
} }
@@ -435,8 +431,7 @@ void deviceDisconnectedCallback(void *refCon, io_iterator_t iterator)
kr = IORegistryEntryGetName(usbDevice, deviceName); kr = IORegistryEntryGetName(usbDevice, deviceName);
if (KERN_SUCCESS != kr) if (KERN_SUCCESS != kr)
deviceName[0] = '\0'; deviceName[0] = '\0';
if (debugDeviceDetection) qCDebug(detectLog) << "ios device " << deviceName << " in deviceDisconnectedCallback";
qDebug() << "ios device " << deviceName << " in deviceDisconnectedCallback";
{ {
CFStringRef cfUid = static_cast<CFStringRef>(IORegistryEntryCreateCFProperty( CFStringRef cfUid = static_cast<CFStringRef>(IORegistryEntryCreateCFProperty(
@@ -453,10 +448,10 @@ void deviceDisconnectedCallback(void *refCon, io_iterator_t iterator)
} }
} }
catch (std::exception &e) { catch (std::exception &e) {
qDebug() << "Exception " << e.what() << " in iosdevice.cpp deviceDisconnectedCallback"; qCWarning(detectLog) << "Exception " << e.what() << " in iosdevice.cpp deviceDisconnectedCallback";
} }
catch (...) { catch (...) {
qDebug() << "Exception in iosdevice.cpp deviceDisconnectedCallback"; qCWarning(detectLog) << "Exception in iosdevice.cpp deviceDisconnectedCallback";
throw; throw;
} }
} }
@@ -557,8 +552,7 @@ void IosDeviceManager::updateAvailableDevices(const QStringList &devices)
if (devices.contains(iosDev->uniqueDeviceID())) if (devices.contains(iosDev->uniqueDeviceID()))
continue; continue;
if (iosDev->deviceState() != IDevice::DeviceDisconnected) { if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
if (debugDeviceDetection) qCDebug(detectLog) << "disconnecting device " << iosDev->uniqueDeviceID();
qDebug() << "disconnecting device " << iosDev->uniqueDeviceID();
devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected); devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected);
} }
} }

View File

@@ -52,6 +52,9 @@
#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/devicemanager.h>
namespace Ios { namespace Ios {
namespace Internal {
Q_LOGGING_CATEGORY(iosLog, "qtc.ios.common")
}
IosPlugin::IosPlugin() IosPlugin::IosPlugin()
{ {

View File

@@ -29,14 +29,16 @@
#include "iosprobe.h" #include "iosprobe.h"
#include <QDebug> #include <utils/logging.h>
#include <QFileInfo> #include <QFileInfo>
#include <QProcess> #include <QProcess>
#include <QDir> #include <QDir>
#include <QFileInfoList> #include <QFileInfoList>
static const bool debugProbe = false; namespace {
Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe")
}
namespace Ios { namespace Ios {
static QString qsystem(const QString &exe, const QStringList &args = QStringList()) static QString qsystem(const QString &exe, const QStringList &args = QStringList())
@@ -66,7 +68,7 @@ static int compareVersions(const QString &v1, const QString &v2)
int n1 = v1L.value(i).toInt(&n1Ok); int n1 = v1L.value(i).toInt(&n1Ok);
int n2 = v2L.value(i).toInt(&n2Ok); int n2 = v2L.value(i).toInt(&n2Ok);
if (!(n1Ok && n2Ok)) { if (!(n1Ok && n2Ok)) {
qDebug() << QString::fromLatin1("Failed to compare version %1 and %2").arg(v1, v2); qCWarning(probeLog) << QString::fromLatin1("Failed to compare version %1 and %2").arg(v1, v2);
return 0; return 0;
} }
if (n1 > n2) if (n1 > n2)
@@ -92,8 +94,7 @@ void IosProbe::addDeveloperPath(const QString &path)
if (m_developerPaths.contains(path)) if (m_developerPaths.contains(path))
return; return;
m_developerPaths.append(path); m_developerPaths.append(path);
if (debugProbe) qCDebug(probeLog) << QString::fromLatin1("Added developer path %1").arg(path);
qDebug() << QString::fromLatin1("Added developer path %1").arg(path);
} }
void IosProbe::detectDeveloperPaths() void IosProbe::detectDeveloperPaths()
@@ -103,7 +104,7 @@ void IosProbe::detectDeveloperPaths()
QStringList arguments(QLatin1String("--print-path")); QStringList arguments(QLatin1String("--print-path"));
selectedXcode.start(program, arguments, QProcess::ReadOnly); selectedXcode.start(program, arguments, QProcess::ReadOnly);
if (!selectedXcode.waitForFinished() || selectedXcode.exitCode()) { if (!selectedXcode.waitForFinished() || selectedXcode.exitCode()) {
qDebug() << QString::fromLatin1("Could not detect selected xcode with /usr/bin/xcode-select"); qCWarning(probeLog) << QString::fromLatin1("Could not detect selected xcode with /usr/bin/xcode-select");
} else { } else {
QString path = QString::fromLocal8Bit(selectedXcode.readAllStandardOutput()); QString path = QString::fromLocal8Bit(selectedXcode.readAllStandardOutput());
path.chop(1); path.chop(1);
@@ -114,8 +115,7 @@ void IosProbe::detectDeveloperPaths()
void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xcodeName) void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xcodeName)
{ {
if (debugProbe) qCDebug(probeLog) << QString::fromLatin1("Setting up platform \"%1\".").arg(xcodeName);
qDebug() << QString::fromLatin1("Setting up platform \"%1\".").arg(xcodeName);
QString indent = QLatin1String(" "); QString indent = QLatin1String(" ");
// detect clang (default toolchain) // detect clang (default toolchain)
@@ -124,20 +124,19 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
+ QLatin1String("/clang++")); + QLatin1String("/clang++"));
bool hasClang = clangFileInfo.exists(); bool hasClang = clangFileInfo.exists();
if (!hasClang) if (!hasClang)
qDebug() << indent << QString::fromLatin1("Default toolchain %1 not found.") qCWarning(probeLog) << indent << QString::fromLatin1("Default toolchain %1 not found.")
.arg(clangFileInfo.canonicalFilePath()); .arg(clangFileInfo.canonicalFilePath());
// Platforms // Platforms
QDir platformsDir(devPath + QLatin1String("/Platforms")); QDir platformsDir(devPath + QLatin1String("/Platforms"));
QFileInfoList platforms = platformsDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); QFileInfoList platforms = platformsDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QFileInfo &fInfo, platforms) { foreach (const QFileInfo &fInfo, platforms) {
if (fInfo.isDir() && fInfo.suffix() == QLatin1String("platform")) { if (fInfo.isDir() && fInfo.suffix() == QLatin1String("platform")) {
if (debugProbe) qCDebug(probeLog) << indent << QString::fromLatin1("Setting up %1").arg(fInfo.fileName());
qDebug() << indent << QString::fromLatin1("Setting up %1").arg(fInfo.fileName());
QSettingsPtr infoSettings(new QSettings( QSettingsPtr infoSettings(new QSettings(
fInfo.absoluteFilePath() + QLatin1String("/Info.plist"), fInfo.absoluteFilePath() + QLatin1String("/Info.plist"),
QSettings::NativeFormat)); QSettings::NativeFormat));
if (!infoSettings->contains(QLatin1String("Name"))) { if (!infoSettings->contains(QLatin1String("Name"))) {
qDebug() << indent << QString::fromLatin1("Missing platform name in Info.plist of %1") qCWarning(probeLog) << indent << QString::fromLatin1("Missing platform name in Info.plist of %1")
.arg(fInfo.absoluteFilePath()); .arg(fInfo.absoluteFilePath());
continue; continue;
} }
@@ -145,7 +144,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (name != QLatin1String("macosx") && name != QLatin1String("iphoneos") if (name != QLatin1String("macosx") && name != QLatin1String("iphoneos")
&& name != QLatin1String("iphonesimulator")) && name != QLatin1String("iphonesimulator"))
{ {
qDebug() << indent << QString::fromLatin1("Skipping unknown platform %1").arg(name); qCWarning(probeLog) << indent << QString::fromLatin1("Skipping unknown platform %1").arg(name);
continue; continue;
} }
@@ -174,7 +173,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (defaultProp.contains(QLatin1String("NATIVE_ARCH"))) { if (defaultProp.contains(QLatin1String("NATIVE_ARCH"))) {
QString arch = defaultProp.value(QLatin1String("NATIVE_ARCH")).toString(); QString arch = defaultProp.value(QLatin1String("NATIVE_ARCH")).toString();
if (!arch.startsWith(QLatin1String("arm"))) if (!arch.startsWith(QLatin1String("arm")))
qDebug() << indent << QString::fromLatin1("Expected arm architecture, not %1").arg(arch); qCWarning(probeLog) << indent << QString::fromLatin1("Expected arm architecture, not %1").arg(arch);
extraFlags << QLatin1String("-arch") << arch; extraFlags << QLatin1String("-arch") << arch;
} else if (name == QLatin1String("iphonesimulator")) { } else if (name == QLatin1String("iphonesimulator")) {
// don't generate a toolchain for 64 bit (to fix when we support that) // don't generate a toolchain for 64 bit (to fix when we support that)
@@ -195,8 +194,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-')); QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-'));
clangProfile.architecture = compilerTripletl.value(0); clangProfile.architecture = compilerTripletl.value(0);
clangProfile.backendFlags = extraFlags; clangProfile.backendFlags = extraFlags;
if (debugProbe) qCDebug(probeLog) << indent << QString::fromLatin1("* adding profile %1").arg(clangProfile.name);
qDebug() << indent << QString::fromLatin1("* adding profile %1").arg(clangProfile.name);
m_platforms[clangProfile.name] = clangProfile; m_platforms[clangProfile.name] = clangProfile;
clangProfile.platformKind |= Platform::Cxx11Support; clangProfile.platformKind |= Platform::Cxx11Support;
clangProfile.backendFlags.append(QLatin1String("-std=c++11")); clangProfile.backendFlags.append(QLatin1String("-std=c++11"));
@@ -220,8 +218,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-')); QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-'));
gccProfile.architecture = compilerTripletl.value(0); gccProfile.architecture = compilerTripletl.value(0);
gccProfile.backendFlags = extraFlags; gccProfile.backendFlags = extraFlags;
if (debugProbe) qCDebug(probeLog) << indent << QString::fromLatin1("* adding profile %1").arg(gccProfile.name);
qDebug() << indent << QString::fromLatin1("* adding profile %1").arg(gccProfile.name);
m_platforms[gccProfile.name] = gccProfile; m_platforms[gccProfile.name] = gccProfile;
} }
@@ -246,9 +243,8 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
bool isBaseSdk = sdkInfo->value((QLatin1String("isBaseSDK"))).toString() bool isBaseSdk = sdkInfo->value((QLatin1String("isBaseSDK"))).toString()
.toLower() != QLatin1String("no"); .toLower() != QLatin1String("no");
if (!isBaseSdk) { if (!isBaseSdk) {
if (debugProbe) qCDebug(probeLog) << indent << QString::fromLatin1("Skipping non base Sdk %1")
qDebug() << indent << QString::fromLatin1("Skipping non base Sdk %1") .arg(currentSdkName.toString());
.arg(currentSdkName.toString());
continue; continue;
} }
if (sdkName.isEmpty()) { if (sdkName.isEmpty()) {
@@ -265,7 +261,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (!sdkPath.isEmpty()) if (!sdkPath.isEmpty())
sysRoot = sdkPath; sysRoot = sdkPath;
else if (!sdkName.isEmpty()) else if (!sdkName.isEmpty())
qDebug() << indent << QString::fromLatin1("Failed to find sysroot %1").arg(sdkName); qCDebug(probeLog) << indent << QString::fromLatin1("Failed to find sysroot %1").arg(sdkName);
} }
if (hasClang && !sysRoot.isEmpty()) { if (hasClang && !sysRoot.isEmpty()) {
m_platforms[clangFullName].platformKind |= Platform::BasePlatform; m_platforms[clangFullName].platformKind |= Platform::BasePlatform;

View File

@@ -35,7 +35,6 @@
#include <proparser/profileevaluator.h> #include <proparser/profileevaluator.h>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug>
namespace Ios { namespace Ios {
namespace Internal { namespace Internal {

View File

@@ -28,6 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "iosrunconfiguration.h" #include "iosrunconfiguration.h"
#include "iosconstants.h"
#include "iosmanager.h" #include "iosmanager.h"
#include "iosdeploystep.h" #include "iosdeploystep.h"
#include "ui_iosrunconfiguration.h" #include "ui_iosrunconfiguration.h"
@@ -212,7 +213,7 @@ Utils::FileName IosRunConfiguration::bundleDirectory() const
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
bool isDevice = (devType == Constants::IOS_DEVICE_TYPE); bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) { if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
qDebug() << "unexpected device type in bundleDirForTarget: " << devType.toString(); qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
return res; return res;
} }
QmakeBuildConfiguration *bc = QmakeBuildConfiguration *bc =
@@ -246,7 +247,7 @@ Utils::FileName IosRunConfiguration::bundleDirectory() const
res.appendPath(QLatin1String("Release-iphonesimulator")); res.appendPath(QLatin1String("Release-iphonesimulator"));
break; break;
default: default:
qDebug() << "IosBuildStep had an unknown buildType " qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
<< target()->activeBuildConfiguration()->buildType(); << target()->activeBuildConfiguration()->buildType();
} }
} }
@@ -413,7 +414,7 @@ QStringList IosRunConfigurationWidget::stringToArgList(const QString &args) cons
res = QtcProcess::splitArgs(args + QLatin1Char('\"'), OsTypeMac, false, &err); res = QtcProcess::splitArgs(args + QLatin1Char('\"'), OsTypeMac, false, &err);
break; break;
case QtcProcess::FoundMeta: case QtcProcess::FoundMeta:
qDebug() << "IosRunConfigurationWidget FoundMeta (should not happen)"; qCWarning(iosLog) << "IosRunConfigurationWidget FoundMeta (should not happen)";
break; break;
} }
return res; return res;

View File

@@ -34,11 +34,11 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/logging.h>
#include <QProcess> #include <QProcess>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QSocketNotifier> #include <QSocketNotifier>
#include <QDebug>
#include <QCoreApplication> #include <QCoreApplication>
#include <QList> #include <QList>
#include <QScopedArrayPointer> #include <QScopedArrayPointer>
@@ -49,7 +49,9 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
static const bool debugToolHandler = false; namespace {
Q_LOGGING_CATEGORY(toolHandlerLog, "qtc.ios.toolhandler")
}
namespace Ios { namespace Ios {
@@ -220,8 +222,7 @@ IosToolHandlerPrivate::IosToolHandlerPrivate(IosDeviceType::Enum devType,
frameworkPaths << QLatin1String("/System/Library/Frameworks") frameworkPaths << QLatin1String("/System/Library/Frameworks")
<< QLatin1String("/System/Library/PrivateFrameworks"); << QLatin1String("/System/Library/PrivateFrameworks");
env.insert(QLatin1String("DYLD_FALLBACK_FRAMEWORK_PATH"), frameworkPaths.join(QLatin1String(":"))); env.insert(QLatin1String("DYLD_FALLBACK_FRAMEWORK_PATH"), frameworkPaths.join(QLatin1String(":")));
if (debugToolHandler) qCDebug(toolHandlerLog) << "IosToolHandler runEnv:" << env.toStringList();
qDebug() << "IosToolHandler runEnv:" << env.toStringList();
process.setProcessEnvironment(env); process.setProcessEnvironment(env);
QObject::connect(&process, SIGNAL(readyReadStandardOutput()), q, SLOT(subprocessHasData())); QObject::connect(&process, SIGNAL(readyReadStandardOutput()), q, SLOT(subprocessHasData()));
QObject::connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), QObject::connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)),
@@ -241,26 +242,24 @@ void IosToolHandlerPrivate::start(const QString &exe, const QStringList &args)
{ {
QTC_CHECK(state == NonStarted); QTC_CHECK(state == NonStarted);
state = Starting; state = Starting;
if (debugToolHandler) qCDebug(toolHandlerLog) << "running " << exe << args;
qDebug() << "running " << exe << args;
process.start(exe, args); process.start(exe, args);
state = StartedInferior; state = StartedInferior;
} }
void IosToolHandlerPrivate::stop(int errorCode) void IosToolHandlerPrivate::stop(int errorCode)
{ {
if (debugToolHandler) qCDebug(toolHandlerLog) << "IosToolHandlerPrivate::stop";
qDebug() << "IosToolHandlerPrivate::stop";
State oldState = state; State oldState = state;
state = Stopped; state = Stopped;
switch (oldState) { switch (oldState) {
case NonStarted: case NonStarted:
qDebug() << "IosToolHandler::stop() when state was NonStarted"; qCWarning(toolHandlerLog) << "IosToolHandler::stop() when state was NonStarted";
// pass // pass
case Starting: case Starting:
switch (op){ switch (op){
case OpNone: case OpNone:
qDebug() << "IosToolHandler::stop() when op was OpNone"; qCWarning(toolHandlerLog) << "IosToolHandler::stop() when op was OpNone";
break; break;
case OpAppTransfer: case OpAppTransfer:
didTransferApp(bundlePath, deviceId, IosToolHandler::Failure); didTransferApp(bundlePath, deviceId, IosToolHandler::Failure);
@@ -343,8 +342,7 @@ void IosToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
errorMsg(IosToolHandler::tr("iOS tool Error %1").arg(error)); errorMsg(IosToolHandler::tr("iOS tool Error %1").arg(error));
stop(-1); stop(-1);
if (error == QProcess::FailedToStart) { if (error == QProcess::FailedToStart) {
if (debugToolHandler) qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
qDebug() << "IosToolHandler::finished(" << this << ")";
emit q->finished(q); emit q->finished(q);
} }
} }
@@ -352,8 +350,7 @@ void IosToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
void IosToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus) void IosToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{ {
stop((exitStatus == QProcess::NormalExit) ? exitCode : -1 ); stop((exitStatus == QProcess::NormalExit) ? exitCode : -1 );
if (debugToolHandler) qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
qDebug() << "IosToolHandler::finished(" << this << ")";
killTimer.stop(); killTimer.stop();
emit q->finished(q); emit q->finished(q);
} }
@@ -362,7 +359,7 @@ void IosToolHandlerPrivate::processXml()
{ {
while (!outputParser.atEnd()) { while (!outputParser.atEnd()) {
QXmlStreamReader::TokenType tt = outputParser.readNext(); QXmlStreamReader::TokenType tt = outputParser.readNext();
//qDebug() << "processXml, tt=" << tt; //qCDebug(toolHandlerLog) << "processXml, tt=" << tt;
switch (tt) { switch (tt) {
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
// The reader has not yet read anything. // The reader has not yet read anything.
@@ -449,7 +446,7 @@ void IosToolHandlerPrivate::processXml()
int qmlServerPort = attributes.value(QLatin1String("qml_server")).toString().toInt(); int qmlServerPort = attributes.value(QLatin1String("qml_server")).toString().toInt();
gotServerPorts(bundlePath, deviceId, gdbServerPort, qmlServerPort); gotServerPorts(bundlePath, deviceId, gdbServerPort, qmlServerPort);
} else { } else {
qDebug() << "unexpected element " << elName; qCWarning(toolHandlerLog) << "unexpected element " << elName;
} }
break; break;
} }
@@ -533,19 +530,18 @@ void IosToolHandlerPrivate::processXml()
} }
if (outputParser.hasError() if (outputParser.hasError()
&& outputParser.error() != QXmlStreamReader::PrematureEndOfDocumentError) { && outputParser.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
qDebug() << "error parsing iosTool output:" << outputParser.errorString(); qCWarning(toolHandlerLog) << "error parsing iosTool output:" << outputParser.errorString();
stop(-1); stop(-1);
} }
} }
void IosToolHandlerPrivate::subprocessHasData() void IosToolHandlerPrivate::subprocessHasData()
{ {
if (debugToolHandler) qCDebug(toolHandlerLog) << "subprocessHasData, state:" << state;
qDebug() << "subprocessHasData, state:" << state;
while (true) { while (true) {
switch (state) { switch (state) {
case NonStarted: case NonStarted:
qDebug() << "IosToolHandler unexpected state in subprocessHasData: NonStarted"; qCWarning(toolHandlerLog) << "IosToolHandler unexpected state in subprocessHasData: NonStarted";
// pass // pass
case Starting: case Starting:
case StartedInferior: case StartedInferior:
@@ -560,8 +556,7 @@ void IosToolHandlerPrivate::subprocessHasData()
} }
if (rRead == 0) if (rRead == 0)
return; return;
if (debugToolHandler) qCDebug(toolHandlerLog) << "subprocessHasData read " << QByteArray(buf, rRead);
qDebug() << "subprocessHasData read " << QByteArray(buf, rRead);
outputParser.addData(QByteArray(buf, rRead)); outputParser.addData(QByteArray(buf, rRead));
processXml(); processXml();
} }
@@ -697,7 +692,7 @@ void IosSimulatorToolHandlerPrivate::addDeviceArguments(QStringList &args) const
{ {
switch (devType) { switch (devType) {
case IosDeviceType::IosDevice: case IosDeviceType::IosDevice:
qDebug() << "IosSimulatorToolHandlerPrivate has device type IosDeviceType"; qCWarning(toolHandlerLog) << "IosSimulatorToolHandlerPrivate has device type IosDeviceType";
break; break;
case IosDeviceType::SimulatedIphone: case IosDeviceType::SimulatedIphone:
args << QLatin1String("--family") << QLatin1String("iphone"); args << QLatin1String("--family") << QLatin1String("iphone");