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);
|
SysRootKitInformation::setSysRoot(kit, sdkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QVersionNumber findXcodeVersion()
|
static QVersionNumber findXcodeVersion(const Utils::FileName &developerPath)
|
||||||
{
|
{
|
||||||
Utils::SynchronousProcess pkgUtilProcess;
|
FileName xcodeInfo = developerPath.parentDir().appendPath("Info.plist");
|
||||||
Utils::SynchronousProcessResponse resp =
|
if (xcodeInfo.exists()) {
|
||||||
pkgUtilProcess.runBlocking("pkgutil", QStringList("--pkg-info-plist=com.apple.pkg.Xcode"));
|
QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat);
|
||||||
if (resp.result == Utils::SynchronousProcessResponse::Finished) {
|
return QVersionNumber::fromString(settings.value("CFBundleShortVersionString").toString());
|
||||||
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 {
|
} else {
|
||||||
qCDebug(iosCommonLog) << "Error finding Xcode version. Cannot parse xml output from pkgutil.";
|
qCDebug(iosCommonLog) << "Error finding Xcode version." << xcodeInfo.toUserOutput() <<
|
||||||
|
"does not exist.";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
qCDebug(iosCommonLog) << "Error finding Xcode version. pkgutil command failed.";
|
|
||||||
}
|
|
||||||
|
|
||||||
qCDebug(iosCommonLog) << "Error finding Xcode version. Unknow error.";
|
|
||||||
return QVersionNumber();
|
return QVersionNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +425,7 @@ void IosConfigurations::setDeveloperPath(const FileName &devPath)
|
|||||||
m_instance->updateSimulators();
|
m_instance->updateSimulators();
|
||||||
|
|
||||||
// Find xcode version.
|
// Find xcode version.
|
||||||
m_instance->m_xcodeVersion = findXcodeVersion();
|
m_instance->m_xcodeVersion = findXcodeVersion(m_instance->m_developerPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,25 +486,10 @@ void IosDebugSupport::start()
|
|||||||
setInferiorExecutable(iosRunConfig->localExecutable().toString());
|
setInferiorExecutable(iosRunConfig->localExecutable().toString());
|
||||||
setRemoteChannel("connect://localhost:" + gdbServerPort.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();
|
QString bundlePath = iosRunConfig->bundleDirectory().toString();
|
||||||
bundlePath.chop(4);
|
bundlePath.chop(4);
|
||||||
FileName dsymPath = FileName::fromString(bundlePath.append(".dSYM"));
|
FileName dsymPath = FileName::fromString(bundlePath.append(".dSYM"));
|
||||||
if (!dsymPath.exists()) {
|
if (dsymPath.exists() && dsymPath.toFileInfo().lastModified()
|
||||||
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()) {
|
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||||
TaskHub::addTask(Task::Warning,
|
TaskHub::addTask(Task::Warning,
|
||||||
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
|
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
|
||||||
|
|||||||
Reference in New Issue
Block a user