forked from qt-creator/qt-creator
AppMan: Allow the user to change the deploy steps
Change-Id: I972967c5b6f00712c687cc687f89f277be9d97da Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -39,8 +40,13 @@ public:
|
||||
setDisplayName(Tr::tr("Create Application Manager package"));
|
||||
|
||||
packager.setSettingsKey(SETTINGSPREFIX "Executable");
|
||||
packager.setDefaultValue(getToolFilePath(Constants::APPMAN_PACKAGER,
|
||||
kit(),
|
||||
DeviceKitAspect::device(kit())));
|
||||
|
||||
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
|
||||
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
|
||||
arguments.resetArguments();
|
||||
|
||||
sourceDirectory.setSettingsKey(SETTINGSPREFIX "SourceDirectory");
|
||||
sourceDirectory.setLabelText(Tr::tr("Source directory:"));
|
||||
@@ -49,30 +55,6 @@ public:
|
||||
packageFile.setSettingsKey(SETTINGSPREFIX "FileName");
|
||||
packageFile.setLabelText(Tr::tr("Package file:"));
|
||||
packageFile.setExpectedKind(Utils::PathChooser::SaveFile);
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
const auto targetInformation = TargetInformation(target());
|
||||
|
||||
packager.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_PACKAGER,
|
||||
target()->kit(),
|
||||
targetInformation.device)));
|
||||
packager.setDefaultValue(packager.value());
|
||||
arguments.setArguments(ArgumentsDefault);
|
||||
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
|
||||
|
||||
packageFile.setValue(targetInformation.packageFile.absoluteFilePath());
|
||||
packageFile.setDefaultValue(packageFile.value());
|
||||
|
||||
sourceDirectory.setValue(targetInformation.packageSourcesDirectory.absolutePath());
|
||||
sourceDirectory.setDefaultValue(sourceDirectory.value());
|
||||
};
|
||||
|
||||
connect(target(), &Target::activeRunConfigurationChanged, this, updateAspects);
|
||||
connect(target(), &Target::activeDeployConfigurationChanged, this, updateAspects);
|
||||
connect(target(), &Target::parsingFinished, this, updateAspects);
|
||||
connect(target(), &Target::runConfigurationsUpdated, this, updateAspects);
|
||||
connect(project(), &Project::displayNameChanged, this, updateAspects);
|
||||
updateAspects();
|
||||
}
|
||||
|
||||
bool init() final
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
AppManagerDeployConfigurationFactory()
|
||||
{
|
||||
setConfigBaseId(Constants::DEPLOYCONFIGURATION_ID);
|
||||
setDefaultDisplayName(Tr::tr("Deploy Application Manager Package"));
|
||||
setDefaultDisplayName(Tr::tr("Automatic AppMan Deploy Configuration"));
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
|
||||
|
@@ -40,11 +40,16 @@ public:
|
||||
|
||||
packageFilePath.setSettingsKey(SETTINGSPREFIX "FilePath");
|
||||
packageFilePath.setLabelText(Tr::tr("Package file:"));
|
||||
packageFilePath.setEnabler(&customizeStep);
|
||||
|
||||
targetDirectory.setSettingsKey(SETTINGSPREFIX "TargetDirectory");
|
||||
targetDirectory.setLabelText(Tr::tr("Target directory:"));
|
||||
targetDirectory.setEnabler(&customizeStep);
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
if (customizeStep.value())
|
||||
return;
|
||||
|
||||
const TargetInformation targetInformation(target());
|
||||
|
||||
packageFilePath.setValue(targetInformation.packageFile.absoluteFilePath());
|
||||
@@ -61,6 +66,7 @@ public:
|
||||
connect(target(), &Target::parsingFinished, this, updateAspects);
|
||||
connect(target(), &Target::runConfigurationsUpdated, this, updateAspects);
|
||||
connect(project(), &Project::displayNameChanged, this, updateAspects);
|
||||
connect(&customizeStep, &BaseAspect::changed, this, updateAspects);
|
||||
|
||||
updateAspects();
|
||||
}
|
||||
@@ -96,6 +102,7 @@ private:
|
||||
return FileStreamerTask(onSetup, onDone);
|
||||
}
|
||||
|
||||
AppManagerCustomizeAspect customizeStep{this};
|
||||
FilePathAspect packageFilePath{this};
|
||||
FilePathAspect targetDirectory{this};
|
||||
};
|
||||
|
@@ -27,7 +27,7 @@ namespace AppManager::Internal {
|
||||
|
||||
#define SETTINGSPREFIX "ApplicationManagerPlugin.Deploy.InstallPackageStep."
|
||||
|
||||
const char ArgumentsDefault[] = "install-package -a";
|
||||
const char ArgumentsDefault[] = "install-package --acknowledge";
|
||||
|
||||
class AppManagerInstallPackageStep final : public AbstractProcessStep
|
||||
{
|
||||
@@ -38,6 +38,7 @@ protected:
|
||||
bool init() final;
|
||||
|
||||
private:
|
||||
AppManagerCustomizeAspect customizeStep{this};
|
||||
AppManagerControllerAspect controller{this};
|
||||
ProjectExplorer::ArgumentsAspect arguments{this};
|
||||
FilePathAspect packageFile{this};
|
||||
@@ -48,22 +49,25 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
|
||||
{
|
||||
setDisplayName(Tr::tr("Install Application Manager package"));
|
||||
|
||||
controller.setDefaultValue(getToolFilePath(Constants::APPMAN_CONTROLLER,
|
||||
kit(),
|
||||
DeviceKitAspect::device(kit())));
|
||||
|
||||
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
|
||||
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
|
||||
arguments.resetArguments();
|
||||
|
||||
packageFile.setSettingsKey(SETTINGSPREFIX "FileName");
|
||||
packageFile.setLabelText(Tr::tr("Package file:"));
|
||||
packageFile.setEnabler(&customizeStep);
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
if (customizeStep.value())
|
||||
return;
|
||||
|
||||
const TargetInformation targetInformation(target());
|
||||
|
||||
controller.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_CONTROLLER,
|
||||
target()->kit(),
|
||||
targetInformation.device)));
|
||||
controller.setDefaultValue(controller.value());
|
||||
arguments.setArguments(ArgumentsDefault);
|
||||
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
|
||||
|
||||
packageFile.setValue(targetInformation.packageFile.absoluteFilePath());
|
||||
packageFile.setDefaultValue(targetInformation.packageFile.absoluteFilePath());
|
||||
|
||||
setEnabled(!targetInformation.isBuiltin);
|
||||
};
|
||||
@@ -73,6 +77,7 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
|
||||
connect(target(), &Target::parsingFinished, this, updateAspects);
|
||||
connect(target(), &Target::runConfigurationsUpdated, this, updateAspects);
|
||||
connect(project(), &Project::displayNameChanged, this, updateAspects);
|
||||
connect(&customizeStep, &BaseAspect::changed, this, updateAspects);
|
||||
updateAspects();
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ namespace AppManager::Internal {
|
||||
|
||||
#define SETTINGSPREFIX "ApplicationManagerPlugin.Deploy.RemoteInstallPackageStep."
|
||||
|
||||
const char ArgumentsDefault[] = "install-package -a";
|
||||
const char ArgumentsDefault[] = "install-package --acknowledge";
|
||||
|
||||
class AppManagerRemoteInstallPackageStep final : public RemoteLinux::AbstractRemoteLinuxDeployStep
|
||||
{
|
||||
@@ -43,6 +43,7 @@ private:
|
||||
GroupItem deployRecipe() final;
|
||||
|
||||
private:
|
||||
AppManagerCustomizeAspect customizeStep{this};
|
||||
AppManagerControllerAspect controller{this};
|
||||
ProjectExplorer::ArgumentsAspect arguments{this};
|
||||
FilePathAspect packageFile{this};
|
||||
@@ -53,25 +54,30 @@ AppManagerRemoteInstallPackageStep::AppManagerRemoteInstallPackageStep(BuildStep
|
||||
{
|
||||
setDisplayName(tr("Remote Install Application Manager package"));
|
||||
|
||||
controller.setDefaultValue(getToolFilePath(Constants::APPMAN_CONTROLLER,
|
||||
target()->kit(),
|
||||
DeviceKitAspect::device(target()->kit())));
|
||||
|
||||
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
|
||||
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
|
||||
arguments.resetArguments();
|
||||
|
||||
packageFile.setSettingsKey(SETTINGSPREFIX "FileName");
|
||||
packageFile.setLabelText(Tr::tr("Package file:"));
|
||||
packageFile.setEnabler(&customizeStep);
|
||||
|
||||
setInternalInitializer([this] { return isDeploymentPossible(); });
|
||||
|
||||
const auto updateAspects = [this] {
|
||||
if (customizeStep.value())
|
||||
return;
|
||||
|
||||
const TargetInformation targetInformation(target());
|
||||
|
||||
controller.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_CONTROLLER,
|
||||
target()->kit(),
|
||||
targetInformation.device)));
|
||||
controller.setDefaultValue(controller.value());
|
||||
arguments.setArguments(ArgumentsDefault);
|
||||
arguments.setResetter([](){ return QLatin1String(ArgumentsDefault); });
|
||||
const QString packageFilePath =
|
||||
targetInformation.runDirectory.absoluteFilePath(targetInformation.packageFile.fileName());
|
||||
|
||||
packageFile.setValue(targetInformation.packageFile.absoluteFilePath());
|
||||
packageFile.setDefaultValue(packageFile.value());
|
||||
packageFile.setDefaultValue(packageFilePath);
|
||||
|
||||
setEnabled(!targetInformation.isBuiltin);
|
||||
};
|
||||
@@ -81,6 +87,7 @@ AppManagerRemoteInstallPackageStep::AppManagerRemoteInstallPackageStep(BuildStep
|
||||
connect(target(), &Target::parsingFinished, this, updateAspects);
|
||||
connect(target(), &Target::runConfigurationsUpdated, this, updateAspects);
|
||||
connect(project(), &Project::displayNameChanged, this, updateAspects);
|
||||
connect(&customizeStep, &BaseAspect::changed, this, updateAspects);
|
||||
updateAspects();
|
||||
}
|
||||
|
||||
|
@@ -55,6 +55,15 @@ AppManagerDocumentUrlAspect::AppManagerDocumentUrlAspect(Utils::AspectContainer
|
||||
setLabelText(Tr::tr("Document url:"));
|
||||
}
|
||||
|
||||
AppManagerCustomizeAspect::AppManagerCustomizeAspect(Utils::AspectContainer *container)
|
||||
: BoolAspect(container)
|
||||
{
|
||||
setSettingsKey("ApplicationManagerPlugin.CustomizeStep");
|
||||
setLabelText(Tr::tr("Customize Step"));
|
||||
setToolTip(Tr::tr("Disables the automatic updates based on the current run configuration and "
|
||||
"allows customizing the values"));
|
||||
}
|
||||
|
||||
AppManagerControllerAspect::AppManagerControllerAspect(Utils::AspectContainer *container)
|
||||
: FilePathAspect(container)
|
||||
{
|
||||
|
@@ -43,6 +43,16 @@ public:
|
||||
~AppManagerDocumentUrlAspect() final = default;
|
||||
};
|
||||
|
||||
class AppManagerCustomizeAspect final : public Utils::BoolAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AppManagerCustomizeAspect(Utils::AspectContainer *container = nullptr);
|
||||
|
||||
~AppManagerCustomizeAspect() final = default;
|
||||
};
|
||||
|
||||
class AppManagerControllerAspect final : public Utils::FilePathAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user