forked from qt-creator/qt-creator
Qbs: Add QbsDeployConfigurationFactory
Add QbsDeployConfigurationFactory and mark the QbsProject to not work with the default deployment for Desktop projects. Change-Id: I9230d5017b475d53cf13e86b4a073c248fedfaf0 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
141
src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp
Normal file
141
src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** 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 Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qbsdeployconfigurationfactory.h"
|
||||||
|
|
||||||
|
#include "qbsinstallstep.h"
|
||||||
|
#include "qbsproject.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildsteplist.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Helpers:
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
static QString genericQbsDisplayName() {
|
||||||
|
return QCoreApplication::translate("Qbs", "Qbs Install");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Core::Id genericQbsDeployConfigurationId()
|
||||||
|
{
|
||||||
|
return Core::Id("Qbs.Deploy");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// QbsDeployConfiguration:
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id) :
|
||||||
|
ProjectExplorer::DeployConfiguration(target, id)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target,
|
||||||
|
ProjectExplorer::DeployConfiguration *source) :
|
||||||
|
ProjectExplorer::DeployConfiguration(target, source)
|
||||||
|
{
|
||||||
|
cloneSteps(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// QbsDeployConfigurationFactory:
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
QbsDeployConfigurationFactory::QbsDeployConfigurationFactory(QObject *parent) :
|
||||||
|
ProjectExplorer::DeployConfigurationFactory(parent)
|
||||||
|
{
|
||||||
|
setObjectName(QLatin1String("QbsDeployConfiguration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||||
|
{
|
||||||
|
QList<Core::Id> ids;
|
||||||
|
if (qobject_cast<QbsProject *>(parent->project()))
|
||||||
|
ids << genericQbsDeployConfigurationId();
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QbsDeployConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||||
|
{
|
||||||
|
if (id == genericQbsDeployConfigurationId())
|
||||||
|
return genericQbsDisplayName();
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QbsDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
|
||||||
|
const Core::Id id) const
|
||||||
|
{
|
||||||
|
return availableCreationIds(parent).contains(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::DeployConfiguration
|
||||||
|
*QbsDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
||||||
|
{
|
||||||
|
Q_ASSERT(canCreate(parent, id));
|
||||||
|
|
||||||
|
QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
|
||||||
|
dc->setDisplayName(genericQbsDisplayName());
|
||||||
|
dc->stepList()->insertStep(0, new QbsInstallStep(dc->stepList()));
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QbsDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
|
||||||
|
const QVariantMap &map) const
|
||||||
|
{
|
||||||
|
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::DeployConfiguration
|
||||||
|
*QbsDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
if (!canRestore(parent, map))
|
||||||
|
return 0;
|
||||||
|
Core::Id id = ProjectExplorer::idFromMap(map);
|
||||||
|
QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
|
||||||
|
if (!dc->fromMap(map)) {
|
||||||
|
delete dc;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::DeployConfiguration
|
||||||
|
*QbsDeployConfigurationFactory::clone(ProjectExplorer::Target *parent,
|
||||||
|
ProjectExplorer::DeployConfiguration *product)
|
||||||
|
{
|
||||||
|
if (!canClone(parent, product))
|
||||||
|
return 0;
|
||||||
|
return new QbsDeployConfiguration(parent, qobject_cast<QbsDeployConfiguration *>(product));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace QbsProjectManager
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** 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 Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QBSDEPLOYCONFIGURATIONFACTORY_H
|
||||||
|
#define QBSDEPLOYCONFIGURATIONFACTORY_H
|
||||||
|
|
||||||
|
#include <projectexplorer/deployconfiguration.h>
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class QbsDeployConfigurationFactory;
|
||||||
|
|
||||||
|
class QbsDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
QbsDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id);
|
||||||
|
QbsDeployConfiguration(ProjectExplorer::Target *target,
|
||||||
|
ProjectExplorer::DeployConfiguration *source);
|
||||||
|
|
||||||
|
friend class QbsDeployConfigurationFactory;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit QbsDeployConfigurationFactory(QObject *parent = 0);
|
||||||
|
|
||||||
|
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||||
|
QString displayNameForId(const Core::Id id) const;
|
||||||
|
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||||
|
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
|
||||||
|
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||||
|
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||||
|
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
|
||||||
|
ProjectExplorer::DeployConfiguration *product);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace QbsProjectManager
|
||||||
|
|
||||||
|
#endif // QBSDEPLOYCONFIGURATIONFACTORY_H
|
||||||
@@ -239,6 +239,11 @@ const qbs::ProjectData *QbsProject::qbsProjectData() const
|
|||||||
return m_rootProjectNode->projectData();
|
return m_rootProjectNode->projectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QbsProject::needsSpecialDeployment() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void QbsProject::handleQbsParsingDone(bool success)
|
void QbsProject::handleQbsParsingDone(bool success)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qbsSetupProjectJob, return);
|
QTC_ASSERT(m_qbsSetupProjectJob, return);
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ public:
|
|||||||
const qbs::Project *qbsProject() const;
|
const qbs::Project *qbsProject() const;
|
||||||
const qbs::ProjectData *qbsProjectData() const;
|
const qbs::ProjectData *qbsProjectData() const;
|
||||||
|
|
||||||
|
bool needsSpecialDeployment() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void invalidate();
|
void invalidate();
|
||||||
void parseCurrentBuildConfiguration();
|
void parseCurrentBuildConfiguration();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ HEADERS = \
|
|||||||
qbsbuildconfigurationwidget.h \
|
qbsbuildconfigurationwidget.h \
|
||||||
qbsbuildstep.h \
|
qbsbuildstep.h \
|
||||||
qbscleanstep.h \
|
qbscleanstep.h \
|
||||||
|
qbsdeployconfigurationfactory.h \
|
||||||
qbsinstallstep.h \
|
qbsinstallstep.h \
|
||||||
qbslogsink.h \
|
qbslogsink.h \
|
||||||
qbsnodes.h \
|
qbsnodes.h \
|
||||||
@@ -35,6 +36,7 @@ SOURCES = \
|
|||||||
qbsbuildconfigurationwidget.cpp \
|
qbsbuildconfigurationwidget.cpp \
|
||||||
qbsbuildstep.cpp \
|
qbsbuildstep.cpp \
|
||||||
qbscleanstep.cpp \
|
qbscleanstep.cpp \
|
||||||
|
qbsdeployconfigurationfactory.cpp \
|
||||||
qbsinstallstep.cpp \
|
qbsinstallstep.cpp \
|
||||||
qbslogsink.cpp \
|
qbslogsink.cpp \
|
||||||
qbsnodes.cpp \
|
qbsnodes.cpp \
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ QtcPlugin {
|
|||||||
"qbscleanstep.cpp",
|
"qbscleanstep.cpp",
|
||||||
"qbscleanstep.h",
|
"qbscleanstep.h",
|
||||||
"qbscleanstepconfigwidget.ui",
|
"qbscleanstepconfigwidget.ui",
|
||||||
|
"qbsdeployconfigurationfactory.cpp",
|
||||||
|
"qbsdeployconfigurationfactory.h",
|
||||||
"qbsinstallstep.cpp",
|
"qbsinstallstep.cpp",
|
||||||
"qbsinstallstep.h",
|
"qbsinstallstep.h",
|
||||||
"qbsinstallstepconfigwidget.ui",
|
"qbsinstallstepconfigwidget.ui",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "qbsbuildconfiguration.h"
|
#include "qbsbuildconfiguration.h"
|
||||||
#include "qbsbuildstep.h"
|
#include "qbsbuildstep.h"
|
||||||
#include "qbscleanstep.h"
|
#include "qbscleanstep.h"
|
||||||
|
#include "qbsdeployconfigurationfactory.h"
|
||||||
#include "qbsinstallstep.h"
|
#include "qbsinstallstep.h"
|
||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
#include "qbsprojectmanager.h"
|
#include "qbsprojectmanager.h"
|
||||||
@@ -83,6 +84,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
|||||||
addAutoReleasedObject(new QbsBuildStepFactory);
|
addAutoReleasedObject(new QbsBuildStepFactory);
|
||||||
addAutoReleasedObject(new QbsCleanStepFactory);
|
addAutoReleasedObject(new QbsCleanStepFactory);
|
||||||
addAutoReleasedObject(new QbsInstallStepFactory);
|
addAutoReleasedObject(new QbsInstallStepFactory);
|
||||||
|
addAutoReleasedObject(new QbsDeployConfigurationFactory);
|
||||||
|
|
||||||
//menus
|
//menus
|
||||||
// Build Menu:
|
// Build Menu:
|
||||||
|
|||||||
Reference in New Issue
Block a user