QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const { // if the user overrode us, then return his working directory if (!m_userWorkingDirectory.isEmpty()) return m_userWorkingDirectory; // else what the pro file reader tells us QmakeProject *pro = static_cast<QmakeProject *>(target()->project()); const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePath); return extractWorkingDirAndExecutable(node).first; }
QString IosRunConfiguration::appName() const { QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project()); if (pro) { const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(profilePath()); if (node) { TargetInformation ti = node->targetInformation(); if (ti.valid) return ti.target; } } qDebug() << "IosRunConfiguration::appName failed"; return QString(); }
FileName IosRunConfiguration::bundleDirectory() const { FileName res; Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); bool isDevice = (devType == Constants::IOS_DEVICE_TYPE); if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) { qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString(); return res; } QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration()); if (bc) { QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project()); const QmakeProFileNode *node = 0; if (pro) node = pro->rootQmakeProjectNode(); if (node) node = node->findProFileFor(profilePath()); if (node) { TargetInformation ti = node->targetInformation(); if (ti.valid) res = FileName::fromString(ti.buildDir); } if (res.isEmpty()) res = bc->buildDirectory(); switch (bc->buildType()) { case BuildConfiguration::Debug : case BuildConfiguration::Unknown : if (isDevice) res.appendPath(QLatin1String("Debug-iphoneos")); else res.appendPath(QLatin1String("Debug-iphonesimulator")); break; case BuildConfiguration::Profile : case BuildConfiguration::Release : if (isDevice) res.appendPath(QLatin1String("Release-iphoneos")); else res.appendPath(QLatin1String("Release-iphonesimulator")); break; default: qCWarning(iosLog) << "IosBuildStep had an unknown buildType " << target()->activeBuildConfiguration()->buildType(); } } res.appendPath(applicationName() + QLatin1String(".app")); return res; }
QString DesktopQmakeRunConfiguration::executable() const { QmakeProject *pro = static_cast<QmakeProject *>(target()->project()); const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePath); return extractWorkingDirAndExecutable(node).second; }
void QmakeProjectConfigWidget::updateProblemLabel() { m_ui->shadowBuildDirEdit->triggerChanged(); ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit(); const QString proFileName = m_buildConfiguration->target()->project()->projectFilePath().toString(); // Check for Qt version: QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); if (!version) { setProblemLabel(tr("This kit cannot build this project since it does not define a Qt version.")); return; } QmakeProject *p = static_cast<QmakeProject *>(m_buildConfiguration->target()->project()); if (p->rootQmakeProjectNode()->parseInProgress() || !p->rootQmakeProjectNode()->validParse()) { setProblemLabel(QString()); return; } bool targetMismatch = false; bool incompatibleBuild = false; bool allGood = false; // we only show if we actually have a qmake and makestep if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) { QString makefile = m_buildConfiguration->buildDirectory().toString() + QLatin1Char('/'); if (m_buildConfiguration->makefile().isEmpty()) makefile.append(QLatin1String("Makefile")); else makefile.append(m_buildConfiguration->makefile()); switch (m_buildConfiguration->compareToImportFrom(makefile)) { case QmakeBuildConfiguration::MakefileMatches: allGood = true; break; case QmakeBuildConfiguration::MakefileMissing: allGood = true; break; case QmakeBuildConfiguration::MakefileIncompatible: incompatibleBuild = true; break; case QmakeBuildConfiguration::MakefileForWrongProject: targetMismatch = true; break; } } QString shadowBuildWarning; if (!version->supportsShadowBuilds() && m_buildConfiguration->isShadowBuild()) { shadowBuildWarning = tr("The Qt version %1 does not support shadow builds, building might fail.") .arg(version->displayName()) + QLatin1String("<br>"); } if (allGood) { QString buildDirectory = m_buildConfiguration->target()->project()->projectDirectory().toString(); if (m_buildConfiguration->isShadowBuild()) buildDirectory = m_buildConfiguration->buildDirectory().toString(); QList<ProjectExplorer::Task> issues; issues = version->reportIssues(proFileName, buildDirectory); Utils::sort(issues); if (!issues.isEmpty() || !shadowBuildWarning.isEmpty()) { QString text = QLatin1String("<nobr>") + shadowBuildWarning; foreach (const ProjectExplorer::Task &task, issues) { QString type; switch (task.type) { case ProjectExplorer::Task::Error: type = tr("Error:"); type += QLatin1Char(' '); break; case ProjectExplorer::Task::Warning: type = tr("Warning:"); type += QLatin1Char(' '); break; case ProjectExplorer::Task::Unknown: default: break; } if (!text.endsWith(QLatin1String("br>"))) text.append(QLatin1String("<br>")); text.append(type + task.description); } setProblemLabel(text); return; }
RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfig, QString *errorMessage) { Target *target = runConfig->target(); if (!target) return 0; ProjectExplorer::IDevice::ConstPtr device = DeviceKitInformation::device(target->kit()); if (device.isNull()) return 0; QmakeProject *project = static_cast<QmakeProject *>(target->project()); Kit *kit = target->kit(); DebuggerStartParameters params; if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) { params.startMode = AttachToRemoteProcess; params.platform = QLatin1String("remote-ios"); IosDevice::ConstPtr iosDevice = device.dynamicCast<const IosDevice>(); if (iosDevice.isNull()) return 0; QString osVersion = iosDevice->osVersion(); Utils::FileName deviceSdk1 = Utils::FileName::fromString(QDir::homePath() + QLatin1String("/Library/Developer/Xcode/iOS DeviceSupport/") + osVersion + QLatin1String("/Symbols")); QString deviceSdk; if (deviceSdk1.toFileInfo().isDir()) { deviceSdk = deviceSdk1.toString(); } else { Utils::FileName deviceSdk2 = IosConfigurations::developerPath() .appendPath(QLatin1String("Platforms/iPhoneOS.platform/DeviceSupport/")) .appendPath(osVersion).appendPath(QLatin1String("Symbols")); if (deviceSdk2.toFileInfo().isDir()) { deviceSdk = deviceSdk2.toString(); } else { TaskHub::addTask(Task::Warning, tr( "Could not find device specific debug symbols at %1. " "Debugging initialization will be slow until you open the Organizer window of " "Xcode with the device connected to have the symbols generated.") .arg(deviceSdk1.toUserOutput()), ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); } } params.deviceSymbolsRoot = deviceSdk; } else { params.startMode = AttachExternal; params.platform = QLatin1String("ios-simulator"); } params.displayName = runConfig->applicationName(); params.remoteSetupNeeded = true; if (!params.breakOnMain) params.continueAfterAttach = true; Debugger::DebuggerRunConfigurationAspect *aspect = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); bool cppDebug = aspect->useCppDebugger(); bool qmlDebug = aspect->useQmlDebugger(); if (cppDebug) { params.languages |= CppLanguage; params.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); if (ToolChain *tc = ToolChainKitInformation::toolChain(kit)) params.toolChainAbi = tc->targetAbi(); params.executable = runConfig->localExecutable().toString(); params.remoteChannel = QLatin1String("connect://localhost:0"); Utils::FileName xcodeInfo = IosConfigurations::developerPath().parentDir() .appendPath(QLatin1String("Info.plist")); bool buggyLldb = false; if (xcodeInfo.toFileInfo().exists()) { QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat); QStringList version = settings.value(QLatin1String("CFBundleShortVersionString")).toString() .split(QLatin1Char('.')); if (version.value(0).toInt() == 5 && version.value(1, QString::number(1)).toInt() == 0) buggyLldb = true; } QString bundlePath = runConfig->bundleDirectory().toString(); bundlePath.chop(4); Utils::FileName dsymPath = Utils::FileName::fromString( bundlePath.append(QLatin1String(".dSYM"))); if (!dsymPath.toFileInfo().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(runConfig->localExecutable().toUserOutput()).lastModified()) { TaskHub::addTask(Task::Warning, tr("The dSYM %1 seems to be outdated, it might confuse the debugger.") .arg(dsymPath.toUserOutput()), ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); } } if (qmlDebug) { params.languages |= QmlLanguage; params.projectSourceDirectory = project->projectDirectory().toString(); params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles); params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir(); if (!cppDebug) params.startMode = AttachToRemoteServer; } DebuggerRunControl * const debuggerRunControl = DebuggerPlugin::createDebugger(params, runConfig, errorMessage); if (debuggerRunControl) new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug); return debuggerRunControl; }