ProjectExplorer: Use run device as fallback for build device

This is not necessarily a permanent solution, but does something
sensible and suppresses warnings about non-existent build devices.

Alternatives would be to always enforce the existence of a build
device (fallback to "Desktop") as done for the run device, or
enforce a build device only and consider "no run device" as
"same as build device.

Change-Id: Ib84670c63a6c416524ab4740419ede6b99981c43
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-05-12 12:21:04 +02:00
parent 492f13578e
commit cb39e2404c

View File

@@ -1301,7 +1301,12 @@ Utils::Id BuildDeviceKitAspect::id()
IDevice::ConstPtr BuildDeviceKitAspect::device(const Kit *k)
{
QTC_ASSERT(DeviceManager::instance()->isLoaded(), return IDevice::ConstPtr());
return DeviceManager::instance()->find(deviceId(k));
IDevice::ConstPtr dev = DeviceManager::instance()->find(deviceId(k));
// Use the "run" device as fallback if no build device is present.
// FIXME: Think about whether this shouldn't be the other way round.
if (!dev)
dev = DeviceKitAspect::device(k);
return dev;
}
Utils::Id BuildDeviceKitAspect::deviceId(const Kit *k)