diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-11-27 14:02:44 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-12-02 14:49:25 +0000 |
commit | d323d595b770e721ec69010b0a6bf9465b84e1ac (patch) | |
tree | cc782772dac080c8d3d0143ead74678d1027fe70 | |
parent | eebe44d3cfb62b94840b4845017bffb58ec601ae (diff) | |
download | qt-creator-d323d595b770e721ec69010b0a6bf9465b84e1ac.tar.gz |
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: Tim Jenssen <tim.jenssen@theqtcompany.com>
20 files changed, 92 insertions, 41 deletions
diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp index 9a7e3ced83..2303ddeb0b 100644 --- a/src/plugins/android/androidqtversion.cpp +++ b/src/plugins/android/androidqtversion.cpp @@ -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); diff --git a/src/plugins/android/androidqtversion.h b/src/plugins/android/androidqtversion.h index a5b1ab0acb..458a9adcf9 100644 --- a/src/plugins/android/androidqtversion.h +++ b/src/plugins/android/androidqtversion.h @@ -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; diff --git a/src/plugins/ios/iosqtversion.cpp b/src/plugins/ios/iosqtversion.cpp index bf064630d9..f78d304879 100644 --- a/src/plugins/ios/iosqtversion.cpp +++ b/src/plugins/ios/iosqtversion.cpp @@ -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); diff --git a/src/plugins/ios/iosqtversion.h b/src/plugins/ios/iosqtversion.h index a8d98e2bfb..f1ccff5f74 100644 --- a/src/plugins/ios/iosqtversion.h +++ b/src/plugins/ios/iosqtversion.h @@ -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; diff --git a/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp b/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp index 51dac846d6..c8cdf3d39f 100644 --- a/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp @@ -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 diff --git a/src/plugins/qnx/qnxqtversion.cpp b/src/plugins/qnx/qnxqtversion.cpp index 733251945b..1e7252803d 100644 --- a/src/plugins/qnx/qnxqtversion.cpp +++ b/src/plugins/qnx/qnxqtversion.cpp @@ -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); diff --git a/src/plugins/qnx/qnxqtversion.h b/src/plugins/qnx/qnxqtversion.h index d654d240f4..be2573bfbf 100644 --- a/src/plugins/qnx/qnxqtversion.h +++ b/src/plugins/qnx/qnxqtversion.h @@ -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; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 09522e3c57..1063711b84 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -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(); diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index e56d86b4ff..245ae75111 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -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; diff --git a/src/plugins/qtsupport/desktopqtversion.cpp b/src/plugins/qtsupport/desktopqtversion.cpp index b71bb709b8..5764777efa 100644 --- a/src/plugins/qtsupport/desktopqtversion.cpp +++ b/src/plugins/qtsupport/desktopqtversion.cpp @@ -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); diff --git a/src/plugins/qtsupport/desktopqtversion.h b/src/plugins/qtsupport/desktopqtversion.h index ff1a5c59f4..5141a7931e 100644 --- a/src/plugins/qtsupport/desktopqtversion.h +++ b/src/plugins/qtsupport/desktopqtversion.h @@ -52,6 +52,7 @@ public: QString description() const; QSet<Core::Id> availableFeatures() const; + QSet<Core::Id> targetDeviceTypes() const; QString platformName() const; QString platformDisplayName() const; }; diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 94aa930d15..b43a336e12 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -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); } diff --git a/src/plugins/qtsupport/winceqtversion.cpp b/src/plugins/qtsupport/winceqtversion.cpp index 55fc81c839..8fd0e0a7e6 100644 --- a/src/plugins/qtsupport/winceqtversion.cpp +++ b/src/plugins/qtsupport/winceqtversion.cpp @@ -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>(); +} diff --git a/src/plugins/qtsupport/winceqtversion.h b/src/plugins/qtsupport/winceqtversion.h index 8a9a3ca07f..df7e5710d8 100644 --- a/src/plugins/qtsupport/winceqtversion.h +++ b/src/plugins/qtsupport/winceqtversion.h @@ -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 diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp index beacbd8f12..510c015539 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp @@ -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); diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.h b/src/plugins/remotelinux/embeddedlinuxqtversion.h index 89cac2ac4f..c1975f6c15 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.h +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.h @@ -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; }; diff --git a/src/plugins/winrt/winrtphoneqtversion.cpp b/src/plugins/winrt/winrtphoneqtversion.cpp index 694d12df2d..6754a50dfc 100644 --- a/src/plugins/winrt/winrtphoneqtversion.cpp +++ b/src/plugins/winrt/winrtphoneqtversion.cpp @@ -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 diff --git a/src/plugins/winrt/winrtphoneqtversion.h b/src/plugins/winrt/winrtphoneqtversion.h index cc0841e3cc..0a58e6a7a3 100644 --- a/src/plugins/winrt/winrtphoneqtversion.h +++ b/src/plugins/winrt/winrtphoneqtversion.h @@ -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 diff --git a/src/plugins/winrt/winrtqtversion.cpp b/src/plugins/winrt/winrtqtversion.cpp index d899da3bff..d3280c7f66 100644 --- a/src/plugins/winrt/winrtqtversion.cpp +++ b/src/plugins/winrt/winrtqtversion.cpp @@ -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 diff --git a/src/plugins/winrt/winrtqtversion.h b/src/plugins/winrt/winrtqtversion.h index 6036d16e0f..639e59635a 100644 --- a/src/plugins/winrt/winrtqtversion.h +++ b/src/plugins/winrt/winrtqtversion.h @@ -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 |