forked from qt-creator/qt-creator
Ios: Fix incorrect Xcode version detected
pkgutil always return the Xcode path installed via app store Task-number: QTCREATORBUG-18091 Change-Id: I47b5a9c3f3a482feea2dc903dbff3441a3930ab6 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
@@ -210,30 +210,16 @@ static void setupKit(Kit *kit, Core::Id pDeviceType, const ToolChainPair& toolCh
|
||||
SysRootKitInformation::setSysRoot(kit, sdkPath);
|
||||
}
|
||||
|
||||
static QVersionNumber findXcodeVersion()
|
||||
static QVersionNumber findXcodeVersion(const Utils::FileName &developerPath)
|
||||
{
|
||||
Utils::SynchronousProcess pkgUtilProcess;
|
||||
Utils::SynchronousProcessResponse resp =
|
||||
pkgUtilProcess.runBlocking("pkgutil", QStringList("--pkg-info-plist=com.apple.pkg.Xcode"));
|
||||
if (resp.result == Utils::SynchronousProcessResponse::Finished) {
|
||||
QDomDocument xcodeVersionDoc;
|
||||
if (xcodeVersionDoc.setContent(resp.allRawOutput())) {
|
||||
QDomNodeList nodes = xcodeVersionDoc.elementsByTagName(QStringLiteral("key"));
|
||||
for (int i = 0; i < nodes.count(); ++i) {
|
||||
QDomElement elem = nodes.at(i).toElement();
|
||||
if (elem.text().compare(QStringLiteral("pkg-version")) == 0) {
|
||||
QString versionStr = elem.nextSiblingElement().text();
|
||||
return QVersionNumber::fromString(versionStr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCDebug(iosCommonLog) << "Error finding Xcode version. Cannot parse xml output from pkgutil.";
|
||||
}
|
||||
FileName xcodeInfo = developerPath.parentDir().appendPath("Info.plist");
|
||||
if (xcodeInfo.exists()) {
|
||||
QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat);
|
||||
return QVersionNumber::fromString(settings.value("CFBundleShortVersionString").toString());
|
||||
} else {
|
||||
qCDebug(iosCommonLog) << "Error finding Xcode version. pkgutil command failed.";
|
||||
qCDebug(iosCommonLog) << "Error finding Xcode version." << xcodeInfo.toUserOutput() <<
|
||||
"does not exist.";
|
||||
}
|
||||
|
||||
qCDebug(iosCommonLog) << "Error finding Xcode version. Unknow error.";
|
||||
return QVersionNumber();
|
||||
}
|
||||
|
||||
@@ -439,7 +425,7 @@ void IosConfigurations::setDeveloperPath(const FileName &devPath)
|
||||
m_instance->updateSimulators();
|
||||
|
||||
// Find xcode version.
|
||||
m_instance->m_xcodeVersion = findXcodeVersion();
|
||||
m_instance->m_xcodeVersion = findXcodeVersion(m_instance->m_developerPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,26 +486,11 @@ void IosDebugSupport::start()
|
||||
setInferiorExecutable(iosRunConfig->localExecutable().toString());
|
||||
setRemoteChannel("connect://localhost:" + gdbServerPort.toString());
|
||||
|
||||
FileName xcodeInfo = IosConfigurations::developerPath().parentDir().appendPath("Info.plist");
|
||||
bool buggyLldb = false;
|
||||
if (xcodeInfo.exists()) {
|
||||
QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat);
|
||||
QStringList version = settings.value(QLatin1String("CFBundleShortVersionString")).toString()
|
||||
.split('.');
|
||||
if (version.value(0).toInt() == 5 && version.value(1, QString::number(1)).toInt() == 0)
|
||||
buggyLldb = true;
|
||||
}
|
||||
QString bundlePath = iosRunConfig->bundleDirectory().toString();
|
||||
bundlePath.chop(4);
|
||||
FileName dsymPath = FileName::fromString(bundlePath.append(".dSYM"));
|
||||
if (!dsymPath.exists()) {
|
||||
if (buggyLldb)
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("Debugging with Xcode 5.0.x can be unreliable without a dSYM. "
|
||||
"To create one, add a dsymutil deploystep."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
} else if (dsymPath.toFileInfo().lastModified()
|
||||
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||
if (dsymPath.exists() && dsymPath.toFileInfo().lastModified()
|
||||
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
|
||||
.arg(dsymPath.toUserOutput()),
|
||||
|
||||
Reference in New Issue
Block a user