ProjectExplorer: Introduce an IDevice::usableAsBuildDevice

Better approach than whitelisting ids from leaf plugins.

Change-Id: Ida7e23d7ea02eb76d7de4049737f2cb0fad2b9d7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-09-30 12:38:51 +02:00
parent 4b1f1cb335
commit 5ff70b6f99
6 changed files with 15 additions and 4 deletions

View File

@@ -667,6 +667,11 @@ DeviceEnvironmentFetcher::Ptr DockerDevice::environmentFetcher() const
return DeviceEnvironmentFetcher::Ptr(); return DeviceEnvironmentFetcher::Ptr();
} }
bool DockerDevice::usableAsBuildDevice() const
{
return true;
}
FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
{ {
if (pathOnDevice.needsDevice()) { if (pathOnDevice.needsDevice()) {

View File

@@ -76,6 +76,7 @@ public:
ProjectExplorer::DeviceTester *createDeviceTester() const override; ProjectExplorer::DeviceTester *createDeviceTester() const override;
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override;
bool usableAsBuildDevice() const override;
Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override;
QString mapToDevicePath(const Utils::FilePath &globalPath) const override; QString mapToDevicePath(const Utils::FilePath &globalPath) const override;

View File

@@ -126,6 +126,11 @@ QUrl DesktopDevice::toolControlChannel(const ControlChannelHint &) const
return url; return url;
} }
bool DesktopDevice::usableAsBuildDevice() const
{
return true;
}
bool DesktopDevice::handlesFile(const FilePath &filePath) const bool DesktopDevice::handlesFile(const FilePath &filePath) const
{ {
return !filePath.needsDevice(); return !filePath.needsDevice();

View File

@@ -30,6 +30,7 @@ public:
DeviceProcessSignalOperation::Ptr signalOperation() const override; DeviceProcessSignalOperation::Ptr signalOperation() const override;
DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; DeviceEnvironmentFetcher::Ptr environmentFetcher() const override;
QUrl toolControlChannel(const ControlChannelHint &) const override; QUrl toolControlChannel(const ControlChannelHint &) const override;
bool usableAsBuildDevice() const override;
bool handlesFile(const Utils::FilePath &filePath) const override; bool handlesFile(const Utils::FilePath &filePath) const override;
Utils::Environment systemEnvironment() const override; Utils::Environment systemEnvironment() const override;

View File

@@ -137,6 +137,8 @@ public:
virtual bool isCompatibleWith(const Kit *k) const; virtual bool isCompatibleWith(const Kit *k) const;
virtual QList<Task> validate() const; virtual QList<Task> validate() const;
virtual bool usableAsBuildDevice() const { return false; }
QString displayType() const; QString displayType() const;
Utils::OsType osType() const; Utils::OsType osType() const;

View File

@@ -13,8 +13,6 @@
#include "toolchain.h" #include "toolchain.h"
#include "toolchainmanager.h" #include "toolchainmanager.h"
#include <docker/dockerconstants.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/elidinglabel.h> #include <utils/elidinglabel.h>
#include <utils/environment.h> #include <utils/environment.h>
@@ -1183,8 +1181,7 @@ private:
const DeviceManager *dm = DeviceManager::instance(); const DeviceManager *dm = DeviceManager::instance();
for (int i = 0; i < dm->deviceCount(); ++i) { for (int i = 0; i < dm->deviceCount(); ++i) {
IDevice::ConstPtr device = dm->deviceAt(i); IDevice::ConstPtr device = dm->deviceAt(i);
if (!(device->type() == Constants::DESKTOP_DEVICE_TYPE if (!device->usableAsBuildDevice())
|| device->type() == Docker::Constants::DOCKER_DEVICE_TYPE))
blackList.append(device->id()); blackList.append(device->id());
} }