ProjectExplorer: Merge Qbs* into DefaultDeployConfigurationFactory

DefaultDeployConfigurationFactory used extra effort to not apply to the
Qbs (Desktop) case, with QbsDeployConfigurationFactory plugging exactly
that hole with essentially the same functionality, which is even the
default of the base class.

The only differences are the display name, which is dropped in this
patch, and the different keys in the .user file, which are updated
with this patch. Note that the display name "Qbs Install" for the
DeployConfiguration stays with this patch whereas a freshly created
one will get the default "Deploy Configuration" name.

Change-Id: I255371d0a0688fbc6303083eb6aa20563e876264
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-01-24 16:39:52 +01:00
parent 49bd5b6c50
commit e6a184fe5c
12 changed files with 39 additions and 112 deletions

View File

@@ -272,10 +272,4 @@ DefaultDeployConfigurationFactory::DefaultDeployConfigurationFactory()
setDefaultDisplayName(DeployConfiguration::tr("Deploy Configuration"));
}
bool DefaultDeployConfigurationFactory::canHandle(Target *parent) const
{
return DeployConfigurationFactory::canHandle(parent)
&& !parent->project()->needsSpecialDeployment();
}
} // namespace ProjectExplorer

View File

@@ -119,9 +119,6 @@ class DefaultDeployConfigurationFactory : public DeployConfigurationFactory
{
public:
DefaultDeployConfigurationFactory();
private:
bool canHandle(Target *parent) const override;
};
} // namespace ProjectExplorer

View File

@@ -819,11 +819,6 @@ void Project::configureAsExampleProject(const QSet<Core::Id> &platforms)
Q_UNUSED(platforms);
}
bool Project::needsSpecialDeployment() const
{
return false;
}
bool Project::knowsAllBuildExecutables() const
{
return true;

View File

@@ -158,7 +158,6 @@ public:
Kit::Predicate requiredKitPredicate() const;
Kit::Predicate preferredKitPredicate() const;
virtual bool needsSpecialDeployment() const;
// The build system is able to report all executables that can be built, independent
// of configuration.
virtual bool knowsAllBuildExecutables() const;

View File

@@ -133,6 +133,18 @@ public:
static QVariant process(const QVariant &entry, const QStringList &path);
};
// Version 20 renames "Qbs.Deploy" to "ProjectExplorer.DefaultDeployConfiguration"
// to account for the merging of the respective factories
// run configuration fields use the same key in the settings file.
class UserFileVersion20Upgrader : public VersionUpgrader
{
public:
UserFileVersion20Upgrader() : VersionUpgrader(20, "4.9-pre1") { }
QVariantMap upgrade(const QVariantMap &map) final;
static QVariant process(const QVariant &entry);
};
} // namespace
//
@@ -293,6 +305,7 @@ UserFileAccessor::UserFileAccessor(Project *project) :
addVersionUpgrader(std::make_unique<UserFileVersion17Upgrader>());
addVersionUpgrader(std::make_unique<UserFileVersion18Upgrader>());
addVersionUpgrader(std::make_unique<UserFileVersion19Upgrader>());
addVersionUpgrader(std::make_unique<UserFileVersion20Upgrader>());
}
Project *UserFileAccessor::project() const
@@ -809,6 +822,32 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QString
}
}
QVariantMap UserFileVersion20Upgrader::upgrade(const QVariantMap &map)
{
return process(map).toMap();
}
QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
{
switch (entry.type()) {
case QVariant::List:
return Utils::transform(entry.toList(), &UserFileVersion20Upgrader::process);
case QVariant::Map:
return Utils::transform<QMap<QString, QVariant>>(
entry.toMap().toStdMap(), [](const std::pair<const QString, QVariant> &item) {
auto res = qMakePair(item.first, item.second);
if (item.first == "ProjectExplorer.ProjectConfiguration.Id"
&& item.second == "Qbs.Deploy")
res.second = QVariant("ProjectExplorer.DefaultDeployConfiguration");
else
res.second = UserFileVersion20Upgrader::process(item.second);
return res;
});
default:
return entry;
}
}
#if defined(WITH_TESTS)
#include <QTest>

View File

@@ -1,45 +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 "qbsdeployconfigurationfactory.h"
#include "qbsprojectmanagerconstants.h"
#include "qbsinstallstep.h"
#include <projectexplorer/projectexplorerconstants.h>
namespace QbsProjectManager {
namespace Internal {
QbsDeployConfigurationFactory::QbsDeployConfigurationFactory()
{
setConfigBaseId("Qbs.Deploy");
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
setSupportedProjectType(Constants::PROJECT_ID);
setDefaultDisplayName(QCoreApplication::translate("Qbs", "Qbs Install"));
}
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -1,40 +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 <projectexplorer/deployconfiguration.h>
namespace QbsProjectManager {
namespace Internal {
class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
public:
QbsDeployConfigurationFactory();
};
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -432,11 +432,6 @@ qbs::ProjectData QbsProject::qbsProjectData() const
return m_projectData;
}
bool QbsProject::needsSpecialDeployment() const
{
return true;
}
bool QbsProject::checkCancelStatus()
{
const CancelStatus cancelStatus = m_cancelStatus;

View File

@@ -94,7 +94,6 @@ public:
qbs::Project qbsProject() const;
qbs::ProjectData qbsProjectData() const;
bool needsSpecialDeployment() const override;
void generateErrors(const qbs::ErrorInfo &e);
static QString uniqueProductName(const qbs::ProductData &product);

View File

@@ -26,7 +26,6 @@ HEADERS = \
qbsbuildinfo.h \
qbsbuildstep.h \
qbscleanstep.h \
qbsdeployconfigurationfactory.h \
qbskitinformation.h \
qbsinstallstep.h \
qbslogsink.h \
@@ -53,7 +52,6 @@ SOURCES = \
qbsbuildinfo.cpp \
qbsbuildstep.cpp \
qbscleanstep.cpp \
qbsdeployconfigurationfactory.cpp \
qbsinstallstep.cpp \
qbskitinformation.cpp \
qbslogsink.cpp \

View File

@@ -80,8 +80,6 @@ QtcPlugin {
"qbscleanstep.cpp",
"qbscleanstep.h",
"qbscleanstepconfigwidget.ui",
"qbsdeployconfigurationfactory.cpp",
"qbsdeployconfigurationfactory.h",
"qbsinstallstep.cpp",
"qbsinstallstep.h",
"qbsinstallstepconfigwidget.ui",

View File

@@ -28,7 +28,6 @@
#include "qbsbuildconfiguration.h"
#include "qbsbuildstep.h"
#include "qbscleanstep.h"
#include "qbsdeployconfigurationfactory.h"
#include "qbsinstallstep.h"
#include "qbskitinformation.h"
#include "qbsnodes.h"
@@ -91,7 +90,6 @@ public:
QbsBuildStepFactory buildStepFactory;
QbsCleanStepFactory cleanStepFactory;
QbsInstallStepFactory installStepFactory;
QbsDeployConfigurationFactory deployConfigFactory;
QbsRunConfigurationFactory runConfigFactory;
QbsProfilesSettingsPage profilesSetttingsPage;
};