forked from qt-creator/qt-creator
AppMan: Use current setup pattern for build steps
Change-Id: Ia69b9ea67fdec6a33f13fba665ee4589e82a2574 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
#include "appmanagertr.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -16,19 +18,20 @@
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Utils;
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
namespace AppManager::Internal {
|
||||
|
||||
AppManagerCMakePackageStepFactory::AppManagerCMakePackageStepFactory()
|
||||
class AppManagerCMakePackageStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerCMakePackageStepFactory()
|
||||
{
|
||||
cloneStepCreator(CMakeProjectManager::Constants::CMAKE_BUILD_STEP_ID, Constants::CMAKE_PACKAGE_STEP_ID);
|
||||
setExtraInit([] (BuildStep *step) {
|
||||
// We update the build targets when the active run configuration changes
|
||||
const auto updaterSlot = [step] {
|
||||
const auto targetInformation = TargetInformation(step->target());
|
||||
const TargetInformation targetInformation(step->target());
|
||||
step->setBuildTargets({targetInformation.cmakeBuildTarget});
|
||||
step->setEnabled(!targetInformation.isBuiltin);
|
||||
};
|
||||
@@ -39,9 +42,14 @@ AppManagerCMakePackageStepFactory::AppManagerCMakePackageStepFactory()
|
||||
QObject::connect(step->project(), &Project::displayNameChanged, step, updaterSlot);
|
||||
});
|
||||
|
||||
setDisplayName(tr("Create Appman package with CMake"));
|
||||
setDisplayName(Tr::tr("Create Appman package with CMake"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerCMakePackageStep()
|
||||
{
|
||||
static AppManagerCMakePackageStepFactory theAppManagerCMakePackageStepFactory;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -5,20 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
namespace AppManager::Internal {
|
||||
|
||||
#include <QCoreApplication>
|
||||
void setupAppManagerCMakePackageStep();
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
|
||||
class AppManagerCMakePackageStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Qtc::AppManager)
|
||||
|
||||
public:
|
||||
AppManagerCMakePackageStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagerstringaspect.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
#include "appmanagertr.h"
|
||||
#include "appmanagerutilities.h"
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -21,8 +23,7 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
namespace AppManager::Internal {
|
||||
|
||||
#define SETTINGSPREFIX "ApplicationManagerPlugin.Deploy.CreatePackageStep."
|
||||
|
||||
@@ -31,48 +32,36 @@ const char ArgumentsDefault[] = "create-package --verbose --json";
|
||||
class AppManagerCreatePackageStep final : public AbstractProcessStep
|
||||
{
|
||||
public:
|
||||
AppManagerCreatePackageStep(BuildStepList *bsl, Id id);
|
||||
|
||||
bool init() final;
|
||||
|
||||
private:
|
||||
AppManagerFilePathAspect executable{this};
|
||||
AppManagerStringAspect arguments{this};
|
||||
AppManagerFilePathAspect sourceDirectory{this};
|
||||
AppManagerFilePathAspect buildDirectory{this};
|
||||
AppManagerStringAspect packageFileName{this};
|
||||
};
|
||||
|
||||
AppManagerCreatePackageStep::AppManagerCreatePackageStep(BuildStepList *bsl, Id id)
|
||||
AppManagerCreatePackageStep(BuildStepList *bsl, Id id)
|
||||
: AbstractProcessStep(bsl, id)
|
||||
{
|
||||
setDisplayName(tr("Create Application Manager package"));
|
||||
{
|
||||
setDisplayName(Tr::tr("Create Application Manager package"));
|
||||
|
||||
executable.setSettingsKey(SETTINGSPREFIX "Executable");
|
||||
executable.setHistoryCompleter(SETTINGSPREFIX "Executable.History");
|
||||
executable.setExpectedKind(PathChooser::ExistingCommand);
|
||||
executable.setLabelText(tr("Executable:"));
|
||||
executable.setLabelText(Tr::tr("Executable:"));
|
||||
executable.setPromptDialogFilter(getToolNameByDevice(Constants::APPMAN_PACKAGER));
|
||||
|
||||
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
|
||||
arguments.setHistoryCompleter(SETTINGSPREFIX "Arguments.History");
|
||||
arguments.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
arguments.setLabelText(tr("Arguments:"));
|
||||
arguments.setLabelText(Tr::tr("Arguments:"));
|
||||
|
||||
sourceDirectory.setSettingsKey(SETTINGSPREFIX "SourceDirectory");
|
||||
sourceDirectory.setHistoryCompleter(SETTINGSPREFIX "SourceDirectory.History");
|
||||
sourceDirectory.setExpectedKind(PathChooser::Directory);
|
||||
sourceDirectory.setLabelText(tr("Source directory:"));
|
||||
sourceDirectory.setLabelText(Tr::tr("Source directory:"));
|
||||
|
||||
buildDirectory.setSettingsKey(SETTINGSPREFIX "BuildDirectory");
|
||||
buildDirectory.setHistoryCompleter(SETTINGSPREFIX "BuildDirectory.History");
|
||||
buildDirectory.setExpectedKind(PathChooser::Directory);
|
||||
buildDirectory.setLabelText(tr("Build directory:"));
|
||||
buildDirectory.setLabelText(Tr::tr("Build directory:"));
|
||||
|
||||
packageFileName.setSettingsKey(SETTINGSPREFIX "FileName");
|
||||
packageFileName.setHistoryCompleter(SETTINGSPREFIX "FileName.History");
|
||||
packageFileName.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
packageFileName.setLabelText(tr("Package file name:"));
|
||||
packageFileName.setLabelText(Tr::tr("Package file name:"));
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
const auto targetInformation = TargetInformation(target());
|
||||
@@ -92,10 +81,10 @@ AppManagerCreatePackageStep::AppManagerCreatePackageStep(BuildStepList *bsl, Id
|
||||
connect(target(), &Target::runConfigurationsUpdated, this, updateAspects);
|
||||
connect(project(), &Project::displayNameChanged, this, updateAspects);
|
||||
updateAspects();
|
||||
}
|
||||
}
|
||||
|
||||
bool AppManagerCreatePackageStep::init()
|
||||
{
|
||||
bool init() final
|
||||
{
|
||||
if (!AbstractProcessStep::init())
|
||||
return false;
|
||||
|
||||
@@ -116,16 +105,32 @@ bool AppManagerCreatePackageStep::init()
|
||||
processParameters()->setCommandLine(cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
AppManagerFilePathAspect executable{this};
|
||||
AppManagerStringAspect arguments{this};
|
||||
AppManagerFilePathAspect sourceDirectory{this};
|
||||
AppManagerFilePathAspect buildDirectory{this};
|
||||
AppManagerStringAspect packageFileName{this};
|
||||
};
|
||||
|
||||
// Factory
|
||||
|
||||
AppManagerCreatePackageStepFactory::AppManagerCreatePackageStepFactory()
|
||||
class AppManagerCreatePackageStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerCreatePackageStepFactory()
|
||||
{
|
||||
registerStep<AppManagerCreatePackageStep>(Constants::CREATE_PACKAGE_STEP_ID);
|
||||
setDisplayName(AppManagerCreatePackageStep::tr("Create Application Manager package"));
|
||||
setDisplayName(Tr::tr("Create Application Manager package"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerCreatePackageStep()
|
||||
{
|
||||
static AppManagerCreatePackageStepFactory theAppManagerCreatePackageStepFactory;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -5,16 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
namespace AppManager::Internal {
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
void setupAppManagerCreatePackageStep();
|
||||
|
||||
class AppManagerCreatePackageStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerCreatePackageStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagerstringaspect.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
#include "appmanagertr.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -30,27 +32,25 @@ namespace AppManager::Internal {
|
||||
|
||||
class AppManagerDeployPackageStep : public BuildStep
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(AppManager::Internal::AppManagerDeployPackageStep)
|
||||
|
||||
public:
|
||||
AppManagerDeployPackageStep(BuildStepList *bsl, Id id)
|
||||
: BuildStep(bsl, id)
|
||||
{
|
||||
setDisplayName(tr("Deploy Application Manager package"));
|
||||
setDisplayName(Tr::tr("Deploy Application Manager package"));
|
||||
|
||||
packageFilePath.setSettingsKey(SETTINGSPREFIX "FilePath");
|
||||
packageFilePath.setHistoryCompleter(SETTINGSPREFIX "FilePath.History");
|
||||
packageFilePath.setExpectedKind(PathChooser::File);
|
||||
packageFilePath.setLabelText(tr("Package file path:"));
|
||||
packageFilePath.setLabelText(Tr::tr("Package file path:"));
|
||||
|
||||
targetDirectory.setSettingsKey(SETTINGSPREFIX "TargetDirectory");
|
||||
targetDirectory.setHistoryCompleter(SETTINGSPREFIX "TargetDirectory.History");
|
||||
targetDirectory.setExpectedKind(PathChooser::Directory);
|
||||
targetDirectory.setLabelText(tr("Target directory:"));
|
||||
targetDirectory.setLabelText(Tr::tr("Target directory:"));
|
||||
targetDirectory.setButtonsVisible(false);
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
const auto targetInformation = TargetInformation(target());
|
||||
const TargetInformation targetInformation(target());
|
||||
|
||||
packageFilePath.setPlaceHolderPath(targetInformation.packageFile.absoluteFilePath());
|
||||
targetDirectory.setPlaceHolderPath(targetInformation.runDirectory.absolutePath());
|
||||
@@ -68,8 +68,13 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool init() final { return TargetInformation(target()).isValid(); }
|
||||
GroupItem runRecipe() final {
|
||||
bool init() final
|
||||
{
|
||||
return TargetInformation(target()).isValid();
|
||||
}
|
||||
|
||||
GroupItem runRecipe() final
|
||||
{
|
||||
const auto onSetup = [this](FileStreamer &streamer) {
|
||||
const TargetInformation targetInformation(target());
|
||||
const FilePath source = packageFilePath.valueOrDefault(
|
||||
@@ -84,9 +89,9 @@ private:
|
||||
};
|
||||
const auto onDone = [this](DoneWith result) {
|
||||
if (result == DoneWith::Success)
|
||||
emit addOutput(tr("Uploading finished"), OutputFormat::NormalMessage);
|
||||
emit addOutput(Tr::tr("Uploading finished"), OutputFormat::NormalMessage);
|
||||
else
|
||||
emit addOutput(tr("Uploading failed"), OutputFormat::ErrorMessage);
|
||||
emit addOutput(Tr::tr("Uploading failed"), OutputFormat::ErrorMessage);
|
||||
};
|
||||
return FileStreamerTask(onSetup, onDone);
|
||||
}
|
||||
@@ -97,11 +102,20 @@ private:
|
||||
|
||||
// Factory
|
||||
|
||||
AppManagerDeployPackageStepFactory::AppManagerDeployPackageStepFactory()
|
||||
class AppManagerDeployPackageStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerDeployPackageStepFactory()
|
||||
{
|
||||
registerStep<AppManagerDeployPackageStep>(Constants::DEPLOY_PACKAGE_STEP_ID);
|
||||
setDisplayName(AppManagerDeployPackageStep::tr("Deploy Application Manager package"));
|
||||
setDisplayName(Tr::tr("Deploy Application Manager package"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerDeployPackageStep()
|
||||
{
|
||||
static AppManagerDeployPackageStepFactory theAppManagerDeployPackageStepFactory;
|
||||
}
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
|
||||
@@ -5,14 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace AppManager::Internal {
|
||||
|
||||
class AppManagerDeployPackageStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerDeployPackageStepFactory();
|
||||
};
|
||||
void setupAppManagerDeployPackageStep();
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#include "appmanagerstringaspect.h"
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
#include "appmanagertr.h"
|
||||
#include "appmanagerutilities.h"
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -46,26 +48,26 @@ private:
|
||||
AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, Id id)
|
||||
: AbstractProcessStep(bsl, id)
|
||||
{
|
||||
setDisplayName(tr("Install Application Manager package"));
|
||||
setDisplayName(Tr::tr("Install Application Manager package"));
|
||||
|
||||
executable.setSettingsKey(SETTINGSPREFIX "Executable");
|
||||
executable.setHistoryCompleter(SETTINGSPREFIX "Executable.History");
|
||||
executable.setLabelText(tr("Executable:"));
|
||||
executable.setLabelText(Tr::tr("Executable:"));
|
||||
|
||||
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
|
||||
arguments.setHistoryCompleter(SETTINGSPREFIX "Arguments.History");
|
||||
arguments.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
arguments.setLabelText(tr("Arguments:"));
|
||||
arguments.setLabelText(Tr::tr("Arguments:"));
|
||||
|
||||
packageFileName.setSettingsKey(SETTINGSPREFIX "FileName");
|
||||
packageFileName.setHistoryCompleter(SETTINGSPREFIX "FileName.History");
|
||||
packageFileName.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
packageFileName.setLabelText(tr("File name:"));
|
||||
packageFileName.setLabelText(Tr::tr("File name:"));
|
||||
|
||||
packageDirectory.setSettingsKey(SETTINGSPREFIX "Directory");
|
||||
packageDirectory.setHistoryCompleter(SETTINGSPREFIX "Directory.History");
|
||||
packageDirectory.setExpectedKind(PathChooser::Directory);
|
||||
packageDirectory.setLabelText(tr("Directory:"));
|
||||
packageDirectory.setLabelText(Tr::tr("Directory:"));
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
const TargetInformation targetInformation(target());
|
||||
@@ -77,8 +79,8 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
|
||||
arguments.setPlaceHolderText(ArgumentsDefault);
|
||||
packageFileName.setPlaceHolderText(targetInformation.packageFile.fileName());
|
||||
auto device = DeviceKitAspect::device(target()->kit());
|
||||
auto remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
auto packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
bool remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
QDir packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
packageDirectory.setPlaceHolderPath(packageDirectoryPath.absolutePath());
|
||||
packageDirectory.setButtonsVisible(!targetInformation.remote);
|
||||
|
||||
@@ -106,8 +108,8 @@ bool AppManagerInstallPackageStep::init()
|
||||
const QString controllerArguments = arguments.valueOrDefault(ArgumentsDefault);
|
||||
const QString packageFile = packageFileName.valueOrDefault(targetInformation.packageFile.fileName());
|
||||
auto device = DeviceKitAspect::device(target()->kit());
|
||||
auto remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
auto packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
bool remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
QDir packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
const FilePath packageDir = packageDirectory.valueOrDefault(packageDirectoryPath.absolutePath());
|
||||
|
||||
CommandLine cmd(targetInformation.device->filePath(controller.path()));
|
||||
@@ -121,11 +123,20 @@ bool AppManagerInstallPackageStep::init()
|
||||
|
||||
// Factory
|
||||
|
||||
AppManagerInstallPackageStepFactory::AppManagerInstallPackageStepFactory()
|
||||
class AppManagerInstallPackageStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerInstallPackageStepFactory()
|
||||
{
|
||||
registerStep<AppManagerInstallPackageStep>(Constants::INSTALL_PACKAGE_STEP_ID);
|
||||
setDisplayName(AppManagerInstallPackageStep::tr("Install Application Manager package"));
|
||||
setDisplayName(Tr::tr("Install Application Manager package"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerInstallPackageStep()
|
||||
{
|
||||
static AppManagerInstallPackageStepFactory theAppManagerInstallPackageStepFactory;
|
||||
}
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
|
||||
@@ -5,14 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace AppManager::Internal {
|
||||
|
||||
class AppManagerInstallPackageStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerInstallPackageStepFactory();
|
||||
};
|
||||
void setupAppManagerInstallPackageStep();
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
|
||||
#include <projectexplorer/makestep.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -15,15 +16,12 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
namespace AppManager::Internal {
|
||||
|
||||
class AppManagerMakeInstallStep final : public ProjectExplorer::MakeStep
|
||||
class AppManagerMakeInstallStep final : public MakeStep
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(AppManager::Internal::AppManagerMakeInstallStep)
|
||||
|
||||
public:
|
||||
AppManagerMakeInstallStep(BuildStepList *bsl, Utils::Id id)
|
||||
AppManagerMakeInstallStep(BuildStepList *bsl, Id id)
|
||||
: MakeStep(bsl, id)
|
||||
{
|
||||
setSelectedBuildTarget("install");
|
||||
@@ -34,16 +32,16 @@ public:
|
||||
if (!MakeStep::init())
|
||||
return false;
|
||||
|
||||
const auto targetInformation = TargetInformation(target());
|
||||
const TargetInformation targetInformation(target());
|
||||
if (!targetInformation.isValid())
|
||||
return false;
|
||||
|
||||
const auto buildDirectoryPath = targetInformation.buildDirectory.absolutePath();
|
||||
const QString buildDirectoryPath = targetInformation.buildDirectory.absolutePath();
|
||||
if (buildDirectoryPath.isEmpty())
|
||||
return false;
|
||||
|
||||
const auto buildDirectoryPathQuoted = ProcessArgs::quoteArg(QDir::toNativeSeparators(buildDirectoryPath));
|
||||
const auto installRoot = QString("INSTALL_ROOT=%1").arg(buildDirectoryPathQuoted);
|
||||
const QString buildDirectoryPathQuoted = ProcessArgs::quoteArg(QDir::toNativeSeparators(buildDirectoryPath));
|
||||
const QString installRoot = QString("INSTALL_ROOT=%1").arg(buildDirectoryPathQuoted);
|
||||
|
||||
processParameters()->setWorkingDirectory(FilePath::fromString(buildDirectoryPath));
|
||||
|
||||
@@ -55,14 +53,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Factory
|
||||
|
||||
AppManagerMakeInstallStepFactory::AppManagerMakeInstallStepFactory()
|
||||
class AppManagerMakeInstallStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerMakeInstallStepFactory()
|
||||
{
|
||||
registerStep<AppManagerMakeInstallStep>(Constants::MAKE_INSTALL_STEP_ID);
|
||||
setDisplayName(AppManagerMakeInstallStep::tr("Make install"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerMakeInstallStep()
|
||||
{
|
||||
static AppManagerMakeInstallStepFactory theAppManagerMakeInstallStepFactory;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -5,16 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/makestep.h>
|
||||
namespace AppManager::Internal {
|
||||
|
||||
namespace AppManager {
|
||||
namespace Internal {
|
||||
void setupAppManagerMakeInstallStep();
|
||||
|
||||
class AppManagerMakeInstallStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerMakeInstallStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AppManager
|
||||
} // AppManager::Internal
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "appmanagerplugin.h"
|
||||
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagercreatepackagestep.h"
|
||||
#include "appmanagerdeployconfigurationautoswitcher.h"
|
||||
#include "appmanagerdeployconfigurationfactory.h"
|
||||
@@ -74,13 +73,6 @@ void cloneAutodetectedBoot2QtKits()
|
||||
class AppManagerPluginPrivate
|
||||
{
|
||||
public:
|
||||
AppManagerCMakePackageStepFactory cmakePackageStepFactory;
|
||||
AppManagerMakeInstallStepFactory makeInstallStepFactory;
|
||||
AppManagerCreatePackageStepFactory createPackageStepFactory;
|
||||
AppManagerDeployPackageStepFactory deployPackageStepFactory;
|
||||
AppManagerInstallPackageStepFactory installPackageStepFactory;
|
||||
AppManagerRemoteInstallPackageStepFactory remoteInstallPackageStepFactory;
|
||||
|
||||
AppManagerDeployConfigurationAutoSwitcher deployConfigurationAutoSwitcher;
|
||||
AppManagerDeployConfigurationFactory deployConfigFactory;
|
||||
|
||||
@@ -96,6 +88,13 @@ AppManagerPlugin::~AppManagerPlugin()
|
||||
|
||||
void AppManagerPlugin::initialize()
|
||||
{
|
||||
setupAppManagerCMakePackageStep();
|
||||
setupAppManagerMakeInstallStep();
|
||||
setupAppManagerCreatePackageStep();
|
||||
setupAppManagerDeployPackageStep();
|
||||
setupAppManagerInstallPackageStep();
|
||||
setupAppManagerRemoteInstallPackageStep();
|
||||
|
||||
d = new AppManagerPluginPrivate;
|
||||
d->deployConfigurationAutoSwitcher.initialize();
|
||||
|
||||
|
||||
@@ -8,16 +8,19 @@
|
||||
#include "appmanagerstringaspect.h"
|
||||
#include "appmanagerconstants.h"
|
||||
#include "appmanagertargetinformation.h"
|
||||
#include "appmanagertr.h"
|
||||
#include "appmanagerutilities.h"
|
||||
|
||||
#include <remotelinux/abstractremotelinuxdeploystep.h>
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <utils/process.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -83,8 +86,8 @@ AppManagerRemoteInstallPackageStep::AppManagerRemoteInstallPackageStep(BuildStep
|
||||
arguments.setPlaceHolderText(ArgumentsDefault);
|
||||
packageFileName.setPlaceHolderText(targetInformation.packageFile.fileName());
|
||||
auto device = DeviceKitAspect::device(target()->kit());
|
||||
auto remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
auto packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
bool remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
QDir packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
packageDirectory.setPlaceHolderPath(packageDirectoryPath.absolutePath());
|
||||
packageDirectory.setButtonsVisible(!targetInformation.remote);
|
||||
|
||||
@@ -107,8 +110,8 @@ GroupItem AppManagerRemoteInstallPackageStep::deployRecipe()
|
||||
const QString controllerArguments = arguments.valueOrDefault(ArgumentsDefault);
|
||||
const QString packageFile = packageFileName.valueOrDefault(targetInformation.packageFile.fileName());
|
||||
auto device = DeviceKitAspect::device(target()->kit());
|
||||
auto remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
auto packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
bool remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
QDir packageDirectoryPath = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : targetInformation.packageFile.absolutePath();
|
||||
const FilePath packageDir = packageDirectory.valueOrDefault(packageDirectoryPath.absolutePath());
|
||||
|
||||
const auto setupHandler = [=](Process &process) {
|
||||
@@ -120,7 +123,7 @@ GroupItem AppManagerRemoteInstallPackageStep::deployRecipe()
|
||||
cmd.addArg("-c");
|
||||
cmd.addCommandLineAsSingleArg(remoteCmd);
|
||||
|
||||
addProgressMessage(tr("Starting remote command \"%1\"...").arg(cmd.toUserOutput()));
|
||||
addProgressMessage(Tr::tr("Starting remote command \"%1\"...").arg(cmd.toUserOutput()));
|
||||
process.setCommand(cmd);
|
||||
Process *proc = &process;
|
||||
connect(proc, &Process::readyReadStandardOutput, this, [this, proc] {
|
||||
@@ -136,9 +139,9 @@ GroupItem AppManagerRemoteInstallPackageStep::deployRecipe()
|
||||
} else {
|
||||
if (process.error() != QProcess::UnknownError
|
||||
|| process.exitStatus() != QProcess::NormalExit) {
|
||||
addErrorMessage(tr("Remote process failed: %1").arg(process.errorString()));
|
||||
addErrorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
|
||||
} else if (process.exitCode() != 0) {
|
||||
addErrorMessage(tr("Remote process finished with exit code %1.")
|
||||
addErrorMessage(Tr::tr("Remote process finished with exit code %1.")
|
||||
.arg(process.exitCode()));
|
||||
}
|
||||
}
|
||||
@@ -149,11 +152,20 @@ GroupItem AppManagerRemoteInstallPackageStep::deployRecipe()
|
||||
|
||||
// Factory
|
||||
|
||||
AppManagerRemoteInstallPackageStepFactory::AppManagerRemoteInstallPackageStepFactory()
|
||||
class AppManagerRemoteInstallPackageStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerRemoteInstallPackageStepFactory()
|
||||
{
|
||||
registerStep<AppManagerRemoteInstallPackageStep>(Constants::REMOTE_INSTALL_PACKAGE_STEP_ID);
|
||||
setDisplayName(AppManagerRemoteInstallPackageStep::tr("Remote Install Application Manager package"));
|
||||
setDisplayName(Tr::tr("Remote Install Application Manager package"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerRemoteInstallPackageStep()
|
||||
{
|
||||
static AppManagerRemoteInstallPackageStepFactory theAppManagerRemoteInstallPackageStepFactory;
|
||||
}
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
|
||||
@@ -5,14 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace AppManager::Internal {
|
||||
|
||||
class AppManagerRemoteInstallPackageStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AppManagerRemoteInstallPackageStepFactory();
|
||||
};
|
||||
void setupAppManagerRemoteInstallPackageStep();
|
||||
|
||||
} // namespace AppManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user