Add Deploy steps

* Add "Deploy" to BuildSteps::Type
 * Update UIs to handle deploy steps
 * Turn existing package creation steps from build type to deploy type
 * Move packaging steps into deploy steps when loading projects

Reviewed-by: dt
This commit is contained in:
Tobias Hunger
2010-07-06 17:56:01 +02:00
parent 1062c0ad8c
commit 54584044ca
8 changed files with 131 additions and 12 deletions

View File

@@ -413,8 +413,11 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps)
void BuildManager::buildProjects(const QList<BuildConfiguration *> &configurations) void BuildManager::buildProjects(const QList<BuildConfiguration *> &configurations)
{ {
QList<BuildStep *> steps; QList<BuildStep *> steps;
foreach(BuildConfiguration *bc, configurations) foreach(BuildConfiguration *bc, configurations) {
steps.append(bc->steps(BuildStep::Build)); steps.append(bc->steps(BuildStep::Build));
// TODO: Verify that this is indeed what we want.
steps.append(bc->steps(BuildStep::Deploy));
}
bool success = buildQueueAppend(steps); bool success = buildQueueAppend(steps);
if (!success) { if (!success) {

View File

@@ -250,6 +250,7 @@ void BuildSettingsWidget::updateBuildSettings()
addSubWidget(generalConfigWidget->displayName(), generalConfigWidget); addSubWidget(generalConfigWidget->displayName(), generalConfigWidget);
addSubWidget(tr("Build Steps"), new BuildStepsPage(m_target, BuildStep::Build)); addSubWidget(tr("Build Steps"), new BuildStepsPage(m_target, BuildStep::Build));
addSubWidget(tr("Deploy Steps"), new BuildStepsPage(m_target, BuildStep::Deploy));
addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_target, BuildStep::Clean)); addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_target, BuildStep::Clean));
QList<BuildConfigWidget *> subConfigWidgets = m_target->project()->subConfigWidgets(); QList<BuildConfigWidget *> subConfigWidgets = m_target->project()->subConfigWidgets();

View File

@@ -75,6 +75,7 @@ public:
enum Type { enum Type {
Build = 0, Build = 0,
Clean, Clean,
Deploy,
LastStepType LastStepType
}; };
Q_ENUMS(Type) Q_ENUMS(Type)

View File

@@ -83,10 +83,16 @@ void BuildStepsPage::updateSummary()
QString BuildStepsPage::displayName() const QString BuildStepsPage::displayName() const
{ {
if (m_type == BuildStep::Build) switch(m_type) {
case BuildStep::Build:
return tr("Build Steps"); return tr("Build Steps");
else case BuildStep::Deploy:
return tr("Deploy Steps");
case BuildStep::Clean:
return tr("Clean Steps"); return tr("Clean Steps");
default:
return tr("Unknown Steps");
}
} }
void BuildStepsPage::init(BuildConfiguration *bc) void BuildStepsPage::init(BuildConfiguration *bc)
@@ -295,7 +301,19 @@ void BuildStepsPage::setupUi()
QHBoxLayout *hboxLayout = new QHBoxLayout(); QHBoxLayout *hboxLayout = new QHBoxLayout();
hboxLayout->setContentsMargins(0, 4, 0, 0); hboxLayout->setContentsMargins(0, 4, 0, 0);
m_addButton = new QPushButton(this); m_addButton = new QPushButton(this);
m_addButton->setText(m_type == BuildStep::Clean ? tr("Add Clean Step") : tr("Add Build Step")); switch (m_type) {
case BuildStep::Clean:
m_addButton->setText(tr("Add Clean Step"));
break;
case BuildStep::Build:
m_addButton->setText(tr("Add Build Step"));
break;
case BuildStep::Deploy:
m_addButton->setText(tr("Add Deploy Step"));
break;
default:
m_addButton->setText(tr("Add Step"));
}
m_addButton->setMenu(new QMenu(this)); m_addButton->setMenu(new QMenu(this));
hboxLayout->addWidget(m_addButton); hboxLayout->addWidget(m_addButton);

