forked from qt-creator/qt-creator
ProjectExplorer: Allow devices to report tasks in validate
And use it to report a hard error when docker devices don't have a shared directory set. While this is possibly too harsh in the long run it fits the current situation where we want to use the container for building projects. Change-Id: I1430716b5722fba537bb964463ce25c7001be6a4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -473,6 +473,18 @@ IDeviceWidget *DockerDevice::createWidget()
|
|||||||
return new DockerDeviceWidget(sharedFromThis());
|
return new DockerDeviceWidget(sharedFromThis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tasks DockerDevice::validate() const
|
||||||
|
{
|
||||||
|
Tasks result;
|
||||||
|
if (d->m_data.mounts.isEmpty()) {
|
||||||
|
result << Task(Task::Error,
|
||||||
|
tr("The Docker device has not set up shared directories."
|
||||||
|
"This will not work for building."),
|
||||||
|
{}, -1, {});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// DockerDevice
|
// DockerDevice
|
||||||
|
|
||||||
|
@@ -62,6 +62,7 @@ public:
|
|||||||
static Ptr create(const DockerDeviceData &data) { return Ptr(new DockerDevice(data)); }
|
static Ptr create(const DockerDeviceData &data) { return Ptr(new DockerDevice(data)); }
|
||||||
|
|
||||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||||
|
QVector<ProjectExplorer::Task> validate() const override;
|
||||||
|
|
||||||
bool canCreateProcess() const override { return true; }
|
bool canCreateProcess() const override { return true; }
|
||||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
||||||
|
@@ -532,6 +532,11 @@ bool IDevice::isCompatibleWith(const Kit *k) const
|
|||||||
return DeviceTypeKitAspect::deviceTypeId(k) == type();
|
return DeviceTypeKitAspect::deviceTypeId(k) == type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<Task> IDevice::validate() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
void IDevice::addDeviceAction(const DeviceAction &deviceAction)
|
void IDevice::addDeviceAction(const DeviceAction &deviceAction)
|
||||||
{
|
{
|
||||||
d->deviceActions.append(deviceAction);
|
d->deviceActions.append(deviceAction);
|
||||||
|
@@ -65,6 +65,7 @@ class DeviceProcess;
|
|||||||
class DeviceProcessList;
|
class DeviceProcessList;
|
||||||
class Kit;
|
class Kit;
|
||||||
class Runnable;
|
class Runnable;
|
||||||
|
class Task;
|
||||||
|
|
||||||
namespace Internal { class IDevicePrivate; }
|
namespace Internal { class IDevicePrivate; }
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ public:
|
|||||||
Utils::Id id() const;
|
Utils::Id id() const;
|
||||||
|
|
||||||
virtual bool isCompatibleWith(const Kit *k) const;
|
virtual bool isCompatibleWith(const Kit *k) const;
|
||||||
|
virtual QVector<Task> validate() const;
|
||||||
|
|
||||||
QString displayType() const;
|
QString displayType() const;
|
||||||
Utils::OsType osType() const;
|
Utils::OsType osType() const;
|
||||||
|
@@ -1005,6 +1005,9 @@ Tasks DeviceKitAspect::validate(const Kit *k) const
|
|||||||
else if (!dev->isCompatibleWith(k))
|
else if (!dev->isCompatibleWith(k))
|
||||||
result.append(BuildSystemTask(Task::Error, tr("Device is incompatible with this kit.")));
|
result.append(BuildSystemTask(Task::Error, tr("Device is incompatible with this kit.")));
|
||||||
|
|
||||||
|
if (dev)
|
||||||
|
result.append(dev->validate());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user