Qnx: Remove run-time dependency on QmakeProjectManager

This re-uses what work in RemoteLinux. There's still a compile-time header
dependency due to the QmakeProjectManager::Constants::KIT_INFORMATION_ID
constant.

Change-Id: I6d6b8bbaed8ec2e80d54afe62a5a6b7f84eb37ec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-02-08 15:39:34 +01:00
parent 7698d95576
commit 68526cbd19
8 changed files with 18 additions and 26 deletions

View File

@@ -26,6 +26,7 @@
#include "qmakekitinformation.h" #include "qmakekitinformation.h"
#include "qmakekitconfigwidget.h" #include "qmakekitconfigwidget.h"
#include "qmakeprojectmanagerconstants.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
@@ -61,10 +62,10 @@ QList<Task> QmakeKitInformation::validate(const Kit *k) const
FileName mkspec = QmakeKitInformation::mkspec(k); FileName mkspec = QmakeKitInformation::mkspec(k);
if (!version && !mkspec.isEmpty()) if (!version && !mkspec.isEmpty())
result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."), result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."),
FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM); FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
if (version && !version->hasMkspec(mkspec)) if (version && !version->hasMkspec(mkspec))
result << Task(Task::Error, tr("Mkspec not found for Qt version."), result << Task(Task::Error, tr("Mkspec not found for Qt version."),
FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM); FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
return result; return result;
} }
@@ -82,13 +83,13 @@ void QmakeKitInformation::setup(Kit *k)
if (spec.isEmpty()) if (spec.isEmpty())
spec = version->mkspec(); spec = version->mkspec();
ToolChain *tc = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID); ToolChain *tc = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) { if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
const QList<ToolChain *> possibleTcs = ToolChainManager::toolChains( const QList<ToolChain *> possibleTcs = ToolChainManager::toolChains(
[version](const ToolChain *t) { [version](const ToolChain *t) {
return t->isValid() return t->isValid()
&& t->language() == Core::Id(Constants::CXX_LANGUAGE_ID) && t->language() == Core::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID)
&& version->qtAbis().contains(t->targetAbi()); && version->qtAbis().contains(t->targetAbi());
}); });
if (!possibleTcs.isEmpty()) { if (!possibleTcs.isEmpty()) {
@@ -121,7 +122,7 @@ void QmakeKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander)
Core::Id QmakeKitInformation::id() Core::Id QmakeKitInformation::id()
{ {
return "QtPM4.mkSpecInformation"; return Constants::KIT_INFORMATION_ID;
} }
FileName QmakeKitInformation::mkspec(const Kit *k) FileName QmakeKitInformation::mkspec(const Kit *k)
@@ -152,7 +153,8 @@ FileName QmakeKitInformation::defaultMkspec(const Kit *k)
if (!version) // No version, so no qmake if (!version) // No version, so no qmake
return FileName(); return FileName();
return version->mkspecFor(ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID)); return version->mkspecFor(ToolChainKitInformation::toolChain(k,
ProjectExplorer::Constants::CXX_LANGUAGE_ID));
} }
} // namespace QmakeProjectManager } // namespace QmakeProjectManager

View File

@@ -67,5 +67,8 @@ const char QMAKE_BC_ID[] = "Qt4ProjectManager.Qt4BuildConfiguration";
// ICONS // ICONS
const char ICON_QTQUICK_APP[] = ":/wizards/images/qtquickapp.png"; const char ICON_QTQUICK_APP[] = ":/wizards/images/qtquickapp.png";
// Kit
const char KIT_INFORMATION_ID[] = "QtPM4.mkSpecInformation";
} // namespace Constants } // namespace Constants
} // namespace QmakeProjectManager } // namespace QmakeProjectManager

View File

@@ -12,7 +12,6 @@ QtcPlugin {
Depends { name: "Debugger" } Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" } Depends { name: "QtSupport" }
Depends { name: "QmakeProjectManager" }
Depends { name: "RemoteLinux" } Depends { name: "RemoteLinux" }
files: [ files: [

View File

@@ -8,6 +8,5 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \ coreplugin \
debugger \ debugger \
projectexplorer \ projectexplorer \
qmakeprojectmanager \
qtsupport \ qtsupport \
remotelinux remotelinux

View File

@@ -41,7 +41,7 @@
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qmakeprojectmanager/qmakekitinformation.h> #include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
#include <debugger/debuggeritem.h> #include <debugger/debuggeritem.h>
#include <debugger/debuggeritemmanager.h> #include <debugger/debuggeritemmanager.h>
@@ -329,7 +329,7 @@ ProjectExplorer::Kit *QnxConfiguration::createKit(
kit->setSticky(DeviceTypeKitInformation::id(), true); kit->setSticky(DeviceTypeKitInformation::id(), true);
kit->setSticky(SysRootKitInformation::id(), true); kit->setSticky(SysRootKitInformation::id(), true);
kit->setSticky(DebuggerKitInformation::id(), true); kit->setSticky(DebuggerKitInformation::id(), true);
kit->setSticky(QmakeProjectManager::QmakeKitInformation::id(), true); kit->setSticky(QmakeProjectManager::Constants::KIT_INFORMATION_ID, true);
// add kit with device and qt version not sticky // add kit with device and qt version not sticky
KitManager::registerKit(kit); KitManager::registerKit(kit);

View File

@@ -29,9 +29,6 @@
#include <projectexplorer/runnables.h> #include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <remotelinux/remotelinuxrunconfigurationwidget.h> #include <remotelinux/remotelinuxrunconfigurationwidget.h>
#include <utils/environment.h> #include <utils/environment.h>

View File

@@ -31,7 +31,8 @@
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <QFileInfo>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -47,18 +48,11 @@ QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
QList<RunConfigurationCreationInfo> QnxRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const QList<RunConfigurationCreationInfo> QnxRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
{ {
auto project = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()); Q_UNUSED(mode);
return Utils::transform(project->buildTargets(mode), [this](const BuildTargetInfo &bti) { return Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
return convert(tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName())); return convert(tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName()), bti.targetName);
}); });
} }
bool QnxRunConfigurationFactory::canCreateHelper(ProjectExplorer::Target *parent,
const QString &buildTarget) const
{
auto project = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project());
return project->hasApplicationProFile(Utils::FileName::fromString(buildTarget));
}
} // namespace Internal } // namespace Internal
} // namespace Qnx } // namespace Qnx

View File

@@ -40,8 +40,6 @@ public:
QList<ProjectExplorer::RunConfigurationCreationInfo> QList<ProjectExplorer::RunConfigurationCreationInfo>
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override; availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
}; };
} // namespace Internal } // namespace Internal