forked from qt-creator/qt-creator
RemoteLinux: Simplify AbstractPackaging and derived step
Change-Id: I1a9fc0947fcca358ce3e8ca24c6430bc973f131f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -42,7 +42,6 @@ namespace Internal {
|
|||||||
class AbstractPackagingStepPrivate
|
class AbstractPackagingStepPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BuildConfiguration *currentBuildConfiguration = nullptr;
|
|
||||||
QString cachedPackageFilePath;
|
QString cachedPackageFilePath;
|
||||||
QString cachedPackageDirectory;
|
QString cachedPackageDirectory;
|
||||||
bool deploymentDataModified = false;
|
bool deploymentDataModified = false;
|
||||||
@@ -54,9 +53,6 @@ AbstractPackagingStep::AbstractPackagingStep(BuildStepList *bsl, Core::Id id)
|
|||||||
: BuildStep(bsl, id)
|
: BuildStep(bsl, id)
|
||||||
{
|
{
|
||||||
d = new Internal::AbstractPackagingStepPrivate;
|
d = new Internal::AbstractPackagingStepPrivate;
|
||||||
connect(target(), &Target::activeBuildConfigurationChanged,
|
|
||||||
this, &AbstractPackagingStep::handleBuildConfigurationChanged);
|
|
||||||
handleBuildConfigurationChanged();
|
|
||||||
|
|
||||||
connect(target(), &Target::deploymentDataChanged,
|
connect(target(), &Target::deploymentDataChanged,
|
||||||
this, &AbstractPackagingStep::setDeploymentDataModified);
|
this, &AbstractPackagingStep::setDeploymentDataModified);
|
||||||
@@ -71,18 +67,6 @@ AbstractPackagingStep::~AbstractPackagingStep()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractPackagingStep::handleBuildConfigurationChanged()
|
|
||||||
{
|
|
||||||
if (d->currentBuildConfiguration)
|
|
||||||
disconnect(d->currentBuildConfiguration, nullptr, this, nullptr);
|
|
||||||
d->currentBuildConfiguration = buildConfiguration();
|
|
||||||
if (d->currentBuildConfiguration) {
|
|
||||||
connect(d->currentBuildConfiguration, &BuildConfiguration::buildDirectoryChanged,
|
|
||||||
this, &AbstractPackagingStep::packageFilePathChanged);
|
|
||||||
}
|
|
||||||
emit packageFilePathChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AbstractPackagingStep::cachedPackageFilePath() const
|
QString AbstractPackagingStep::cachedPackageFilePath() const
|
||||||
{
|
{
|
||||||
return d->cachedPackageFilePath;
|
return d->cachedPackageFilePath;
|
||||||
@@ -102,8 +86,7 @@ QString AbstractPackagingStep::cachedPackageDirectory() const
|
|||||||
|
|
||||||
QString AbstractPackagingStep::packageDirectory() const
|
QString AbstractPackagingStep::packageDirectory() const
|
||||||
{
|
{
|
||||||
return d->currentBuildConfiguration
|
return buildConfiguration()->buildDirectory().toString();
|
||||||
? d->currentBuildConfiguration->buildDirectory().toString() : QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractPackagingStep::isPackagingNeeded() const
|
bool AbstractPackagingStep::isPackagingNeeded() const
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
bool init() override;
|
bool init() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void packageFilePathChanged();
|
|
||||||
void unmodifyDeploymentData();
|
void unmodifyDeploymentData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -61,7 +60,6 @@ protected:
|
|||||||
virtual bool isPackagingNeeded() const;
|
virtual bool isPackagingNeeded() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBuildConfigurationChanged();
|
|
||||||
void setDeploymentDataUnmodified();
|
void setDeploymentDataUnmodified();
|
||||||
void setDeploymentDataModified();
|
void setDeploymentDataModified();
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,14 @@ TarPackageCreationStep::TarPackageCreationStep(BuildStepList *bsl)
|
|||||||
m_incrementalDeploymentAspect = addAspect<BaseBoolAspect>();
|
m_incrementalDeploymentAspect = addAspect<BaseBoolAspect>();
|
||||||
m_incrementalDeploymentAspect->setLabel(tr("Package modified files only"));
|
m_incrementalDeploymentAspect->setLabel(tr("Package modified files only"));
|
||||||
m_incrementalDeploymentAspect->setSettingsKey(IncrementalDeploymentKey);
|
m_incrementalDeploymentAspect->setSettingsKey(IncrementalDeploymentKey);
|
||||||
|
|
||||||
|
setSummaryUpdater([this] {
|
||||||
|
QString path = packageFilePath();
|
||||||
|
if (path.isEmpty())
|
||||||
|
return QString("<font color=\"red\">" + tr("Tarball creation not possible.")
|
||||||
|
+ "</font>");
|
||||||
|
return QString("<b>" + tr("Create tarball:") + "</b> " + path);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TarPackageCreationStep::init()
|
bool TarPackageCreationStep::init()
|
||||||
@@ -344,29 +352,6 @@ bool TarPackageCreationStep::runImpl()
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepConfigWidget *TarPackageCreationStep::createConfigWidget()
|
|
||||||
{
|
|
||||||
auto widget = BuildStep::createConfigWidget();
|
|
||||||
|
|
||||||
auto updateSummary = [this, widget] {
|
|
||||||
QString path = packageFilePath();
|
|
||||||
if (path.isEmpty()) {
|
|
||||||
widget->setSummaryText("<font color=\"red\">"
|
|
||||||
+ tr("Tarball creation not possible.")
|
|
||||||
+ "</font>");
|
|
||||||
} else {
|
|
||||||
widget->setSummaryText("<b>" + tr("Create tarball:") + "</b> " + path);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
connect(this, &AbstractPackagingStep::packageFilePathChanged,
|
|
||||||
this, updateSummary);
|
|
||||||
|
|
||||||
updateSummary();
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TarPackageCreationStep::fromMap(const QVariantMap &map)
|
bool TarPackageCreationStep::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!AbstractPackagingStep::fromMap(map))
|
if (!AbstractPackagingStep::fromMap(map))
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ private:
|
|||||||
void addNeededDeploymentFiles(const ProjectExplorer::DeployableFile &deployable,
|
void addNeededDeploymentFiles(const ProjectExplorer::DeployableFile &deployable,
|
||||||
const ProjectExplorer::Kit *kit);
|
const ProjectExplorer::Kit *kit);
|
||||||
|
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user