Commit d323d595 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

QtVersion: Add a method to query the target device type



Add and implement a method to get the supported target device
types to the BaseQtVersion interface. Implement this for all
Qt versions.

Validate that the Qt version's target device type matches up
with the device type set in the kit and warn on mismatch.

Change-Id: I95da42031022663776afe23a50eae3677bdb1dda
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent eebe44d3
......@@ -143,6 +143,11 @@ QSet<Core::Id> AndroidQtVersion::availableFeatures() const
return features;
}
QSet<Core::Id> AndroidQtVersion::targetDeviceTypes() const
{
return { Constants::ANDROID_DEVICE_TYPE };
}
QString AndroidQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
......
......@@ -57,6 +57,7 @@ public:
Utils::Environment qmakeRunEnvironment() const;
QSet<Core::Id> availableFeatures() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
......
......@@ -119,6 +119,11 @@ QSet<Core::Id> IosQtVersion::availableFeatures() const
return features;
}
QSet<Core::Id> IosQtVersion::targetDeviceTypes() const
{
return { Constants::IOS_DEVICE_TYPE };
}
QString IosQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::IOS_PLATFORM);
......
......@@ -56,6 +56,7 @@ public:
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override;
QSet<Core::Id> availableFeatures() const override;
QSet<Core::Id> targetDeviceTypes() const override;
QString platformName() const override;
QString platformDisplayName() const override;
......
......@@ -54,9 +54,7 @@ QString QnxDeviceConfigurationFactory::displayNameForId(Core::Id type) const
QList<Core::Id> QnxDeviceConfigurationFactory::availableCreationIds() const
{
QList<Core::Id> result;
result << Core::Id(Constants::QNX_QNX_OS_TYPE);
return result;
return { Constants::QNX_QNX_OS_TYPE };
}
bool QnxDeviceConfigurationFactory::canCreate() const
......
......@@ -85,6 +85,11 @@ QSet<Core::Id> QnxQtVersion::availableFeatures() const
return features;
}
QSet<Core::Id> QnxQtVersion::targetDeviceTypes() const
{
return { Constants::QNX_QNX_OS_TYPE };
}
QString QnxQtVersion::platformName() const
{
return QString::fromLatin1(Constants::QNX_QNX_PLATFORM_NAME);
......
......@@ -57,6 +57,7 @@ public:
QString description() const override;
QSet<Core::Id> availableFeatures() const override;
QSet<Core::Id> targetDeviceTypes() const override;
QString platformName() const override;
QString platformDisplayName() const override;
......
......@@ -484,6 +484,15 @@ QList<Task> BaseQtVersion::validateKit(const Kit *k)
if (qtAbis.isEmpty()) // No need to test if Qt does not know anyway...
return result;
const Id dt = DeviceTypeKitInformation::deviceTypeId(k);
const QSet<Id> tdt = targetDeviceTypes();
if (!tdt.isEmpty() && !tdt.contains(dt)) {
result << Task(Task::Warning,
QCoreApplication::translate("BaseQtVersion",
"Device type is not supported by Qt version."),
FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
}
ToolChain *tc = ToolChainKitInformation::toolChain(k);
if (tc) {
Abi targetAbi = tc->targetAbi();
......
......@@ -38,6 +38,7 @@
#include <projectexplorer/abi.h>
#include <QSet>
#include <QStringList>
#include <QVariantMap>
......@@ -206,6 +207,7 @@ public:
bool fromPath = false);
virtual QSet<Core::Id> availableFeatures() const;
virtual QSet<Core::Id> targetDeviceTypes() const = 0;
virtual QString platformName() const;
virtual QString platformDisplayName() const;
virtual bool supportsPlatform(const QString &platformName) const;
......
......@@ -31,8 +31,14 @@
#include "desktopqtversion.h"
#include "qtsupportconstants.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <remotelinux/remotelinux_constants.h>
#include <coreplugin/featureprovider.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <QCoreApplication>
using namespace QtSupport;
......@@ -90,6 +96,14 @@ QSet<Core::Id> DesktopQtVersion::availableFeatures() const
return features;
}
QSet<Core::Id> DesktopQtVersion::targetDeviceTypes() const
{
QSet<Core::Id> result = { ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE };
if (Utils::contains(qtAbis(), [](const ProjectExplorer::Abi a) { return a.os() == ProjectExplorer::Abi::LinuxOS; }))
result.insert(RemoteLinux::Constants::GenericLinuxOsType);
return result;
}
QString DesktopQtVersion::platformName() const
{
return QLatin1String(Constants::DESKTOP_PLATFORM);
......
......@@ -52,6 +52,7 @@ public:
QString description() const;
QSet<Core::Id> availableFeatures() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
};
......
......@@ -35,6 +35,9 @@
#include "qtversionmanager.h"
#include "qtparser.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
#include <utils/algorithm.h>
#include <utils/buildablehelperlibrary.h>
#include <utils/macroexpander.h>
......@@ -51,8 +54,8 @@ QtKitInformation::QtKitInformation()
setId(QtKitInformation::id());
setPriority(26000);
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
this, SLOT(kitsWereLoaded()));
connect(KitManager::instance(), &KitManager::kitsLoaded,
this, &QtKitInformation::kitsWereLoaded);
}
QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
......@@ -85,11 +88,11 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
QList<ProjectExplorer::Task> QtKitInformation::validate(const ProjectExplorer::Kit *k) const
{
QList<ProjectExplorer::Task> result;
QTC_ASSERT(QtVersionManager::isLoaded(), return result);
QTC_ASSERT(QtVersionManager::isLoaded(), return { });
BaseQtVersion *version = qtVersion(k);
if (!version)
return result;
return { };
return version->validateKit(k);
}
......
......@@ -31,18 +31,14 @@
#include "winceqtversion.h"
#include "qtsupportconstants.h"
#include <coreplugin/id.h>
#include <QCoreApplication>
#include <QStringList>
using namespace QtSupport;
using namespace QtSupport::Internal;
WinCeQtVersion::WinCeQtVersion()
: BaseQtVersion(),
m_archType(ProjectExplorer::Abi::ArmArchitecture)
{
}
WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archType,
bool isAutodetected, const QString &autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource),
......@@ -55,10 +51,6 @@ WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archT
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
WinCeQtVersion::~WinCeQtVersion()
{
}
WinCeQtVersion *WinCeQtVersion::clone() const
{
return new WinCeQtVersion(*this);
......@@ -113,3 +105,8 @@ QString WinCeQtVersion::platformDisplayName() const
{
return QLatin1String(Constants::WINDOWS_CE_PLATFORM_TR);
}
QSet<Core::Id> WinCeQtVersion::targetDeviceTypes() const
{
return QSet<Core::Id>();
}
......@@ -39,10 +39,10 @@ namespace Internal {
class WinCeQtVersion : public BaseQtVersion
{
public:
WinCeQtVersion();
WinCeQtVersion() = default;
WinCeQtVersion(const Utils::FileName &path, const QString &archType,
bool isAutodetected = false, const QString &autodetectionSource = QString());
~WinCeQtVersion();
~WinCeQtVersion() = default;
WinCeQtVersion *clone() const;
QString type() const;
......@@ -55,9 +55,10 @@ public:
QString platformName() const;
QString platformDisplayName() const;
QSet<Core::Id> targetDeviceTypes() const;
private:
ProjectExplorer::Abi::Architecture m_archType;
ProjectExplorer::Abi::Architecture m_archType = ProjectExplorer::Abi::ArmArchitecture;
};
} // Internal
......
......@@ -32,6 +32,7 @@
#include "remotelinux_constants.h"
#include <coreplugin/id.h>
#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
......@@ -39,19 +40,12 @@
namespace RemoteLinux {
namespace Internal {
EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion()
: BaseQtVersion()
{ }
EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
EmbeddedLinuxQtVersion::~EmbeddedLinuxQtVersion()
{ }
EmbeddedLinuxQtVersion *EmbeddedLinuxQtVersion::clone() const
{
return new EmbeddedLinuxQtVersion(*this);
......@@ -72,6 +66,11 @@ QString EmbeddedLinuxQtVersion::description() const
return QCoreApplication::translate("QtVersion", "Embedded Linux", "Qt Version is used for embedded Linux development");
}
QSet<Core::Id> EmbeddedLinuxQtVersion::targetDeviceTypes() const
{
return { Constants::GenericLinuxOsType };
}
QString EmbeddedLinuxQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::EMBEDDED_LINUX_PLATFORM);
......
......@@ -39,9 +39,9 @@ namespace Internal {
class EmbeddedLinuxQtVersion : public QtSupport::BaseQtVersion
{
public:
EmbeddedLinuxQtVersion();
EmbeddedLinuxQtVersion() = default;
EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
~EmbeddedLinuxQtVersion();
~EmbeddedLinuxQtVersion() = default;
EmbeddedLinuxQtVersion *clone() const;
QString type() const;
......@@ -50,6 +50,7 @@ public:
QString description() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
};
......
......@@ -31,16 +31,15 @@
#include "winrtphoneqtversion.h"
#include "winrtconstants.h"
#include <coreplugin/id.h>
#include <qtsupport/qtsupportconstants.h>
#include <QSet>
namespace WinRt {
namespace Internal {
WinRtPhoneQtVersion::WinRtPhoneQtVersion()
: WinRtQtVersion()
{
}
WinRtPhoneQtVersion::WinRtPhoneQtVersion(const Utils::FileName &path, bool isAutodetected,
const QString &autodetectionSource)
: WinRtQtVersion(path, isAutodetected, autodetectionSource)
......@@ -72,5 +71,10 @@ QString WinRtPhoneQtVersion::platformDisplayName() const
return QLatin1String(QtSupport::Constants::WINDOWS_PHONE_PLATFORM_TR);
}
QSet<Core::Id> WinRtPhoneQtVersion::targetDeviceTypes() const
{
return { Constants::WINRT_DEVICE_TYPE_PHONE, Constants::WINRT_DEVICE_TYPE_EMULATOR };
}
} // Internal
} // WinRt
......@@ -40,7 +40,7 @@ class WinRtPhoneQtVersion : public WinRtQtVersion
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtPhoneQtVersion();
WinRtPhoneQtVersion() = default;
WinRtPhoneQtVersion(const Utils::FileName &path, bool isAutodetected,
const QString &autodetectionSource);
......@@ -49,6 +49,7 @@ public:
QString type() const;
QString platformName() const;
QString platformDisplayName() const;
QSet<Core::Id> targetDeviceTypes() const;
};
} // Internal
......
......@@ -38,10 +38,6 @@
namespace WinRt {
namespace Internal {
WinRtQtVersion::WinRtQtVersion()
{
}
WinRtQtVersion::WinRtQtVersion(const Utils::FileName &path, bool isAutodetected,
const QString &autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource)
......@@ -89,5 +85,10 @@ QList<ProjectExplorer::Abi> WinRtQtVersion::detectQtAbis() const
return qtAbisFromLibrary(qtCorePaths(versionInfo(), qtVersionString()));
}
QSet<Core::Id> WinRtQtVersion::targetDeviceTypes() const
{
return { Constants::WINRT_DEVICE_TYPE_LOCAL, Constants::WINRT_DEVICE_TYPE_EMULATOR };
}
} // Internal
} // WinRt
......@@ -40,7 +40,7 @@ class WinRtQtVersion : public QtSupport::BaseQtVersion
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtQtVersion();
WinRtQtVersion() = default;
WinRtQtVersion(const Utils::FileName &path, bool isAutodetected,
const QString &autodetectionSource);
......@@ -51,6 +51,8 @@ public:
QString platformName() const;
QString platformDisplayName() const;
QList<ProjectExplorer::Abi> detectQtAbis() const;
QSet<Core::Id> targetDeviceTypes() const;
};
} // Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment