RemoteLinux: Use a RemoteLinux.SupportsRSync key

... into the Device::extraData map instead of dedicated accessors.

This weakens the compile time dependencies of the RSyncBuildStep,
LinuxDevice, and GenericLinuxDeviceTester at the price of weaker,
local typesafety for one bool value.

Potentially this could go into the direction of re-using bits
of "device feature" discovery and use. Nothing planned, though.

Change-Id: I9aa6dce8066b82d344f64f38707f17416e273957
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-01-21 13:36:50 +01:00
parent ec79f42701
commit ed9f4be3ee
5 changed files with 7 additions and 20 deletions

View File

@@ -280,16 +280,6 @@ DeviceEnvironmentFetcher::Ptr LinuxDevice::environmentFetcher() const
return DeviceEnvironmentFetcher::Ptr(new LinuxDeviceEnvironmentFetcher(sharedFromThis()));
}
void LinuxDevice::setSupportsRsync(bool supportsRsync)
{
setExtraData("RemoteLinux.SupportsRSync", supportsRsync);
}
bool LinuxDevice::supportsRSync() const
{
return extraData("RemoteLinux.SupportsRSync").toBool();
}
namespace Internal {
// Factory

View File

@@ -55,9 +55,6 @@ public:
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override;
void setSupportsRsync(bool supportsRsync);
bool supportsRSync() const;
protected:
LinuxDevice();
};

View File

@@ -25,7 +25,7 @@
#include "linuxdevicetester.h"
#include "linuxdevice.h"
#include "remotelinux_constants.h"
#include "rsyncdeploystep.h"
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
@@ -261,7 +261,7 @@ void GenericLinuxDeviceTester::handleRsyncFinished()
emit progressMessage(tr("rsync is functional.\n"));
}
d->deviceConfiguration.staticCast<LinuxDevice>()->setSupportsRsync(error.isEmpty());
d->deviceConfiguration->setExtraData(Constants::SupportsRSync, error.isEmpty());
setFinished(result);
}

View File

@@ -33,6 +33,7 @@ const char GenericLinuxOsType[] = "GenericLinuxOsType";
const char CheckForFreeDiskSpaceId[] = "RemoteLinux.CheckForFreeDiskSpaceStep";
const char DirectUploadStepId[] = "RemoteLinux.DirectUploadStep";
const char MakeInstallStepId[] = "RemoteLinux.MakeInstall";
const char SupportsRSync[] = "RemoteLinux.SupportsRSync";
} // Constants
} // RemoteLinux

View File

@@ -26,7 +26,6 @@
#include "remotelinuxdeployconfiguration.h"
#include "genericdirectuploadstep.h"
#include "linuxdevice.h"
#include "makeinstallstep.h"
#include "remotelinuxcheckforfreediskspacestep.h"
#include "remotelinuxkillappstep.h"
@@ -79,12 +78,12 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory()
addInitialStep(RemoteLinuxCheckForFreeDiskSpaceStep::stepId());
addInitialStep(RemoteLinuxKillAppStep::stepId());
addInitialStep(RsyncDeployStep::stepId(), [](Target *target) {
auto device = DeviceKitAspect::device(target->kit()).staticCast<const LinuxDevice>();
return device && device->supportsRSync();
auto device = DeviceKitAspect::device(target->kit());
return device && device->extraData(Constants::SupportsRSync).toBool();
});
addInitialStep(GenericDirectUploadStep::stepId(), [](Target *target) {
auto device = DeviceKitAspect::device(target->kit()).staticCast<const LinuxDevice>();
return device && !device->supportsRSync();
auto device = DeviceKitAspect::device(target->kit());
return device && !device->extraData(Constants::SupportsRSync).toBool();
});
}