Boot2Qt: Inline QdbDeployConfigurationFactory

Change-Id: I8257126a2ed53adca5b04e04a2182381afa7390c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-08-18 12:52:00 +02:00
parent c8d29522d7
commit 1ed27cc2eb
5 changed files with 46 additions and 82 deletions

View File

@@ -6,7 +6,6 @@ add_qtc_plugin(Boot2Qt
qdb.qrc
qdb_global.h
qdbconstants.h
qdbdeployconfigurationfactory.cpp qdbdeployconfigurationfactory.h
qdbdevice.cpp qdbdevice.h
qdbdevicedebugsupport.cpp qdbdevicedebugsupport.h
qdbmakedefaultappstep.cpp qdbmakedefaultappstep.h

View File

@@ -21,8 +21,6 @@ QtcPlugin {
"qdbutils.h",
"qdbconstants.h",
"qdb_global.h",
"qdbdeployconfigurationfactory.cpp",
"qdbdeployconfigurationfactory.h",
"qdbdevice.cpp",
"qdbdevice.h",
"qdbdevicedebugsupport.cpp",

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdbdeployconfigurationfactory.h"
#include "qdbconstants.h"
#include "qdbtr.h"
#include <projectexplorer/deploymentdataview.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <remotelinux/remotelinux_constants.h>
using namespace ProjectExplorer;
namespace Qdb::Internal {
QdbDeployConfigurationFactory::QdbDeployConfigurationFactory()
{
setConfigBaseId(Constants::QdbDeployConfigurationId);
addSupportedTargetDeviceType(Constants::QdbLinuxOsType);
setDefaultDisplayName(Tr::tr("Deploy to Boot2Qt target"));
setUseDeploymentDataView();
addInitialStep(RemoteLinux::Constants::MakeInstallStepId, [](Target *target) {
const Project * const prj = target->project();
return prj->deploymentKnowledge() == DeploymentKnowledge::Bad
&& prj->hasMakeInstallEquivalent();
});
addInitialStep(Qdb::Constants::QdbStopApplicationStepId);
addInitialStep(RemoteLinux::Constants::RsyncDeployStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return false;
return !device
|| (device && device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool());
});
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return false;
return device && !device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool();
});
// This step is for:
// a) A remote build device, as they do not support real rsync yet.
// b) If there is no target device setup yet.
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return true;
return false;
});
}
} // Qdb::Internal

View File

@@ -1,16 +0,0 @@
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <projectexplorer/deployconfiguration.h>
namespace Qdb::Internal {
class QdbDeployConfigurationFactory final : public ProjectExplorer::DeployConfigurationFactory
{
public:
QdbDeployConfigurationFactory();
};
} // Qdb::Internal

View File

@@ -5,7 +5,6 @@
#include "device-detection/devicedetector.h"
#include "qdbconstants.h"
#include "qdbdeployconfigurationfactory.h"
#include "qdbdevice.h"
#include "qdbstopapplicationstep.h"
#include "qdbmakedefaultappstep.h"
@@ -19,9 +18,11 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/icore.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
@@ -107,6 +108,50 @@ public:
}
};
class QdbDeployConfigurationFactory final : public DeployConfigurationFactory
{
public:
QdbDeployConfigurationFactory()
{
setConfigBaseId(Constants::QdbDeployConfigurationId);
addSupportedTargetDeviceType(Constants::QdbLinuxOsType);
setDefaultDisplayName(Tr::tr("Deploy to Boot2Qt target"));
setUseDeploymentDataView();
addInitialStep(RemoteLinux::Constants::MakeInstallStepId, [](Target *target) {
const Project * const prj = target->project();
return prj->deploymentKnowledge() == DeploymentKnowledge::Bad
&& prj->hasMakeInstallEquivalent();
});
addInitialStep(Qdb::Constants::QdbStopApplicationStepId);
addInitialStep(RemoteLinux::Constants::RsyncDeployStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return false;
return !device || (device
&& device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool());
});
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return false;
return device && !device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool();
});
// This step is for:
// a) A remote build device, as they do not support real rsync yet.
// b) If there is no target device setup yet.
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
auto device = DeviceKitAspect::device(target->kit());
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
if (buildDevice && buildDevice->rootPath().needsDevice())
return true;
return false;
});
}
};
class QdbPluginPrivate : public QObject
{
public: