forked from qt-creator/qt-creator
Use new DeployConfigurationFactory::addInitialStep in some cases
Less code, less classes. Change-Id: I3ba9920f4f389e14c67cd8c5d937a4b4659865e7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -43,21 +43,14 @@ using namespace ProjectExplorer;
|
|||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, Core::Id id)
|
|
||||||
: DeployConfiguration(parent, id)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void AndroidDeployConfiguration::initialize()
|
|
||||||
{
|
|
||||||
stepList()->appendStep(new AndroidDeployQtStep(stepList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory()
|
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory()
|
||||||
{
|
{
|
||||||
registerDeployConfiguration<AndroidDeployConfiguration>
|
registerDeployConfiguration<DeployConfiguration>
|
||||||
("Qt4ProjectManager.AndroidDeployConfiguration2");
|
("Qt4ProjectManager.AndroidDeployConfiguration2");
|
||||||
addSupportedTargetDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
addSupportedTargetDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||||
setDefaultDisplayName(AndroidDeployConfiguration::tr("Deploy to Android device"));
|
setDefaultDisplayName(QCoreApplication::translate("Android::Internal",
|
||||||
|
"Deploy to Android device"));
|
||||||
|
addInitialStep(AndroidDeployQtStep::stepId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
|
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
|
||||||
|
|||||||
@@ -30,15 +30,6 @@
|
|||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AndroidDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AndroidDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
|
||||||
void initialize() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ const QLatin1String InstallFailedInconsistentCertificatesString("INSTALL_PARSE_F
|
|||||||
const QLatin1String InstallFailedUpdateIncompatible("INSTALL_FAILED_UPDATE_INCOMPATIBLE");
|
const QLatin1String InstallFailedUpdateIncompatible("INSTALL_FAILED_UPDATE_INCOMPATIBLE");
|
||||||
const QLatin1String InstallFailedPermissionModelDowngrade("INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE");
|
const QLatin1String InstallFailedPermissionModelDowngrade("INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE");
|
||||||
const QLatin1String InstallFailedVersionDowngrade("INSTALL_FAILED_VERSION_DOWNGRADE");
|
const QLatin1String InstallFailedVersionDowngrade("INSTALL_FAILED_VERSION_DOWNGRADE");
|
||||||
const Core::Id AndroidDeployQtStep::Id("Qt4ProjectManager.AndroidDeployQtStep");
|
|
||||||
static const char *qmlProjectRunConfigIdName = "QmlProjectManager.QmlRunConfiguration";
|
static const char *qmlProjectRunConfigIdName = "QmlProjectManager.QmlRunConfiguration";
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ static const char *qmlProjectRunConfigIdName = "QmlProjectManager.QmlRunConfigur
|
|||||||
|
|
||||||
AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
|
AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
|
||||||
{
|
{
|
||||||
registerStep<AndroidDeployQtStep>(AndroidDeployQtStep::Id);
|
registerStep<AndroidDeployQtStep>(AndroidDeployQtStep::stepId());
|
||||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||||
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||||
setRepeatable(false);
|
setRepeatable(false);
|
||||||
@@ -90,7 +89,7 @@ AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
|
|||||||
// AndroidDeployQtStep
|
// AndroidDeployQtStep
|
||||||
|
|
||||||
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
||||||
: ProjectExplorer::BuildStep(parent, Id)
|
: ProjectExplorer::BuildStep(parent, stepId())
|
||||||
{
|
{
|
||||||
setImmutable(true);
|
setImmutable(true);
|
||||||
m_uninstallPreviousPackage = QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
|
m_uninstallPreviousPackage = QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
|
||||||
@@ -106,6 +105,11 @@ AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
|||||||
this, &AndroidDeployQtStep::slotSetSerialNumber);
|
this, &AndroidDeployQtStep::slotSetSerialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id AndroidDeployQtStep::stepId()
|
||||||
|
{
|
||||||
|
return "Qt4ProjectManager.AndroidDeployQtStep";
|
||||||
|
}
|
||||||
|
|
||||||
bool AndroidDeployQtStep::init()
|
bool AndroidDeployQtStep::init()
|
||||||
{
|
{
|
||||||
m_androiddeployqtArgs.clear();
|
m_androiddeployqtArgs.clear();
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
explicit AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc);
|
explicit AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc);
|
||||||
|
|
||||||
|
static Core::Id stepId();
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -37,23 +37,14 @@ using namespace ProjectExplorer;
|
|||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent, Core::Id id)
|
|
||||||
: DeployConfiguration(parent, id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosDeployConfiguration::initialize()
|
|
||||||
{
|
|
||||||
stepList()->appendStep(new IosDeployStep(stepList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
IosDeployConfigurationFactory::IosDeployConfigurationFactory()
|
IosDeployConfigurationFactory::IosDeployConfigurationFactory()
|
||||||
{
|
{
|
||||||
registerDeployConfiguration<IosDeployConfiguration>("Qt4ProjectManager.IosDeployConfiguration");
|
registerDeployConfiguration<DeployConfiguration>("Qt4ProjectManager.IosDeployConfiguration");
|
||||||
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||||
addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE);
|
addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE);
|
||||||
addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE);
|
addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE);
|
||||||
setDefaultDisplayName(IosDeployConfiguration::tr("Deploy on iOS"));
|
setDefaultDisplayName(QCoreApplication::translate("Ios::Internal", "Deploy on iOS"));
|
||||||
|
addInitialStep(IosDeployStep::stepId());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -30,15 +30,6 @@
|
|||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class IosDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
IosDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
|
||||||
void initialize() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -54,10 +54,8 @@ using namespace ProjectExplorer;
|
|||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const Core::Id IosDeployStep::Id("Qt4ProjectManager.IosDeployStep");
|
|
||||||
|
|
||||||
IosDeployStep::IosDeployStep(BuildStepList *parent)
|
IosDeployStep::IosDeployStep(BuildStepList *parent)
|
||||||
: BuildStep(parent, Id)
|
: BuildStep(parent, stepId())
|
||||||
{
|
{
|
||||||
setImmutable(true);
|
setImmutable(true);
|
||||||
setRunInGuiThread(true);
|
setRunInGuiThread(true);
|
||||||
@@ -68,6 +66,11 @@ IosDeployStep::IosDeployStep(BuildStepList *parent)
|
|||||||
this, &IosDeployStep::updateDisplayNames);
|
this, &IosDeployStep::updateDisplayNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id IosDeployStep::stepId()
|
||||||
|
{
|
||||||
|
return "Qt4ProjectManager.IosDeployStep";
|
||||||
|
}
|
||||||
|
|
||||||
void IosDeployStep::updateDisplayNames()
|
void IosDeployStep::updateDisplayNames()
|
||||||
{
|
{
|
||||||
IDevice::ConstPtr dev =
|
IDevice::ConstPtr dev =
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
|
|
||||||
friend class IosDeployStepFactory;
|
friend class IosDeployStepFactory;
|
||||||
explicit IosDeployStep(ProjectExplorer::BuildStepList *bc);
|
explicit IosDeployStep(ProjectExplorer::BuildStepList *bc);
|
||||||
|
static Core::Id stepId();
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Internal {
|
|||||||
|
|
||||||
IosDeployStepFactory::IosDeployStepFactory()
|
IosDeployStepFactory::IosDeployStepFactory()
|
||||||
{
|
{
|
||||||
registerStep<IosDeployStep>(IosDeployStep::Id);
|
registerStep<IosDeployStep>(IosDeployStep::stepId());
|
||||||
setDisplayName(IosDeployStep::tr("Deploy to iOS device or emulator"));
|
setDisplayName(IosDeployStep::tr("Deploy to iOS device or emulator"));
|
||||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||||
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
|
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
|
||||||
|
|||||||
@@ -50,18 +50,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(Target *target, C
|
|||||||
: DeployConfiguration(target, id)
|
: DeployConfiguration(target, id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void RemoteLinuxDeployConfiguration::initialize()
|
|
||||||
{
|
|
||||||
stepList()->appendStep(new RemoteLinuxCheckForFreeDiskSpaceStep(stepList()));
|
|
||||||
stepList()->appendStep(new RemoteLinuxKillAppStep(stepList()));
|
|
||||||
const LinuxDevice::ConstPtr device = DeviceKitInformation::device(target()->kit())
|
|
||||||
.staticCast<const LinuxDevice>();
|
|
||||||
if (device && device->supportsRSync())
|
|
||||||
stepList()->appendStep(new RsyncDeployStep(stepList()));
|
|
||||||
else
|
|
||||||
stepList()->appendStep(new GenericDirectUploadStep(stepList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget()
|
NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new DeploymentDataView(target());
|
return new DeploymentDataView(target());
|
||||||
@@ -81,6 +69,17 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory()
|
|||||||
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||||
setDefaultDisplayName(QCoreApplication::translate("RemoteLinux",
|
setDefaultDisplayName(QCoreApplication::translate("RemoteLinux",
|
||||||
"Deploy to Remote Linux Host"));
|
"Deploy to Remote Linux Host"));
|
||||||
|
|
||||||
|
addInitialStep(RemoteLinuxCheckForFreeDiskSpaceStep::stepId());
|
||||||
|
addInitialStep(RemoteLinuxKillAppStep::stepId());
|
||||||
|
addInitialStep(RsyncDeployStep::stepId(), [](Target *target) {
|
||||||
|
auto device = DeviceKitInformation::device(target->kit()).staticCast<const LinuxDevice>();
|
||||||
|
return device && device->supportsRSync();
|
||||||
|
});
|
||||||
|
addInitialStep(GenericDirectUploadStep::stepId(), [](Target *target) {
|
||||||
|
auto device = DeviceKitInformation::device(target->kit()).staticCast<const LinuxDevice>();
|
||||||
|
return device && !device->supportsRSync();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ public:
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
Reference in New Issue
Block a user