View File

@@ -148,6 +148,23 @@ public:
QVariantMap update(Project *project, const QVariantMap &map); QVariantMap update(Project *project, const QVariantMap &map);
}; };
// Version 4 reflects the introduction of deploy steps
class Version4Handler : public UserFileVersionHandler
{
public:
int userFileVersion() const
{
return 4;
}
QString displayUserFileVersion() const
{
return QLatin1String("2.2pre1");
}
QVariantMap update(Project *project, const QVariantMap &map);
};
// //
// Helper functions: // Helper functions:
// //
@@ -218,6 +235,7 @@ UserFileAccessor::UserFileAccessor() :
addVersionHandler(new Version1Handler); addVersionHandler(new Version1Handler);
addVersionHandler(new Version2Handler); addVersionHandler(new Version2Handler);
addVersionHandler(new Version3Handler); addVersionHandler(new Version3Handler);
addVersionHandler(new Version4Handler);
} }
UserFileAccessor::~UserFileAccessor() UserFileAccessor::~UserFileAccessor()
@@ -1010,3 +1028,78 @@ QVariantMap Version3Handler::update(Project *, const QVariantMap &map)
} }
return result; return result;
} }
// -------------------------------------------------------------------------
// Version4Handler
// -------------------------------------------------------------------------
// Move packaging steps from build steps into deploy steps
QVariantMap Version4Handler::update(Project *, const QVariantMap &map)
{
QVariantMap result;
QMapIterator<QString, QVariant> it(map);
while (it.hasNext()) {
it.next();
const QString &globalKey = it.key();
// check for target info
if (!globalKey.startsWith(QLatin1String("ProjectExplorer.Project.Target."))) {
result.insert(globalKey, it.value());
continue;
}
const QVariantMap &originalTarget = it.value().toMap();
// check for symbian and maemo device target
if (originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
!= QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget")
&& originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
!= QLatin1String("Qt4ProjectManager.Target.MaemoDeviceTarget"))
{
result.insert(globalKey, originalTarget);
continue;
}
QVariantMap newTarget;
QMapIterator<QString, QVariant> targetIt(originalTarget);
while (targetIt.hasNext()) {
targetIt.next();
const QString &targetKey = targetIt.key();
if (!targetKey.startsWith(QLatin1String("ProjectExplorer.Target.BuildConfiguration."))) {
newTarget.insert(targetKey, targetIt.value());
continue;
}
bool movedBs = false;
const QVariantMap &originalBc = targetIt.value().toMap();
QVariantMap newBc;
QMapIterator<QString, QVariant> bcIt(originalBc);
while(bcIt.hasNext()) {
bcIt.next();
const QString &bcKey = bcIt.key();
if (!bcKey.startsWith(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStep."))) {
newBc.insert(bcKey, bcIt.value());
continue;
}
const QVariantMap &buildStep = bcIt.value().toMap();
if ((buildStep.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString() ==
QLatin1String("Qt4ProjectManager.S60SignBuildStep"))
|| (buildStep.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString() ==
QLatin1String("Qt4ProjectManager.MaemoPackageCreationStep"))) {
movedBs = true;
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.DeployStep.0"), buildStep);
} else {
newBc.insert(bcKey, buildStep);
}
}
if (movedBs) {
// adjust counts:
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.DeployStepsCount"), 1);
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount"),
newBc.value(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount")).toInt() - 1);
}
newTarget.insert(targetKey, newBc);
}
result.insert(globalKey, newTarget);
}
return result;
}

View File

@@ -105,22 +105,25 @@ BuildStep *MaemoPackageCreationFactory::restore(BuildConfiguration *parent,
} }
bool MaemoPackageCreationFactory::canClone(BuildConfiguration *parent, bool MaemoPackageCreationFactory::canClone(BuildConfiguration *parent,
BuildStep::Type type, BuildStep *product) const ProjectExplorer::BuildStep::Type type,
BuildStep *product) const
{ {
return canCreateInternally(parent, type, product->id()); return canCreateInternally(parent, type, product->id());
} }
BuildStep *MaemoPackageCreationFactory::clone(BuildConfiguration *parent, BuildStep *MaemoPackageCreationFactory::clone(BuildConfiguration *parent,
BuildStep::Type type, BuildStep *product) ProjectExplorer::BuildStep::Type type,
BuildStep *product)
{ {
Q_ASSERT(canClone(parent, type, product)); Q_ASSERT(canClone(parent, type, product));
return new MaemoPackageCreationStep(parent, static_cast<MaemoPackageCreationStep *>(product)); return new MaemoPackageCreationStep(parent, static_cast<MaemoPackageCreationStep *>(product));
} }
bool MaemoPackageCreationFactory::canCreateInternally(BuildConfiguration *parent, bool MaemoPackageCreationFactory::canCreateInternally(BuildConfiguration *parent,
BuildStep::Type type, const QString &id) const ProjectExplorer::BuildStep::Type type,
const QString &id) const
{ {
return type == ProjectExplorer::BuildStep::Build return type == ProjectExplorer::BuildStep::Deploy
&& id == MaemoPackageCreationStep::CreatePackageId && id == MaemoPackageCreationStep::CreatePackageId
&& parent->target()->id() == Constants::MAEMO_DEVICE_TARGET_ID; && parent->target()->id() == Constants::MAEMO_DEVICE_TARGET_ID;
} }

View File

@@ -185,7 +185,7 @@ S60CreatePackageStepFactory::~S60CreatePackageStepFactory()
bool S60CreatePackageStepFactory::canCreate(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::BuildStep::Type type, const QString &id) const bool S60CreatePackageStepFactory::canCreate(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::BuildStep::Type type, const QString &id) const
{ {
if (type != ProjectExplorer::BuildStep::Build) if (type != ProjectExplorer::BuildStep::Deploy)
return false; return false;
if (parent->target()->id() != Constants::S60_DEVICE_TARGET_ID) if (parent->target()->id() != Constants::S60_DEVICE_TARGET_ID)
return false; return false;
@@ -230,7 +230,7 @@ ProjectExplorer::BuildStep *S60CreatePackageStepFactory::restore(ProjectExplorer
QStringList S60CreatePackageStepFactory::availableCreationIds(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::BuildStep::Type type) const QStringList S60CreatePackageStepFactory::availableCreationIds(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::BuildStep::Type type) const
{ {
if (type != ProjectExplorer::BuildStep::Build) if (type != ProjectExplorer::BuildStep::Deploy)
return QStringList(); return QStringList();
if (parent->target()->id() == Constants::S60_DEVICE_TARGET_ID) if (parent->target()->id() == Constants::S60_DEVICE_TARGET_ID)
return QStringList() << QLatin1String(SIGN_BS_ID); return QStringList() << QLatin1String(SIGN_BS_ID);

View File

@@ -283,9 +283,9 @@ Qt4BuildConfiguration *Qt4Target::addQt4BuildConfiguration(QString displayName,
if (id() == Constants::S60_DEVICE_TARGET_ID) { if (id() == Constants::S60_DEVICE_TARGET_ID) {
S60CreatePackageStep *packageStep = new S60CreatePackageStep(bc); S60CreatePackageStep *packageStep = new S60CreatePackageStep(bc);
bc->insertStep(ProjectExplorer::BuildStep::Build, 2, packageStep); bc->insertStep(ProjectExplorer::BuildStep::Deploy, 2, packageStep);
} else if (id() == Constants::MAEMO_DEVICE_TARGET_ID) { } else if (id() == Constants::MAEMO_DEVICE_TARGET_ID) {
bc->insertStep(ProjectExplorer::BuildStep::Build, 2, new MaemoPackageCreationStep(bc)); bc->insertStep(ProjectExplorer::BuildStep::Deploy, 2, new MaemoPackageCreationStep(bc));
} }
MakeStep* cleanStep = new MakeStep(bc); MakeStep* cleanStep = new MakeStep(bc);