diff options
Diffstat (limited to 'src/plugins/remotelinux')
55 files changed, 637 insertions, 592 deletions
diff --git a/src/plugins/remotelinux/CMakeLists.txt b/src/plugins/remotelinux/CMakeLists.txt new file mode 100644 index 0000000000..63c97b1686 --- /dev/null +++ b/src/plugins/remotelinux/CMakeLists.txt @@ -0,0 +1,49 @@ +add_qtc_plugin(RemoteLinux + DEPENDS QmlDebug QtcSsh + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport + SOURCES + abstractpackagingstep.cpp abstractpackagingstep.h + abstractremotelinuxdeployservice.cpp abstractremotelinuxdeployservice.h + abstractremotelinuxdeploystep.cpp abstractremotelinuxdeploystep.h + abstractuploadandinstallpackageservice.cpp abstractuploadandinstallpackageservice.h + deploymenttimeinfo.cpp deploymenttimeinfo.h + embeddedlinuxqtversion.cpp embeddedlinuxqtversion.h + genericdirectuploadservice.cpp genericdirectuploadservice.h + genericdirectuploadstep.cpp genericdirectuploadstep.h + genericlinuxdeviceconfigurationwidget.cpp genericlinuxdeviceconfigurationwidget.h genericlinuxdeviceconfigurationwidget.ui + genericlinuxdeviceconfigurationwizard.cpp genericlinuxdeviceconfigurationwizard.h + genericlinuxdeviceconfigurationwizardpages.cpp genericlinuxdeviceconfigurationwizardpages.h + genericlinuxdeviceconfigurationwizardsetuppage.ui + linuxdevice.cpp linuxdevice.h + linuxdeviceprocess.cpp linuxdeviceprocess.h + linuxdevicetester.cpp linuxdevicetester.h + makeinstallstep.cpp makeinstallstep.h + packageuploader.cpp packageuploader.h + publickeydeploymentdialog.cpp publickeydeploymentdialog.h + remotelinux.qrc + remotelinux_constants.h + remotelinux_export.h + remotelinuxcheckforfreediskspaceservice.cpp remotelinuxcheckforfreediskspaceservice.h + remotelinuxcheckforfreediskspacestep.cpp remotelinuxcheckforfreediskspacestep.h + remotelinuxcustomcommanddeploymentstep.cpp remotelinuxcustomcommanddeploymentstep.h + remotelinuxcustomcommanddeployservice.cpp remotelinuxcustomcommanddeployservice.h + remotelinuxcustomrunconfiguration.cpp remotelinuxcustomrunconfiguration.h + remotelinuxdebugsupport.cpp remotelinuxdebugsupport.h + remotelinuxdeployconfiguration.cpp remotelinuxdeployconfiguration.h + remotelinuxenvironmentaspect.cpp remotelinuxenvironmentaspect.h + remotelinuxenvironmentaspectwidget.cpp remotelinuxenvironmentaspectwidget.h + remotelinuxenvironmentreader.cpp remotelinuxenvironmentreader.h + remotelinuxkillappservice.cpp remotelinuxkillappservice.h + remotelinuxkillappstep.cpp remotelinuxkillappstep.h + remotelinuxpackageinstaller.cpp remotelinuxpackageinstaller.h + remotelinuxplugin.cpp remotelinuxplugin.h + remotelinuxqmltoolingsupport.cpp remotelinuxqmltoolingsupport.h + remotelinuxrunconfiguration.cpp remotelinuxrunconfiguration.h + remotelinuxsignaloperation.cpp remotelinuxsignaloperation.h + remotelinuxx11forwardingaspect.cpp remotelinuxx11forwardingaspect.h + rsyncdeploystep.cpp rsyncdeploystep.h + sshkeydeployer.cpp sshkeydeployer.h + tarpackagecreationstep.cpp tarpackagecreationstep.h + typespecificdeviceconfigurationlistmodel.cpp typespecificdeviceconfigurationlistmodel.h + uploadandinstalltarpackagestep.cpp uploadandinstalltarpackagestep.h +) diff --git a/src/plugins/remotelinux/abstractpackagingstep.cpp b/src/plugins/remotelinux/abstractpackagingstep.cpp index 75a6fe2fa7..c328837628 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.cpp +++ b/src/plugins/remotelinux/abstractpackagingstep.cpp @@ -114,10 +114,8 @@ bool AbstractPackagingStep::isPackagingNeeded() const const DeploymentData &dd = target()->deploymentData(); for (int i = 0; i < dd.fileCount(); ++i) { - if (Utils::FileUtils::isFileNewerThan(dd.fileAt(i).localFilePath(), - packageInfo.lastModified())) { + if (dd.fileAt(i).localFilePath().isNewerThan(packageInfo.lastModified())) return true; - } } return false; @@ -154,7 +152,7 @@ void AbstractPackagingStep::setDeploymentDataModified() void AbstractPackagingStep::raiseError(const QString &errorMessage) { - Task task = Task(Task::Error, errorMessage, Utils::FileName(), -1, + Task task = Task(Task::Error, errorMessage, Utils::FilePath(), -1, Constants::TASK_CATEGORY_DEPLOYMENT); emit addTask(task); emit addOutput(errorMessage, BuildStep::OutputFormat::Stderr); @@ -162,7 +160,7 @@ void AbstractPackagingStep::raiseError(const QString &errorMessage) void AbstractPackagingStep::raiseWarning(const QString &warningMessage) { - Task task = Task(Task::Warning, warningMessage, Utils::FileName(), -1, + Task task = Task(Task::Warning, warningMessage, Utils::FilePath(), -1, Constants::TASK_CATEGORY_DEPLOYMENT); emit addTask(task); emit addOutput(warningMessage, OutputFormat::ErrorMessage); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index c5f60d3e29..c6d184ec12 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -114,7 +114,7 @@ bool AbstractRemoteLinuxDeployService::hasRemoteFileChanged( void AbstractRemoteLinuxDeployService::setTarget(Target *target) { d->target = target; - d->deviceConfiguration = DeviceKitInformation::device(profile()); + d->deviceConfiguration = DeviceKitAspect::device(profile()); } void AbstractRemoteLinuxDeployService::setDevice(const IDevice::ConstPtr &device) @@ -126,9 +126,9 @@ void AbstractRemoteLinuxDeployService::start() { QTC_ASSERT(d->state == Inactive, return); - QString errorMsg; - if (!isDeploymentPossible(&errorMsg)) { - emit errorMessage(errorMsg); + const CheckResult check = isDeploymentPossible(); + if (!check) { + emit errorMessage(check.errorMessage()); emit finished(); return; } @@ -165,14 +165,11 @@ void AbstractRemoteLinuxDeployService::stop() } } -bool AbstractRemoteLinuxDeployService::isDeploymentPossible(QString *whyNot) const +CheckResult AbstractRemoteLinuxDeployService::isDeploymentPossible() const { - if (!deviceConfiguration()) { - if (whyNot) - *whyNot = tr("No device configuration set."); - return false; - } - return true; + if (!deviceConfiguration()) + return CheckResult::failure(tr("No device configuration set.")); + return CheckResult::success(); } QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h index 9e55708d65..6ebf2d7592 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h @@ -43,6 +43,22 @@ class Target; namespace RemoteLinux { namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; } +class REMOTELINUX_EXPORT CheckResult +{ +public: + static CheckResult success() { return {true, {}}; } + static CheckResult failure(const QString &error = {}) { return {false, error}; } + + operator bool() const { return m_ok; } + QString errorMessage() const { return m_error; } + +private: + CheckResult(bool ok, const QString &error) : m_ok(ok), m_error(error) {} + + bool m_ok = false; + QString m_error; +}; + class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject { Q_OBJECT @@ -60,7 +76,7 @@ public: QVariantMap exportDeployTimes() const; void importDeployTimes(const QVariantMap &map); - virtual bool isDeploymentPossible(QString *whyNot = nullptr) const; + virtual CheckResult isDeploymentPossible() const; signals: void errorMessage(const QString &message); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index 5827c4fa94..45e34bda29 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -69,11 +69,12 @@ QVariantMap AbstractRemoteLinuxDeployStep::toMap() const bool AbstractRemoteLinuxDeployStep::init() { - QString error; deployService()->setTarget(target()); - const bool canDeploy = initInternal(&error); - if (!canDeploy) - emit addOutput(tr("Cannot deploy: %1").arg(error), OutputFormat::ErrorMessage); + const CheckResult canDeploy = initInternal(); + if (!canDeploy) { + emit addOutput(tr("Cannot deploy: %1").arg(canDeploy.errorMessage()), + OutputFormat::ErrorMessage); + } return canDeploy; } @@ -114,7 +115,7 @@ void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message void AbstractRemoteLinuxDeployStep::handleErrorMessage(const QString &message) { - ProjectExplorer::Task task = Task(Task::Error, message, Utils::FileName(), -1, + ProjectExplorer::Task task = Task(Task::Error, message, Utils::FilePath(), -1, Constants::TASK_CATEGORY_DEPLOYMENT); emit addTask(task, 1); // TODO correct? emit addOutput(message, OutputFormat::ErrorMessage); @@ -123,7 +124,7 @@ void AbstractRemoteLinuxDeployStep::handleErrorMessage(const QString &message) void AbstractRemoteLinuxDeployStep::handleWarningMessage(const QString &message) { - ProjectExplorer::Task task = Task(Task::Warning, message, Utils::FileName(), -1, + ProjectExplorer::Task task = Task(Task::Warning, message, Utils::FilePath(), -1, Constants::TASK_CATEGORY_DEPLOYMENT); emit addTask(task, 1); // TODO correct? emit addOutput(message, OutputFormat::ErrorMessage); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h index 03741d3367..e8fac039b7 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h @@ -27,12 +27,11 @@ #include "remotelinux_export.h" -#include <projectexplorer/buildstep.h> +#include "abstractremotelinuxdeployservice.h" -#include <QVariantMap> +#include <projectexplorer/buildstep.h> namespace RemoteLinux { -class AbstractRemoteLinuxDeployService; namespace Internal { class AbstractRemoteLinuxDeployStepPrivate; } @@ -52,7 +51,7 @@ protected: void doCancel() override; explicit AbstractRemoteLinuxDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); - virtual bool initInternal(QString *error = nullptr) = 0; + virtual CheckResult initInternal() = 0; private: void handleProgressMessage(const QString &message); diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp index ee79ba4ec8..18ac23f496 100644 --- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp +++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp @@ -110,7 +110,7 @@ void AbstractUploadAndInstallPackageService::doDeploy() QTC_ASSERT(d->state == Inactive, return); d->state = Uploading; - const QString fileName = Utils::FileName::fromString(packageFilePath()).fileName(); + const QString fileName = Utils::FilePath::fromString(packageFilePath()).fileName(); const QString remoteFilePath = uploadDir() + QLatin1Char('/') + fileName; connect(d->uploader, &PackageUploader::progress, this, &AbstractUploadAndInstallPackageService::progressMessage); @@ -148,7 +148,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString emit progressMessage(tr("Successfully uploaded package file.")); const QString remoteFilePath = uploadDir() + QLatin1Char('/') - + Utils::FileName::fromString(packageFilePath()).fileName(); + + Utils::FilePath::fromString(packageFilePath()).fileName(); d->state = Installing; emit progressMessage(tr("Installing package to device...")); connect(packageInstaller(), &AbstractRemoteLinuxPackageInstaller::stdoutData, diff --git a/src/plugins/remotelinux/deploymenttimeinfo.cpp b/src/plugins/remotelinux/deploymenttimeinfo.cpp index d3b9dcee61..e43dd75ca7 100644 --- a/src/plugins/remotelinux/deploymenttimeinfo.cpp +++ b/src/plugins/remotelinux/deploymenttimeinfo.cpp @@ -88,8 +88,8 @@ public: QString host; if (kit) { - systemRoot = SysRootKitInformation::sysRoot(kit).toString(); - const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit); + systemRoot = SysRootKitAspect::sysRoot(kit).toString(); + const IDevice::ConstPtr deviceConfiguration = DeviceKitAspect::device(kit); host = deviceConfiguration->sshParameters().host(); } diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp index 1aad59919c..e315cf066a 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp @@ -35,36 +35,34 @@ namespace RemoteLinux { namespace Internal { -EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected, - const QString &autodetectionSource) - : BaseQtVersion(path, isAutodetected, autodetectionSource) +QString EmbeddedLinuxQtVersion::description() const { - setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false)); + return QCoreApplication::translate("QtVersion", "Embedded Linux", "Qt Version is used for embedded Linux development"); } -EmbeddedLinuxQtVersion *EmbeddedLinuxQtVersion::clone() const +QSet<Core::Id> EmbeddedLinuxQtVersion::targetDeviceTypes() const { - return new EmbeddedLinuxQtVersion(*this); + return {Constants::GenericLinuxOsType}; } -QString EmbeddedLinuxQtVersion::type() const -{ - return QLatin1String(RemoteLinux::Constants::EMBEDDED_LINUX_QT); -} -QList<ProjectExplorer::Abi> EmbeddedLinuxQtVersion::detectQtAbis() const -{ - return qtAbisFromLibrary(qtCorePaths()); -} +// Factory -QString EmbeddedLinuxQtVersion::description() const +EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory() { - return QCoreApplication::translate("QtVersion", "Embedded Linux", "Qt Version is used for embedded Linux development"); -} + setQtVersionCreator([] { return new EmbeddedLinuxQtVersion; }); + setSupportedType(RemoteLinux::Constants::EMBEDDED_LINUX_QT); + setPriority(10); -QSet<Core::Id> EmbeddedLinuxQtVersion::targetDeviceTypes() const -{ - return {Constants::GenericLinuxOsType}; + setRestrictionChecker([](const SetupData &) { + const EmbeddedLinuxQtVersion tempVersion; + const ProjectExplorer::Abis abis = tempVersion.qtAbis(); + + // Note: This fails for e.g. intel/meego cross builds on x86 linux machines. + return abis.count() == 1 + && abis.at(0).os() == ProjectExplorer::Abi::LinuxOS + && !ProjectExplorer::Abi::hostAbi().isCompatibleWith(abis.at(0)); + }); } } // namespace Internal diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.h b/src/plugins/remotelinux/embeddedlinuxqtversion.h index f9b823e428..e70eea1df3 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.h +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.h @@ -26,6 +26,7 @@ #pragma once #include <qtsupport/baseqtversion.h> +#include <qtsupport/qtversionfactory.h> namespace RemoteLinux { namespace Internal { @@ -34,18 +35,17 @@ class EmbeddedLinuxQtVersion : public QtSupport::BaseQtVersion { public: EmbeddedLinuxQtVersion() = default; - EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected = false, - const QString &autodetectionSource = QString()); - EmbeddedLinuxQtVersion *clone() const override; - - QString type() const override; - - QList<ProjectExplorer::Abi> detectQtAbis() const override; QString description() const override; QSet<Core::Id> targetDeviceTypes() const override; }; +class EmbeddedLinuxQtVersionFactory : public QtSupport::QtVersionFactory +{ +public: + EmbeddedLinuxQtVersionFactory(); +}; + } // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/embeddedlinuxqtversionfactory.cpp b/src/plugins/remotelinux/embeddedlinuxqtversionfactory.cpp deleted file mode 100644 index c804c0a012..0000000000 --- a/src/plugins/remotelinux/embeddedlinuxqtversionfactory.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "embeddedlinuxqtversionfactory.h" - -#include "embeddedlinuxqtversion.h" -#include "remotelinux_constants.h" - -#include <QFileInfo> - -namespace RemoteLinux { -namespace Internal { - -EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory(QObject *parent) - : QtSupport::QtVersionFactory(parent) -{ -} - -EmbeddedLinuxQtVersionFactory::~EmbeddedLinuxQtVersionFactory() = default; - -bool EmbeddedLinuxQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(RemoteLinux::Constants::EMBEDDED_LINUX_QT); -} - -QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::restore(const QString &type, const QVariantMap &data) -{ - if (!canRestore(type)) - return nullptr; - auto v = new EmbeddedLinuxQtVersion; - v->fromMap(data); - return v; -} - -int EmbeddedLinuxQtVersionFactory::priority() const -{ - return 10; -} - -QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::FileName &qmakePath, - ProFileEvaluator *evaluator, - bool isAutoDetected, - const QString &autoDetectionSource) -{ - Q_UNUSED(evaluator); - - QFileInfo fi = qmakePath.toFileInfo(); - if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) - return nullptr; - - auto version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource); - - QList<ProjectExplorer::Abi> abis = version->qtAbis(); - // Note: This fails for e.g. intel/meego cross builds on x86 linux machines. - if (abis.count() == 1 - && abis.at(0).os() == ProjectExplorer::Abi::LinuxOS - && !ProjectExplorer::Abi::hostAbi().isCompatibleWith(abis.at(0))) - return version; - - delete version; - return nullptr; -} - -} // namespace Internal -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/embeddedlinuxqtversionfactory.h b/src/plugins/remotelinux/embeddedlinuxqtversionfactory.h deleted file mode 100644 index 7737a8de7a..0000000000 --- a/src/plugins/remotelinux/embeddedlinuxqtversionfactory.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <qtsupport/qtversionfactory.h> - -namespace RemoteLinux { -namespace Internal { - -class EmbeddedLinuxQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit EmbeddedLinuxQtVersionFactory(QObject *parent = nullptr); - ~EmbeddedLinuxQtVersionFactory() override; - - bool canRestore(const QString &type) override; - QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data) override; - - int priority() const override; - QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, - bool isAutoDetected = false, - const QString &autoDetectionSource = QString()) override; -}; - -} // Internal -} // RemoteLinux diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 014ed5db62..84779d373e 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -238,8 +238,7 @@ void GenericDirectUploadService::queryFiles() continue; } // We'd like to use --format=%Y, but it's not supported by busybox. - const QByteArray statCmd = "stat -t " - + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath()).toUtf8(); + const QString statCmd = "stat -t " + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath()); SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release(); statProc->setParent(this); connect(statProc, &SshRemoteProcess::done, this, @@ -328,7 +327,7 @@ void GenericDirectUploadService::chmod() const QString command = QLatin1String("chmod a+x ") + Utils::QtcProcess::quoteArgUnix(f.remoteFilePath()); SshRemoteProcess * const chmodProc - = connection()->createRemoteProcess(command.toUtf8()).release(); + = connection()->createRemoteProcess(command).release(); chmodProc->setParent(this); connect(chmodProc, &SshRemoteProcess::done, this, [this, chmodProc, state = d->state](const QString &error) { diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index a3f234685e..27668c0a50 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -71,12 +71,11 @@ GenericDirectUploadStep::~GenericDirectUploadStep() delete d; } -bool GenericDirectUploadStep::initInternal(QString *error) +CheckResult GenericDirectUploadStep::initInternal() { - d->deployService.setDeployableFiles(target()->deploymentData().allFiles()); d->deployService.setIncrementalDeployment(d->incrementalAspect->value()); d->deployService.setIgnoreMissingFiles(d->ignoreMissingFilesAspect->value()); - return d->deployService.isDeploymentPossible(error); + return d->deployService.isDeploymentPossible(); } GenericDirectUploadService *GenericDirectUploadStep::deployService() const @@ -84,6 +83,12 @@ GenericDirectUploadService *GenericDirectUploadStep::deployService() const return &d->deployService; } +void GenericDirectUploadStep::doRun() +{ + d->deployService.setDeployableFiles(target()->deploymentData().allFiles()); + AbstractRemoteLinuxDeployStep::doRun(); +} + Core::Id GenericDirectUploadStep::stepId() { return "RemoteLinux.DirectUploadStep"; diff --git a/src/plugins/remotelinux/genericdirectuploadstep.h b/src/plugins/remotelinux/genericdirectuploadstep.h index 5751e833b6..fa9b98205c 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.h +++ b/src/plugins/remotelinux/genericdirectuploadstep.h @@ -40,13 +40,14 @@ public: explicit GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl); ~GenericDirectUploadStep() override; - bool initInternal(QString *error = nullptr) override; + CheckResult initInternal() override; static Core::Id stepId(); static QString displayName(); private: GenericDirectUploadService *deployService() const override; + void doRun() override; Internal::GenericDirectUploadStepPrivate *d; }; diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp deleted file mode 100644 index f044da4f4d..0000000000 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "genericlinuxdeviceconfigurationfactory.h" - -#include "genericlinuxdeviceconfigurationwizard.h" -#include "linuxdevice.h" -#include "remotelinux_constants.h" - -#include <coreplugin/icore.h> - -#include <utils/qtcassert.h> - -using namespace ProjectExplorer; - -namespace RemoteLinux { - -GenericLinuxDeviceConfigurationFactory::GenericLinuxDeviceConfigurationFactory() - : IDeviceFactory(Constants::GenericLinuxOsType) -{ - setDisplayName(tr("Generic Linux Device")); - setIcon(QIcon()); - setCanCreate(true); - setConstructionFunction(&LinuxDevice::create); -} - -IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create() const -{ - GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow()); - if (wizard.exec() != QDialog::Accepted) - return IDevice::Ptr(); - return wizard.device(); -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp index 5957ac428b..4f7eaf229d 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp @@ -56,11 +56,11 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget( this, &GenericLinuxDeviceConfigurationWidget::authenticationTypeChanged); connect(m_ui->timeoutSpinBox, &QAbstractSpinBox::editingFinished, this, &GenericLinuxDeviceConfigurationWidget::timeoutEditingFinished); - connect(m_ui->timeoutSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), + connect(m_ui->timeoutSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GenericLinuxDeviceConfigurationWidget::timeoutEditingFinished); connect(m_ui->sshPortSpinBox, &QAbstractSpinBox::editingFinished, this, &GenericLinuxDeviceConfigurationWidget::sshPortEditingFinished); - connect(m_ui->sshPortSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), + connect(m_ui->sshPortSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GenericLinuxDeviceConfigurationWidget::sshPortEditingFinished); connect(m_ui->portsLineEdit, &QLineEdit::editingFinished, this, &GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged); diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index aa291079f2..6e05739c01 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -26,6 +26,7 @@ #include "linuxdevice.h" #include "genericlinuxdeviceconfigurationwidget.h" +#include "genericlinuxdeviceconfigurationwizard.h" #include "linuxdeviceprocess.h" #include "linuxdevicetester.h" #include "publickeydeploymentdialog.h" @@ -33,12 +34,17 @@ #include "remotelinuxsignaloperation.h" #include "remotelinuxenvironmentreader.h" +#include <coreplugin/icore.h> #include <coreplugin/id.h> #include <coreplugin/messagemanager.h> + #include <projectexplorer/devicesupport/sshdeviceprocesslist.h> -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> + #include <ssh/sshremoteprocessrunner.h> + #include <utils/algorithm.h> +#include <utils/environment.h> #include <utils/hostosinfo.h> #include <utils/port.h> #include <utils/qtcassert.h> @@ -190,35 +196,42 @@ LinuxDevice::LinuxDevice() } }}); + setOpenTerminal([this](const Utils::Environment &env, const QString &workingDir) { + DeviceProcess * const proc = createProcess(nullptr); + QObject::connect(proc, &DeviceProcess::finished, [proc] { + if (!proc->errorString().isEmpty()) { + Core::MessageManager::write(tr("Error running remote shell: %1") + .arg(proc->errorString()), + Core::MessageManager::ModeSwitch); + } + proc->deleteLater(); + }); + QObject::connect(proc, &DeviceProcess::error, [proc] { + Core::MessageManager::write(tr("Error starting remote shell."), + Core::MessageManager::ModeSwitch); + proc->deleteLater(); + }); + Runnable runnable; + runnable.device = sharedFromThis(); + runnable.environment = env; + runnable.workingDirectory = workingDir; + + // It seems we cannot pass an environment to OpenSSH dynamically + // without specifying an executable. + if (env.size() > 0) + runnable.executable = "/bin/sh"; + + proc->setRunInTerminal(true); + proc->start(runnable); + }); + if (Utils::HostOsInfo::isAnyUnixHost()) { addDeviceAction({tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) { - DeviceProcess * const proc = device->createProcess(nullptr); - QObject::connect(proc, &DeviceProcess::finished, [proc] { - if (!proc->errorString().isEmpty()) { - Core::MessageManager::write(tr("Error running remote shell: %1") - .arg(proc->errorString()), - Core::MessageManager::ModeSwitch); - } - proc->deleteLater(); - }); - QObject::connect(proc, &DeviceProcess::error, [proc] { - Core::MessageManager::write(tr("Error starting remote shell."), - Core::MessageManager::ModeSwitch); - proc->deleteLater(); - }); - Runnable runnable; - runnable.device = device; - proc->setRunInTerminal(true); - proc->start(runnable); + device->openTerminal(Utils::Environment(), QString()); }}); } } -IDevice::Ptr LinuxDevice::clone() const -{ - return Ptr(new LinuxDevice(*this)); -} - DeviceProcess *LinuxDevice::createProcess(QObject *parent) const { return new LinuxDeviceProcess(sharedFromThis(), parent); @@ -284,4 +297,26 @@ bool LinuxDevice::supportsRSync() const return extraData("RemoteLinux.SupportsRSync").toBool(); } +namespace Internal { + +// Factory + +LinuxDeviceFactory::LinuxDeviceFactory() + : IDeviceFactory(Constants::GenericLinuxOsType) +{ + setDisplayName(tr("Generic Linux Device")); + setIcon(QIcon()); + setCanCreate(true); + setConstructionFunction(&LinuxDevice::create); +} + +IDevice::Ptr LinuxDeviceFactory::create() const +{ + GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow()); + if (wizard.exec() != QDialog::Accepted) + return IDevice::Ptr(); + return wizard.device(); +} + +} } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 6f00a58d14..18faf4ae05 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -28,6 +28,7 @@ #include "remotelinux_export.h" #include <projectexplorer/devicesupport/idevice.h> +#include <projectexplorer/devicesupport/idevicefactory.h> #include <QCoreApplication> @@ -46,7 +47,6 @@ public: QString displayType() const override; ProjectExplorer::IDeviceWidget *createWidget() override; Utils::OsType osType() const override; - ProjectExplorer::IDevice::Ptr clone() const override; bool canCreateProcess() const override { return true; } ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override; @@ -66,4 +66,17 @@ protected: LinuxDevice(); }; +namespace Internal { + +class LinuxDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT + +public: + LinuxDeviceFactory(); + + ProjectExplorer::IDevice::Ptr create() const override; +}; + +} // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdeviceprocess.cpp b/src/plugins/remotelinux/linuxdeviceprocess.cpp index 004ca63d2a..ca08b44ec9 100644 --- a/src/plugins/remotelinux/linuxdeviceprocess.cpp +++ b/src/plugins/remotelinux/linuxdeviceprocess.cpp @@ -25,18 +25,15 @@ #include "linuxdeviceprocess.h" -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> #include <utils/environment.h> -#include <utils/qtcprocess.h> using namespace ProjectExplorer; using namespace Utils; namespace RemoteLinux { -static QString quote(const QString &s) { return Utils::QtcProcess::quoteArgUnix(s); } - LinuxDeviceProcess::LinuxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent) : ProjectExplorer::SshDeviceProcess(device, parent), m_processId(0) @@ -78,41 +75,41 @@ qint64 LinuxDeviceProcess::processId() const QString LinuxDeviceProcess::fullCommandLine(const Runnable &runnable) const { - const Environment env = runnable.environment; + CommandLine cmd; - QString fullCommandLine; - foreach (const QString &filePath, rcFilesToSource()) - fullCommandLine += QString::fromLatin1("test -f %1 && . %1;").arg(filePath); - if (!runnable.workingDirectory.isEmpty()) { - fullCommandLine.append(QLatin1String("cd ")).append(quote(runnable.workingDirectory)) - .append(QLatin1String(" && ")); + for (const QString &filePath : rcFilesToSource()) { + cmd.addArgs({"test", "-f", filePath}); + cmd.addArgs("&&"); + cmd.addArgs({".", filePath}); + cmd.addArgs(";"); } - QString envString; - for (auto it = env.constBegin(); it != env.constEnd(); ++it) { - if (!envString.isEmpty()) - envString += QLatin1Char(' '); - envString.append(env.key(it)).append(QLatin1String("='")).append(env.value(it)) - .append(QLatin1Char('\'')); + + if (!runnable.workingDirectory.isEmpty()) { + cmd.addArgs({"cd", runnable.workingDirectory}); + cmd.addArgs("&&"); } + if (!runInTerminal()) - fullCommandLine.append("echo $$ && "); - if (!envString.isEmpty()) - fullCommandLine.append(envString); + cmd.addArgs("echo $$ && "); + + const Environment &env = runnable.environment; + for (auto it = env.constBegin(); it != env.constEnd(); ++it) + cmd.addArgs(env.key(it) + "='" + env.value(it) + '\''); + if (!runInTerminal()) - fullCommandLine.append(" exec "); - fullCommandLine.append(quote(runnable.executable)); - if (!runnable.commandLineArguments.isEmpty()) { - fullCommandLine.append(QLatin1Char(' ')); - fullCommandLine.append(runnable.commandLineArguments); - } - return fullCommandLine; + cmd.addArg("exec"); + + cmd.addArg(runnable.executable); + cmd.addArgs(runnable.commandLineArguments); + + return cmd.arguments(); } -QStringList LinuxDeviceProcess::rcFilesToSource() const +const QStringList LinuxDeviceProcess::rcFilesToSource() const { if (!m_rcFilesToSource.isEmpty()) return m_rcFilesToSource; - return QStringList() << QLatin1String("/etc/profile") << QLatin1String("$HOME/.profile"); + return {"/etc/profile", "$HOME/.profile"}; } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdeviceprocess.h b/src/plugins/remotelinux/linuxdeviceprocess.h index 4b565029cc..b917222018 100644 --- a/src/plugins/remotelinux/linuxdeviceprocess.h +++ b/src/plugins/remotelinux/linuxdeviceprocess.h @@ -49,7 +49,7 @@ private: QString fullCommandLine(const ProjectExplorer::Runnable &) const override; qint64 processId() const override; - QStringList rcFilesToSource() const; + const QStringList rcFilesToSource() const; QStringList m_rcFilesToSource; QByteArray m_processIdString; diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index a555c22e86..bef26118c3 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -226,11 +226,12 @@ void GenericLinuxDeviceTester::testRsync() if (d->rsyncProcess.error() == QProcess::FailedToStart) handleRsyncFinished(); }); - connect(&d->rsyncProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), - [this] { + connect(&d->rsyncProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), + this, [this] { handleRsyncFinished(); }); - const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*d->connection); + const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*d->connection, + RsyncDeployStep::defaultFlags()); const QStringList args = QStringList(cmdLine.options) << "-n" << "--exclude=*" << (cmdLine.remoteHostSpec + ":/tmp"); d->rsyncProcess.start("rsync", args); diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp new file mode 100644 index 0000000000..c9d3578b79 --- /dev/null +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "makeinstallstep.h" + +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/buildsteplist.h> +#include <projectexplorer/deployconfiguration.h> +#include <projectexplorer/processparameters.h> +#include <projectexplorer/runconfigurationaspects.h> +#include <projectexplorer/target.h> +#include <projectexplorer/task.h> +#include <utils/fileutils.h> +#include <utils/qtcassert.h> +#include <utils/qtcprocess.h> + +#include <QDirIterator> +#include <QFileInfo> +#include <QFormLayout> +#include <QTemporaryDir> + +using namespace ProjectExplorer; +using namespace Utils; + +namespace RemoteLinux { +namespace Internal { + +const char MakeAspectId[] = "RemoteLinux.MakeInstall.Make"; +const char InstallRootAspectId[] = "RemoteLinux.MakeInstall.InstallRoot"; +const char CleanInstallRootAspectId[] = "RemoteLinux.MakeInstall.CleanInstallRoot"; +const char FullCommandLineAspectId[] = "RemoteLinux.MakeInstall.FullCommandLine"; + +MakeInstallStep::MakeInstallStep(BuildStepList *parent) : MakeStep(parent, stepId()) +{ + setDefaultDisplayName(displayName()); + + const auto makeAspect = addAspect<ExecutableAspect>(); + makeAspect->setId(MakeAspectId); + makeAspect->setSettingsKey(MakeAspectId); + makeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay); + makeAspect->setLabelText(tr("Command:")); + connect(makeAspect, &ExecutableAspect::changed, + this, &MakeInstallStep::updateCommandFromAspect); + + const auto installRootAspect = addAspect<BaseStringAspect>(); + installRootAspect->setId(InstallRootAspectId); + installRootAspect->setSettingsKey(InstallRootAspectId); + installRootAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay); + installRootAspect->setExpectedKind(PathChooser::Directory); + installRootAspect->setLabelText(tr("Install root:")); + connect(installRootAspect, &BaseStringAspect::changed, + this, &MakeInstallStep::updateArgsFromAspect); + + const auto cleanInstallRootAspect = addAspect<BaseBoolAspect>(); + cleanInstallRootAspect->setId(CleanInstallRootAspectId); + cleanInstallRootAspect->setSettingsKey(CleanInstallRootAspectId); + cleanInstallRootAspect->setLabel(tr("Clean install root first")); + cleanInstallRootAspect->setValue(false); + + const auto commandLineAspect = addAspect<BaseStringAspect>(); + commandLineAspect->setId(FullCommandLineAspectId); + commandLineAspect->setDisplayStyle(BaseStringAspect::LabelDisplay); + commandLineAspect->setLabelText(tr("Full command line:")); + + QTemporaryDir tmpDir; + installRootAspect->setFileName(FilePath::fromString(tmpDir.path())); + const MakeInstallCommand cmd = target()->makeInstallCommand(tmpDir.path()); + QTC_ASSERT(!cmd.command.isEmpty(), return); + makeAspect->setExecutable(cmd.command); +} + +Core::Id MakeInstallStep::stepId() +{ + return "RemoteLinux.MakeInstall"; +} + +QString MakeInstallStep::displayName() +{ + return tr("Install into temporary host directory"); +} + +BuildStepConfigWidget *MakeInstallStep::createConfigWidget() +{ + return BuildStep::createConfigWidget(); +} + +bool MakeInstallStep::init() +{ + if (!MakeStep::init()) + return false; + const QString rootDirPath = installRoot().toString(); + if (rootDirPath.isEmpty()) { + emit addTask(Task(Task::Error, tr("You must provide an install root."), FilePath(), -1, + Constants::TASK_CATEGORY_BUILDSYSTEM)); + return false; + } + QDir rootDir(rootDirPath); + if (cleanInstallRoot() && !rootDir.removeRecursively()) { + emit addTask(Task(Task::Error, tr("The install root \"%1\" could not be cleaned.") + .arg(installRoot().toUserOutput()), + FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM)); + return false; + } + if (!rootDir.exists() && !QDir::root().mkpath(rootDirPath)) { + emit addTask(Task(Task::Error, tr("The install root \"%1\" could not be created.") + .arg(installRoot().toUserOutput()), + FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM)); + return false; + } + if (this == deployConfiguration()->stepList()->steps().last()) { + emit addTask(Task(Task::Warning, tr("The \"make install\" step should probably not be " + "last in the list of deploy steps. " + "Consider moving it up."), FilePath(), -1, + Constants::TASK_CATEGORY_BUILDSYSTEM)); + } + const MakeInstallCommand cmd = target()->makeInstallCommand(installRoot().toString()); + if (cmd.environment.size() > 0) { + Environment env = processParameters()->environment(); + for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) + env.set(it.key(), it.value()); + processParameters()->setEnvironment(env); + } + m_noInstallTarget = false; + const auto buildStep = buildConfiguration() + ->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD) + ->firstOfType<AbstractProcessStep>(); + m_isCmakeProject = buildStep && buildStep->processParameters()->command().toString() + .contains("cmake"); + return true; +} + +void MakeInstallStep::finish(bool success) +{ + if (success) { + m_deploymentData = DeploymentData(); + m_deploymentData.setLocalInstallRoot(installRoot()); + QDirIterator dit(installRoot().toString(), QDir::Files, QDirIterator::Subdirectories); + while (dit.hasNext()) { + dit.next(); + const QFileInfo fi = dit.fileInfo(); + m_deploymentData.addFile(fi.filePath(), + fi.dir().path().mid(installRoot().toString().length())); + } + target()->setDeploymentData(m_deploymentData); + } else if (m_noInstallTarget && m_isCmakeProject) { + emit addTask(Task(Task::Warning, tr("You need to add an install statement to your " + "CMakeLists.txt file for deployment to work."), + FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); + } + MakeStep::finish(success); +} + +void MakeInstallStep::stdError(const QString &line) +{ + // When using Makefiles: "No rule to make target 'install'" + // When using ninja: "ninja: error: unknown target 'install'" + if (line.contains("target 'install'")) + m_noInstallTarget = true; + MakeStep::stdError(line); +} + +FilePath MakeInstallStep::installRoot() const +{ + return static_cast<BaseStringAspect *>(aspect(InstallRootAspectId))->fileName(); +} + +bool MakeInstallStep::cleanInstallRoot() const +{ + return static_cast<BaseBoolAspect *>(aspect(CleanInstallRootAspectId))->value(); +} + +void MakeInstallStep::updateCommandFromAspect() +{ + setMakeCommand(aspect<ExecutableAspect>()->executable()); + updateFullCommandLine(); +} + +void MakeInstallStep::updateArgsFromAspect() +{ + setUserArguments(QtcProcess::joinArgs(target()->makeInstallCommand( + static_cast<BaseStringAspect *>(aspect(InstallRootAspectId))->fileName().toString()) + .arguments)); + updateFullCommandLine(); +} + +void MakeInstallStep::updateFullCommandLine() +{ + static_cast<BaseStringAspect *>(aspect(FullCommandLineAspectId))->setValue( + QDir::toNativeSeparators( + QtcProcess::quoteArg(effectiveMakeCommand().toString())) + + ' ' + userArguments()); +} + +bool MakeInstallStep::fromMap(const QVariantMap &map) +{ + if (!MakeStep::fromMap(map)) + return false; + updateCommandFromAspect(); + updateArgsFromAspect(); + return true; +} + +} // namespace Internal +} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h b/src/plugins/remotelinux/makeinstallstep.h index 889840b337..5620c966b4 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h +++ b/src/plugins/remotelinux/makeinstallstep.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -25,21 +25,41 @@ #pragma once -#include "remotelinux_export.h" +#include <projectexplorer/deploymentdata.h> +#include <projectexplorer/makestep.h> -#include <projectexplorer/devicesupport/idevicefactory.h> +namespace Utils { class FilePath; } namespace RemoteLinux { +namespace Internal { -class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationFactory - : public ProjectExplorer::IDeviceFactory +class MakeInstallStep : public ProjectExplorer::MakeStep { Q_OBJECT - public: - GenericLinuxDeviceConfigurationFactory(); + MakeInstallStep(ProjectExplorer::BuildStepList *parent); + + static Core::Id stepId(); + static QString displayName(); + +private: + bool fromMap(const QVariantMap &map) override; + ProjectExplorer::BuildStepConfigWidget * createConfigWidget() override; + bool init() override; + void finish(bool success) override; + void stdError(const QString &line) override; + + Utils::FilePath installRoot() const; + bool cleanInstallRoot() const; + + void updateCommandFromAspect(); + void updateArgsFromAspect(); + void updateFullCommandLine(); - ProjectExplorer::IDevice::Ptr create() const override; + ProjectExplorer::DeploymentData m_deploymentData; + bool m_noInstallTarget = false; + bool m_isCmakeProject = false; }; +} // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 027cc59b22..5314e25d64 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -4,7 +4,7 @@ include(../../qtcreatorplugin.pri) HEADERS += \ embeddedlinuxqtversion.h \ - embeddedlinuxqtversionfactory.h \ + makeinstallstep.h \ remotelinuxenvironmentaspect.h \ remotelinuxenvironmentaspectwidget.h \ remotelinuxplugin.h \ @@ -13,7 +13,6 @@ HEADERS += \ remotelinuxrunconfiguration.h \ publickeydeploymentdialog.h \ genericlinuxdeviceconfigurationwizard.h \ - genericlinuxdeviceconfigurationfactory.h \ remotelinuxdebugsupport.h \ genericlinuxdeviceconfigurationwizardpages.h \ abstractremotelinuxdeploystep.h \ @@ -49,7 +48,7 @@ HEADERS += \ SOURCES += \ embeddedlinuxqtversion.cpp \ - embeddedlinuxqtversionfactory.cpp \ + makeinstallstep.cpp \ remotelinuxenvironmentaspect.cpp \ remotelinuxenvironmentaspectwidget.cpp \ remotelinuxplugin.cpp \ @@ -57,7 +56,6 @@ SOURCES += \ remotelinuxrunconfiguration.cpp \ publickeydeploymentdialog.cpp \ genericlinuxdeviceconfigurationwizard.cpp \ - genericlinuxdeviceconfigurationfactory.cpp \ remotelinuxdebugsupport.cpp \ genericlinuxdeviceconfigurationwizardpages.cpp \ abstractremotelinuxdeploystep.cpp \ @@ -92,8 +90,7 @@ SOURCES += \ FORMS += \ genericlinuxdeviceconfigurationwizardsetuppage.ui \ - genericlinuxdeviceconfigurationwidget.ui \ - remotelinuxcheckforfreediskspacestepwidget.ui + genericlinuxdeviceconfigurationwidget.ui RESOURCES += remotelinux.qrc diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 1f553d662b..e2a9551393 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -29,14 +29,10 @@ Project { "deploymenttimeinfo.h", "embeddedlinuxqtversion.cpp", "embeddedlinuxqtversion.h", - "embeddedlinuxqtversionfactory.cpp", - "embeddedlinuxqtversionfactory.h", "genericdirectuploadservice.cpp", "genericdirectuploadservice.h", "genericdirectuploadstep.cpp", "genericdirectuploadstep.h", - "genericlinuxdeviceconfigurationfactory.cpp", - "genericlinuxdeviceconfigurationfactory.h", "genericlinuxdeviceconfigurationwidget.cpp", "genericlinuxdeviceconfigurationwidget.h", "genericlinuxdeviceconfigurationwidget.ui", @@ -51,6 +47,8 @@ Project { "linuxdeviceprocess.h", "linuxdevicetester.cpp", "linuxdevicetester.h", + "makeinstallstep.cpp", + "makeinstallstep.h", "packageuploader.cpp", "packageuploader.h", "publickeydeploymentdialog.cpp", @@ -62,7 +60,6 @@ Project { "remotelinuxcheckforfreediskspaceservice.h", "remotelinuxcheckforfreediskspacestep.cpp", "remotelinuxcheckforfreediskspacestep.h", - "remotelinuxcheckforfreediskspacestepwidget.ui", "remotelinuxcustomcommanddeploymentstep.cpp", "remotelinuxcustomcommanddeploymentstep.h", "remotelinuxcustomcommanddeployservice.cpp", @@ -105,7 +102,7 @@ Project { "typespecificdeviceconfigurationlistmodel.h", "uploadandinstalltarpackagestep.cpp", "uploadandinstalltarpackagestep.h", - "images/embeddedtarget.png" + "images/embeddedtarget.png", ] Export { diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp index de2d43906c..e1d2447c51 100644 --- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp +++ b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp @@ -102,18 +102,15 @@ void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished() stopDeployment(); } -bool RemoteLinuxCheckForFreeDiskSpaceService::isDeploymentPossible(QString *whyNot) const +CheckResult RemoteLinuxCheckForFreeDiskSpaceService::isDeploymentPossible() const { - if (!AbstractRemoteLinuxDeployService::isDeploymentPossible(whyNot)) - return false; if (!d->pathToCheck.startsWith(QLatin1Char('/'))) { - if (whyNot) { - *whyNot = tr("Cannot check for free disk space: \"%1\" is not an absolute path.") - .arg(d->pathToCheck); - } - return false; + return CheckResult::failure( + tr("Cannot check for free disk space: \"%1\" is not an absolute path.") + .arg(d->pathToCheck)); } - return true; + + return AbstractRemoteLinuxDeployService::isDeploymentPossible(); } void RemoteLinuxCheckForFreeDiskSpaceService::doDeploy() @@ -125,7 +122,7 @@ void RemoteLinuxCheckForFreeDiskSpaceService::doDeploy() this, &RemoteLinuxCheckForFreeDiskSpaceService::handleStdErr); const QString command = QString::fromLatin1("df -k %1 |tail -n 1 |sed 's/ */ /g' " "|cut -d ' ' -f 4").arg(d->pathToCheck); - d->processRunner->run(command.toUtf8(), deviceConfiguration()->sshParameters()); + d->processRunner->run(command, deviceConfiguration()->sshParameters()); } void RemoteLinuxCheckForFreeDiskSpaceService::stopDeployment() diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.h b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.h index 3d6e76f5fb..2819eb00c7 100644 --- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.h +++ b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.h @@ -49,7 +49,7 @@ private: void doDeviceSetup() override { handleDeviceSetupDone(true); } void stopDeviceSetup() override { handleDeviceSetupDone(false); } - bool isDeploymentPossible(QString *whyNot) const override; + CheckResult isDeploymentPossible() const override; void doDeploy() override; void stopDeployment() override; diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.cpp b/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.cpp index 457e64292f..1070083eeb 100644 --- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.cpp +++ b/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.cpp @@ -24,11 +24,10 @@ ****************************************************************************/ #include "remotelinuxcheckforfreediskspacestep.h" -#include "ui_remotelinuxcheckforfreediskspacestepwidget.h" #include "remotelinuxcheckforfreediskspaceservice.h" -#include <QString> +#include <projectexplorer/projectconfigurationaspects.h> #include <limits> @@ -36,69 +35,44 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -namespace { -class RemoteLinuxCheckForFreeDiskSpaceStepWidget : public BuildStepConfigWidget -{ - Q_OBJECT - -public: - explicit RemoteLinuxCheckForFreeDiskSpaceStepWidget(RemoteLinuxCheckForFreeDiskSpaceStep &step) - : BuildStepConfigWidget(&step), m_step(step) - { - const QString displayName = QLatin1String("<b>") - + RemoteLinuxCheckForFreeDiskSpaceStep::displayName() + QLatin1String("</b>"); - setDisplayName(displayName); - setSummaryText(displayName); - - m_ui.setupUi(this); - m_ui.requiredSpaceSpinBox->setSuffix(tr("MB")); - m_ui.requiredSpaceSpinBox->setMinimum(1); - m_ui.requiredSpaceSpinBox->setMaximum(std::numeric_limits<int>::max()); - - m_ui.pathLineEdit->setText(m_step.pathToCheck()); - m_ui.requiredSpaceSpinBox->setValue(m_step.requiredSpaceInBytes()/multiplier); - - connect(m_ui.pathLineEdit, &QLineEdit::textChanged, - this, &RemoteLinuxCheckForFreeDiskSpaceStepWidget::handlePathChanged); - connect(m_ui.requiredSpaceSpinBox, - static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), - this, &RemoteLinuxCheckForFreeDiskSpaceStepWidget::handleRequiredSpaceChanged); - } - -private: - void handlePathChanged() { m_step.setPathToCheck(m_ui.pathLineEdit->text().trimmed()); } - void handleRequiredSpaceChanged() { - m_step.setRequiredSpaceInBytes(quint64(m_ui.requiredSpaceSpinBox->value())*multiplier); - } - - static const int multiplier = 1024*1024; - - Ui::RemoteLinuxCheckForFreeDiskSpaceStepWidget m_ui; - RemoteLinuxCheckForFreeDiskSpaceStep &m_step; -}; - -} // anonymous namespace +const char PathToCheckAspectId[] = "PathToCheckAspectId"; const char PathToCheckKey[] = "RemoteLinux.CheckForFreeDiskSpaceStep.PathToCheck"; + +const char RequiredSpaceAspectId[] = "RequiredSpaceAspectId"; const char RequiredSpaceKey[] = "RemoteLinux.CheckForFreeDiskSpaceStep.RequiredSpace"; class RemoteLinuxCheckForFreeDiskSpaceStepPrivate { public: RemoteLinuxCheckForFreeDiskSpaceService deployService; - QString pathToCheck; - quint64 requiredSpaceInBytes; }; + } // namespace Internal +using namespace Internal; RemoteLinuxCheckForFreeDiskSpaceStep::RemoteLinuxCheckForFreeDiskSpaceStep(BuildStepList *bsl) : AbstractRemoteLinuxDeployStep(bsl, stepId()) { d = new Internal::RemoteLinuxCheckForFreeDiskSpaceStepPrivate; setDefaultDisplayName(displayName()); - setPathToCheck("/"); - setRequiredSpaceInBytes(5*1024*1024); + + auto pathToCheckAspect = addAspect<BaseStringAspect>(); + pathToCheckAspect->setId(PathToCheckAspectId); + pathToCheckAspect->setSettingsKey(PathToCheckKey); + pathToCheckAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); + pathToCheckAspect->setValue("/"); + pathToCheckAspect->setLabelText(tr("Remote path to check for free space:")); + + auto requiredSpaceAspect = addAspect<BaseIntegerAspect>(); + requiredSpaceAspect->setId(RequiredSpaceAspectId); + requiredSpaceAspect->setSettingsKey(RequiredSpaceKey); + requiredSpaceAspect->setLabel(tr("Required disk space:")); + requiredSpaceAspect->setDisplayScaleFactor(1024*1024); + requiredSpaceAspect->setValue(5*1024*1024); + requiredSpaceAspect->setSuffix(tr("MB")); + requiredSpaceAspect->setRange(1, std::numeric_limits<int>::max()); } RemoteLinuxCheckForFreeDiskSpaceStep::~RemoteLinuxCheckForFreeDiskSpaceStep() @@ -106,54 +80,13 @@ RemoteLinuxCheckForFreeDiskSpaceStep::~RemoteLinuxCheckForFreeDiskSpaceStep() delete d; } -void RemoteLinuxCheckForFreeDiskSpaceStep::setPathToCheck(const QString &path) -{ - d->pathToCheck = path; -} - -QString RemoteLinuxCheckForFreeDiskSpaceStep::pathToCheck() const -{ - return d->pathToCheck; -} - -void RemoteLinuxCheckForFreeDiskSpaceStep::setRequiredSpaceInBytes(quint64 space) -{ - d->requiredSpaceInBytes = space; -} - -quint64 RemoteLinuxCheckForFreeDiskSpaceStep::requiredSpaceInBytes() const -{ - return d->requiredSpaceInBytes; -} - -bool RemoteLinuxCheckForFreeDiskSpaceStep::fromMap(const QVariantMap &map) -{ - if (!AbstractRemoteLinuxDeployStep::fromMap(map)) - return false; - d->pathToCheck = map.value(QLatin1String(Internal::PathToCheckKey)).toString(); - d->requiredSpaceInBytes = map.value(QLatin1String(Internal::RequiredSpaceKey)).toULongLong(); - return true; -} - -QVariantMap RemoteLinuxCheckForFreeDiskSpaceStep::toMap() const +CheckResult RemoteLinuxCheckForFreeDiskSpaceStep::initInternal() { - QVariantMap map = AbstractRemoteLinuxDeployStep::toMap(); - map.insert(QLatin1String(Internal::PathToCheckKey), d->pathToCheck); - map.insert(QLatin1String(Internal::RequiredSpaceKey), d->requiredSpaceInBytes); - return map; -} - -BuildStepConfigWidget *RemoteLinuxCheckForFreeDiskSpaceStep::createConfigWidget() -{ - return new Internal::RemoteLinuxCheckForFreeDiskSpaceStepWidget(*this); -} - -bool RemoteLinuxCheckForFreeDiskSpaceStep::initInternal(QString *error) -{ - Q_UNUSED(error); - d->deployService.setPathToCheck(d->pathToCheck); - d->deployService.setRequiredSpaceInBytes(d->requiredSpaceInBytes); - return true; + d->deployService.setPathToCheck( + static_cast<BaseStringAspect *>(aspect(PathToCheckAspectId))->value()); + d->deployService.setRequiredSpaceInBytes( + static_cast<BaseIntegerAspect *>(aspect(RequiredSpaceAspectId))->value()); + return CheckResult::success(); } AbstractRemoteLinuxDeployService *RemoteLinuxCheckForFreeDiskSpaceStep::deployService() const @@ -172,5 +105,3 @@ QString RemoteLinuxCheckForFreeDiskSpaceStep::displayName() } } // namespace RemoteLinux - -#include "remotelinuxcheckforfreediskspacestep.moc" diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.h b/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.h index f102c93c62..afd5887f33 100644 --- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.h +++ b/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestep.h @@ -37,21 +37,11 @@ public: explicit RemoteLinuxCheckForFreeDiskSpaceStep(ProjectExplorer::BuildStepList *bsl); ~RemoteLinuxCheckForFreeDiskSpaceStep() override; - void setPathToCheck(const QString &path); - QString pathToCheck() const; - - void setRequiredSpaceInBytes(quint64 space); - quint64 requiredSpaceInBytes() const; - static Core::Id stepId(); static QString displayName(); protected: - bool fromMap(const QVariantMap &map) override; - QVariantMap toMap() const override; - ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; - - bool initInternal(QString *error) override; + CheckResult initInternal() override; AbstractRemoteLinuxDeployService *deployService() const override; private: diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestepwidget.ui b/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestepwidget.ui deleted file mode 100644 index b310833f6c..0000000000 --- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspacestepwidget.ui +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RemoteLinuxCheckForFreeDiskSpaceStepWidget</class> - <widget class="QWidget" name="RemoteLinuxCheckForFreeDiskSpaceStepWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>420</width> - <height>74</height> - </rect> - </property> - <property name="windowTitle"> - <string/> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="pathLabel"> - <property name="text"> - <string>Remote path to check for free space:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="pathLineEdit"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="requiredSpaceLabel"> - <property name="text"> - <string>Required disk space:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="requiredSpaceSpinBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp index de2dc30da4..87c82e52f8 100644 --- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp @@ -58,10 +58,10 @@ RemoteLinuxCustomCommandDeploymentStep::~RemoteLinuxCustomCommandDeploymentStep( delete d; } -bool RemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error) +CheckResult RemoteLinuxCustomCommandDeploymentStep::initInternal() { d->service.setCommandLine(d->commandLineAspect->value().trimmed()); - return d->service.isDeploymentPossible(error); + return d->service.isDeploymentPossible(); } AbstractRemoteLinuxDeployService *RemoteLinuxCustomCommandDeploymentStep::deployService() const diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h index a8f036f8da..325ceb0ebd 100644 --- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h +++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h @@ -42,7 +42,7 @@ public: static QString displayName(); private: - bool initInternal(QString *error) override; + CheckResult initInternal() override; AbstractRemoteLinuxDeployService *deployService() const override; Internal::RemoteLinuxCustomCommandDeploymentStepPrivate *d; diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp index ffa1dfe6af..471ace1a0e 100644 --- a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp @@ -66,19 +66,14 @@ void RemoteLinuxCustomCommandDeployService::setCommandLine(const QString &comman d->commandLine = commandLine; } -bool RemoteLinuxCustomCommandDeployService::isDeploymentPossible(QString *whyNot) const +CheckResult RemoteLinuxCustomCommandDeployService::isDeploymentPossible() const { - QTC_ASSERT(d->state == Inactive, return false); - - if (!AbstractRemoteLinuxDeployService::isDeploymentPossible(whyNot)) - return false; - if (d->commandLine.isEmpty()) { - if (whyNot) - *whyNot = tr("No command line given."); - return false; - } + QTC_ASSERT(d->state == Inactive, return CheckResult::failure()); + + if (d->commandLine.isEmpty()) + return CheckResult::failure(tr("No command line given.")); - return true; + return AbstractRemoteLinuxDeployService::isDeploymentPossible(); } void RemoteLinuxCustomCommandDeployService::doDeploy() @@ -96,7 +91,7 @@ void RemoteLinuxCustomCommandDeployService::doDeploy() emit progressMessage(tr("Starting remote command \"%1\"...").arg(d->commandLine)); d->state = Running; - d->runner->run(d->commandLine.toUtf8(), deviceConfiguration()->sshParameters()); + d->runner->run(d->commandLine, deviceConfiguration()->sshParameters()); } void RemoteLinuxCustomCommandDeployService::stopDeployment() diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.h b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.h index 33b0e67b1d..cc2f7fb129 100644 --- a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.h +++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.h @@ -41,7 +41,7 @@ public: void setCommandLine(const QString &commandLine); bool isDeploymentNecessary() const override { return true; } - bool isDeploymentPossible(QString *whyNot = nullptr) const override; + CheckResult isDeploymentPossible() const override; protected: void doDeviceSetup() override { handleDeviceSetupDone(true); } diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index d72db3c2a8..a375716aab 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -30,6 +30,7 @@ #include "remotelinuxx11forwardingaspect.h" #include <projectexplorer/runconfigurationaspects.h> +#include <projectexplorer/runcontrol.h> #include <projectexplorer/target.h> #include <qtsupport/qtoutputformatter.h> diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index eebf891e91..5143efe7d9 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -34,7 +34,7 @@ namespace RemoteLinux { namespace Internal { LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) - : DebuggerRunTool(runControl, nullptr, false) + : DebuggerRunTool(runControl, DebuggerRunTool::DoNotAllowTerminal) { setId("LinuxDeviceDebugSupport"); diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 11723a5a25..88cd76f66d 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -27,6 +27,7 @@ #include "genericdirectuploadstep.h" #include "linuxdevice.h" +#include "makeinstallstep.h" #include "remotelinuxcheckforfreediskspacestep.h" #include "remotelinuxkillappstep.h" #include "remotelinux_constants.h" @@ -60,14 +61,19 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory() "Deploy to Remote Linux Host")); setUseDeploymentDataView(); + addInitialStep(MakeInstallStep::stepId(), [](Target *target) { + const Project * const prj = target->project(); + return prj->deploymentKnowledge() == DeploymentKnowledge::Bad + && prj->hasMakeInstallEquivalent(); + }); addInitialStep(RemoteLinuxCheckForFreeDiskSpaceStep::stepId()); addInitialStep(RemoteLinuxKillAppStep::stepId()); addInitialStep(RsyncDeployStep::stepId(), [](Target *target) { - auto device = DeviceKitInformation::device(target->kit()).staticCast<const LinuxDevice>(); + auto device = DeviceKitAspect::device(target->kit()).staticCast<const LinuxDevice>(); return device && device->supportsRSync(); }); addInitialStep(GenericDirectUploadStep::stepId(), [](Target *target) { - auto device = DeviceKitInformation::device(target->kit()).staticCast<const LinuxDevice>(); + auto device = DeviceKitAspect::device(target->kit()).staticCast<const LinuxDevice>(); return device && !device->supportsRSync(); }); } diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index cfa23b3219..36d2d03e2d 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -41,41 +41,21 @@ static bool displayAlreadySet(const QList<Utils::EnvironmentItem> &changes) }); } -enum BaseEnvironmentBase { - CleanBaseEnvironment = 0, - RemoteBaseEnvironment = 1 -}; - - RemoteLinuxEnvironmentAspect::RemoteLinuxEnvironmentAspect(ProjectExplorer::Target *target) { - addSupportedBaseEnvironment(CleanBaseEnvironment, tr("Clean Environment")); - addPreferredBaseEnvironment(RemoteBaseEnvironment, tr("System Environment")); + addSupportedBaseEnvironment(tr("Clean Environment"), {}); + addPreferredBaseEnvironment(tr("System Environment"), [this] { return m_remoteEnvironment; }); setConfigWidgetCreator([this, target] { return new RemoteLinuxEnvironmentAspectWidget(this, target); }); } -Utils::Environment RemoteLinuxEnvironmentAspect::baseEnvironment() const -{ - Utils::Environment env; - if (baseEnvironmentBase() == static_cast<int>(RemoteBaseEnvironment)) - env = m_remoteEnvironment; - return env; -} - -Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const -{ - return m_remoteEnvironment; -} - void RemoteLinuxEnvironmentAspect::setRemoteEnvironment(const Utils::Environment &env) { if (env != m_remoteEnvironment) { m_remoteEnvironment = env; - if (baseEnvironmentBase() == static_cast<int>(RemoteBaseEnvironment)) - emit environmentChanged(); + emit environmentChanged(); } } diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h index 0ac83cd428..a6a2135970 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h @@ -38,9 +38,6 @@ class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer:: public: RemoteLinuxEnvironmentAspect(ProjectExplorer::Target *target); - Utils::Environment baseEnvironment() const override; - - Utils::Environment remoteEnvironment() const; void setRemoteEnvironment(const Utils::Environment &env); QString userEnvironmentChangesAsString() const; diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp index 4f06d741e7..0d94cf3ffa 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp @@ -25,11 +25,15 @@ #include "remotelinuxenvironmentaspectwidget.h" +#include "linuxdevice.h" #include "remotelinuxrunconfiguration.h" #include "remotelinuxenvironmentreader.h" -#include <projectexplorer/target.h> +#include <coreplugin/icore.h> +#include <projectexplorer/environmentwidget.h> #include <projectexplorer/kitinformation.h> +#include <projectexplorer/target.h> +#include <utils/qtcassert.h> #include <QCoreApplication> #include <QMessageBox> @@ -50,7 +54,7 @@ RemoteLinuxEnvironmentAspectWidget::RemoteLinuxEnvironmentAspectWidget (RemoteLinuxEnvironmentAspect *aspect, Target *target) : EnvironmentAspectWidget(aspect, new QPushButton) { - IDevice::ConstPtr device = DeviceKitInformation::device(target->kit()); + IDevice::ConstPtr device = DeviceKitAspect::device(target->kit()); deviceEnvReader = new RemoteLinuxEnvironmentReader(device, this); connect(target, &ProjectExplorer::Target::kitChanged, @@ -63,6 +67,20 @@ RemoteLinuxEnvironmentAspectWidget::RemoteLinuxEnvironmentAspectWidget this, &RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentFinished); connect(deviceEnvReader, &RemoteLinuxEnvironmentReader::error, this, &RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentError); + + const EnvironmentWidget::OpenTerminalFunc openTerminalFunc + = [target](const Utils::Environment &env) { + IDevice::ConstPtr device = DeviceKitAspect::device(target->kit()); + if (!device) { + QMessageBox::critical(Core::ICore::mainWindow(), tr("Cannot open terminal"), + tr("Cannot open remote terminal: Current kit has no device.")); + return; + } + const auto linuxDevice = device.dynamicCast<const LinuxDevice>(); + QTC_ASSERT(linuxDevice, return); + linuxDevice->openTerminal(env, QString()); + }; + envWidget()->setOpenTerminalFunc(openTerminalFunc); } RemoteLinuxEnvironmentAspect *RemoteLinuxEnvironmentAspectWidget::aspect() const diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp index 0c93be020a..33543f6ee1 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp @@ -27,7 +27,7 @@ #include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/devicesupport/idevice.h> -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> using namespace ProjectExplorer; diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.cpp b/src/plugins/remotelinux/remotelinuxkillappstep.cpp index c0c1298ad8..f6dd121e7c 100644 --- a/src/plugins/remotelinux/remotelinuxkillappstep.cpp +++ b/src/plugins/remotelinux/remotelinuxkillappstep.cpp @@ -27,7 +27,7 @@ #include "remotelinuxkillappservice.h" -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> @@ -44,15 +44,14 @@ RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id) setWidgetExpandedByDefault(false); } -bool RemoteLinuxKillAppStep::initInternal(QString *error) +CheckResult RemoteLinuxKillAppStep::initInternal() { - Q_UNUSED(error); Target * const theTarget = target(); - QTC_ASSERT(theTarget, return false); + QTC_ASSERT(theTarget, return CheckResult::failure()); RunConfiguration * const rc = theTarget->activeRunConfiguration(); const QString remoteExe = rc ? rc->runnable().executable : QString(); m_service->setRemoteExecutable(remoteExe); - return true; + return CheckResult::success(); } AbstractRemoteLinuxDeployService *RemoteLinuxKillAppStep::deployService() const diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.h b/src/plugins/remotelinux/remotelinuxkillappstep.h index e1f9b3f47e..183db57b2a 100644 --- a/src/plugins/remotelinux/remotelinuxkillappstep.h +++ b/src/plugins/remotelinux/remotelinuxkillappstep.h @@ -41,7 +41,7 @@ public: static QString displayName(); private: - bool initInternal(QString *error) override; + CheckResult initInternal() override; AbstractRemoteLinuxDeployService *deployService() const override; RemoteLinuxKillAppService * const m_service; diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp index 4d3439931b..bf27f6d03e 100644 --- a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp +++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp @@ -76,7 +76,7 @@ void AbstractRemoteLinuxPackageInstaller::installPackage(const IDevice::ConstPtr QString cmdLine = installCommandLine(packageFilePath); if (removePackageFile) cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)"); - d->installer->run(cmdLine.toUtf8(), deviceConfig->sshParameters()); + d->installer->run(cmdLine, deviceConfig->sshParameters()); d->isRunning = true; } @@ -86,7 +86,7 @@ void AbstractRemoteLinuxPackageInstaller::cancelInstallation() if (!d->killProcess) d->killProcess = new SshRemoteProcessRunner(this); - d->killProcess->run(cancelInstallationCommandLine().toUtf8(), d->deviceConfig->sshParameters()); + d->killProcess->run(cancelInstallationCommandLine(), d->deviceConfig->sshParameters()); setFinished(); } diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 25b8eb5e89..1f25666cbf 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -25,8 +25,8 @@ #include "remotelinuxplugin.h" -#include "embeddedlinuxqtversionfactory.h" -#include "genericlinuxdeviceconfigurationfactory.h" +#include "embeddedlinuxqtversion.h" +#include "linuxdevice.h" #include "remotelinux_constants.h" #include "remotelinuxqmltoolingsupport.h" #include "remotelinuxcustomrunconfiguration.h" @@ -35,6 +35,7 @@ #include "remotelinuxrunconfiguration.h" #include "genericdirectuploadstep.h" +#include "makeinstallstep.h" #include "remotelinuxcheckforfreediskspacestep.h" #include "remotelinuxdeployconfiguration.h" #include "remotelinuxcustomcommanddeploymentstep.h" @@ -67,7 +68,7 @@ public: class RemoteLinuxPluginPrivate { public: - GenericLinuxDeviceConfigurationFactory deviceConfigurationFactory; + LinuxDeviceFactory linuxDeviceFactory; RemoteLinuxRunConfigurationFactory runConfigurationFactory; RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory; RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; @@ -80,6 +81,7 @@ public: GenericDeployStepFactory<RemoteLinuxCheckForFreeDiskSpaceStep> checkForFreeDiskSpaceStepFactory; GenericDeployStepFactory<RemoteLinuxKillAppStep> remoteLinuxKillAppStepFactory; + GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory; EmbeddedLinuxQtVersionFactory embeddedLinuxQtVersionFactory; }; @@ -103,7 +105,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, QString *errorM dd = new RemoteLinuxPluginPrivate; auto constraint = [](RunConfiguration *runConfig) { - const Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId( + const Core::Id devType = ProjectExplorer::DeviceTypeKitAspect::deviceTypeId( runConfig->target()->kit()); if (devType != Constants::GenericLinuxOsType) diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index b39ebc7846..f636799af8 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -34,6 +34,7 @@ #include <projectexplorer/kitinformation.h> #include <projectexplorer/project.h> #include <projectexplorer/runconfigurationaspects.h> +#include <projectexplorer/runcontrol.h> #include <projectexplorer/target.h> #include <qtsupport/qtoutputformatter.h> @@ -95,7 +96,7 @@ void RemoteLinuxRunConfiguration::updateTargetInformation() QString localExecutable = bti.targetFilePath.toString(); DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable); - aspect<ExecutableAspect>()->setExecutable(FileName::fromString(depFile.remoteFilePath())); + aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath())); aspect<SymbolFileAspect>()->setValue(localExecutable); emit enabledChanged(); diff --git a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp index 64e1f5b2d3..5a5def6bb3 100644 --- a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp +++ b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp @@ -60,7 +60,7 @@ void RemoteLinuxSignalOperation::run(const QString &command) this, &RemoteLinuxSignalOperation::runnerProcessFinished); connect(m_runner, &QSsh::SshRemoteProcessRunner::connectionError, this, &RemoteLinuxSignalOperation::runnerConnectionError); - m_runner->run(command.toLatin1(), m_sshParameters); + m_runner->run(command, m_sshParameters); } void RemoteLinuxSignalOperation::finish() diff --git a/src/plugins/remotelinux/rsyncdeploystep.cpp b/src/plugins/remotelinux/rsyncdeploystep.cpp index 8c04860c25..25dc0b28d5 100644 --- a/src/plugins/remotelinux/rsyncdeploystep.cpp +++ b/src/plugins/remotelinux/rsyncdeploystep.cpp @@ -51,6 +51,7 @@ public: void setDeployableFiles(const QList<DeployableFile> &files) { m_deployableFiles = files; } void setIgnoreMissingFiles(bool ignore) { m_ignoreMissingFiles = ignore; } + void setFlags(const QString &flags) { m_flags = flags; } private: bool isDeploymentNecessary() const override; @@ -69,6 +70,7 @@ private: mutable QList<DeployableFile> m_deployableFiles; bool m_ignoreMissingFiles = false; + QString m_flags; SshProcess m_rsync; SshRemoteProcessPtr m_mkdir; }; @@ -101,7 +103,7 @@ void RsyncDeployService::createRemoteDirectories() remoteDirs.sort(); remoteDirs.removeDuplicates(); m_mkdir = connection()->createRemoteProcess("mkdir -p " + QtcProcess::Arguments - ::createUnixArgs(remoteDirs).toString().toUtf8()); + ::createUnixArgs(remoteDirs).toString()); connect(m_mkdir.get(), &SshRemoteProcess::done, this, [this](const QString &error) { QString userError; if (!error.isEmpty()) @@ -132,7 +134,7 @@ void RsyncDeployService::deployFiles() setFinished(); } }); - connect(&m_rsync, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, [this] { + connect(&m_rsync, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this] { if (m_rsync.exitStatus() == QProcess::CrashExit) { emit errorMessage(tr("rsync crashed.")); setFinished(); @@ -155,7 +157,7 @@ void RsyncDeployService::deployNextFile() return; } const DeployableFile file = m_deployableFiles.takeFirst(); - const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*connection()); + const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*connection(), m_flags); const QStringList args = QStringList(cmdLine.options) << file.localFilePath().toString() << (cmdLine.remoteHostSpec + ':' + file.remoteFilePath()); @@ -180,11 +182,18 @@ class RsyncDeployStep::RsyncDeployStepPrivate public: Internal::RsyncDeployService deployService; BaseBoolAspect *ignoreMissingFilesAspect; + BaseStringAspect *flagsAspect; }; RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl) : AbstractRemoteLinuxDeployStep(bsl, stepId()), d(new RsyncDeployStepPrivate) { + d->flagsAspect = addAspect<BaseStringAspect>(); + d->flagsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); + d->flagsAspect->setSettingsKey("RemoteLinux.RsyncDeployStep.Flags"); + d->flagsAspect->setLabelText(tr("Flags:")); + d->flagsAspect->setValue(defaultFlags()); + d->ignoreMissingFilesAspect = addAspect<BaseBoolAspect>(); d->ignoreMissingFilesAspect ->setSettingsKey("RemoteLinux.RsyncDeployStep.IgnoreMissingFiles"); @@ -199,11 +208,11 @@ RsyncDeployStep::~RsyncDeployStep() delete d; } -bool RsyncDeployStep::initInternal(QString *error) +CheckResult RsyncDeployStep::initInternal() { - d->deployService.setDeployableFiles(target()->deploymentData().allFiles()); d->deployService.setIgnoreMissingFiles(d->ignoreMissingFilesAspect->value()); - return d->deployService.isDeploymentPossible(error); + d->deployService.setFlags(d->flagsAspect->value()); + return d->deployService.isDeploymentPossible(); } AbstractRemoteLinuxDeployService *RsyncDeployStep::deployService() const @@ -211,6 +220,12 @@ AbstractRemoteLinuxDeployService *RsyncDeployStep::deployService() const return &d->deployService; } +void RsyncDeployStep::doRun() +{ + d->deployService.setDeployableFiles(target()->deploymentData().allFiles()); + AbstractRemoteLinuxDeployStep::doRun(); +} + Core::Id RsyncDeployStep::stepId() { return "RemoteLinux.RsyncDeployStep"; @@ -221,13 +236,19 @@ QString RsyncDeployStep::displayName() return tr("Deploy files via rsync"); } -RsyncCommandLine RsyncDeployStep::rsyncCommand(const SshConnection &sshConnection) +QString RsyncDeployStep::defaultFlags() +{ + return QString("-av"); +} + +RsyncCommandLine RsyncDeployStep::rsyncCommand(const SshConnection &sshConnection, + const QString &flags) { const QString sshCmdLine = QtcProcess::joinArgs( QStringList{SshSettings::sshFilePath().toUserOutput()} << sshConnection.connectionOptions()); const SshConnectionParameters sshParams = sshConnection.connectionParameters(); - return RsyncCommandLine(QStringList{"-e", sshCmdLine, "-av"}, + return RsyncCommandLine(QStringList{"-e", sshCmdLine, flags}, sshParams.userName() + '@' + sshParams.host()); } diff --git a/src/plugins/remotelinux/rsyncdeploystep.h b/src/plugins/remotelinux/rsyncdeploystep.h index ddc627e7dc..e71a57a11d 100644 --- a/src/plugins/remotelinux/rsyncdeploystep.h +++ b/src/plugins/remotelinux/rsyncdeploystep.h @@ -51,12 +51,15 @@ public: static Core::Id stepId(); static QString displayName(); - static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection); + static QString defaultFlags(); + static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection, + const QString &flags); private: AbstractRemoteLinuxDeployService *deployService() const override; + void doRun() override; - bool initInternal(QString *error = nullptr) override; + CheckResult initInternal() override; class RsyncDeployStepPrivate; RsyncDeployStepPrivate * const d; diff --git a/src/plugins/remotelinux/sshkeydeployer.cpp b/src/plugins/remotelinux/sshkeydeployer.cpp index 7581a72018..2c73ffeff1 100644 --- a/src/plugins/remotelinux/sshkeydeployer.cpp +++ b/src/plugins/remotelinux/sshkeydeployer.cpp @@ -67,9 +67,10 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, this, &SshKeyDeployer::handleConnectionFailure); connect(&d->deployProcess, &SshRemoteProcessRunner::processClosed, this, &SshKeyDeployer::handleKeyUploadFinished); - const QByteArray command = "test -d .ssh " + const QString command = "test -d .ssh " "|| mkdir .ssh && chmod 0700 .ssh && echo '" - + reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; + + QString::fromLocal8Bit(reader.data()) + + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; d->deployProcess.run(command, sshParams); } diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index 49fead9a59..26ac446028 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -119,7 +119,7 @@ void TarPackageCreationStep::addNeededDeploymentFiles( } for (const QString &fileName : files) { - const QString localFilePath = deployable.localFilePath().appendPath(fileName).toString(); + const QString localFilePath = deployable.localFilePath().pathAppended(fileName).toString(); const QString remoteDir = deployable.remoteDirectory() + '/' + fileInfo.fileName(); diff --git a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp index 56068064ec..86a9d608fa 100644 --- a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp +++ b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp @@ -126,7 +126,7 @@ bool TypeSpecificDeviceConfigurationListModel::deviceMatches(IDevice::ConstPtr d { if (dev.isNull()) return false; - Core::Id typeId = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + Core::Id typeId = DeviceTypeKitAspect::deviceTypeId(target()->kit()); return dev->type() == typeId; } diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp index ecc7eb3997..cf1c2face6 100644 --- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp +++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp @@ -69,7 +69,7 @@ UploadAndInstallTarPackageStep::UploadAndInstallTarPackageStep(BuildStepList *bs setWidgetExpandedByDefault(false); } -bool UploadAndInstallTarPackageStep::initInternal(QString *error) +CheckResult UploadAndInstallTarPackageStep::initInternal() { const TarPackageCreationStep *pStep = nullptr; @@ -79,13 +79,11 @@ bool UploadAndInstallTarPackageStep::initInternal(QString *error) if ((pStep = dynamic_cast<TarPackageCreationStep *>(step))) break; } - if (!pStep) { - if (error) - *error = tr("No tarball creation step found."); - return false; - } + if (!pStep) + return CheckResult::failure(tr("No tarball creation step found.")); + m_deployService->setPackageFilePath(pStep->packageFilePath()); - return m_deployService->isDeploymentPossible(error); + return m_deployService->isDeploymentPossible(); } Core::Id UploadAndInstallTarPackageStep::stepId() diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h index de1d2f487d..a613e7426f 100644 --- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h +++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h @@ -55,7 +55,7 @@ class REMOTELINUX_EXPORT UploadAndInstallTarPackageStep : public AbstractRemoteL public: explicit UploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bsl); - bool initInternal(QString *error = nullptr) override; + CheckResult initInternal() override; static Core::Id stepId(); static QString displayName(); |