Commit 5ed1f715 authored by Tobias Hunger's avatar Tobias Hunger

Initial version of qbs plugin

Change-Id: I0e0ae07affccfeab167303bb976475649a630e65
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent df1f7796
......@@ -59,6 +59,7 @@ Project {
"src/plugins/mercurial/mercurial.qbs",
"src/plugins/perforce/perforce.qbs",
"src/plugins/projectexplorer/projectexplorer.qbs",
"src/plugins/qbsprojectmanager/qbsprojectmanager.qbs",
// "src/plugins/qmldesigner/qmldesigner.qbs",
"src/plugins/qmljseditor/qmljseditor.qbs",
"src/plugins/qmljstools/qmljstools.qbs",
......
......@@ -47,6 +47,14 @@ SUBDIRS = plugin_coreplugin \
plugin_todo \
plugin_qnx
# Look for qbs in the environment...
isEmpty(QBS_SOURCE_DIR): QBS_SOURCE_DIR = $$(QBS_SOURCE_DIR)
isEmpty(QBS_BUILD_DIR): QBS_BUILD_DIR = $$(QBS_BUILD_DIR)
!isEmpty(QBS_SOURCE_DIR):!isEmpty(QBS_BUILD_DIR) {
SUBDIRS += plugin_qbsprojectmanager
}
isEmpty(IDE_PACKAGE_MODE) {
SUBDIRS += plugin_helloworld \
plugin_updateinfo
......@@ -332,6 +340,12 @@ plugin_qnx.depends += plugin_qt4projectmanager
plugin_qnx.depends += plugin_coreplugin
plugin_qnx.depends += plugin_texteditor
plugin_qbsprojectmanager.subdir = qbsprojectmanager
plugin_qbsprojectmanager.depends = plugin_texteditor
plugin_qbsprojectmanager.depends += plugin_projectexplorer
plugin_qbsprojectmanager.depends += plugin_cpptools
plugin_qbsprojectmanager.depends += plugin_qtsupport
plugin_clearcase.subdir = clearcase
plugin_clearcase.depends = plugin_vcsbase
plugin_clearcase.depends += plugin_projectexplorer
......
<plugin name=\"QbsProjectManager\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\" experimental=\"true\">
<vendor>Digia Plc</vendor>
<copyright>(C) 2013 Digia Plc</copyright>
<license>
Commercial Usage
Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Digia.
GNU Lesser General Public License Usage
Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
</license>
<category>Build Systems</category>
<description>QBS support</description>
<url>http://www.qt-project.org</url>
<dependencyList>
<dependency name=\"TextEditor\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"CppTools\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"QtSupport\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"QmlJsTools\" version=\"$$QTCREATOR_VERSION\"/>
</dependencyList>
</plugin>
This diff is collapsed.
/****************************************************************************
**
** 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 QBSBUILDCONFIGURATION_H
#define QBSBUILDCONFIGURATION_H
#include "qbsprojectmanager_global.h"
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
namespace ProjectExplorer { class FileNode; }
namespace QbsProjectManager {
namespace Internal {
class QbsBuildConfigurationFactory;
class QbsBuildConfigurationWidget;
class QbsBuildStep;
class QbsProject;
class QbsBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
Q_OBJECT
public:
explicit QbsBuildConfiguration(ProjectExplorer::Target *target);
ProjectExplorer::NamedWidget *createConfigWidget();
QbsBuildStep *qbsStep() const;
QVariantMap qbsConfiguration() const;
QString buildDirectory() const;
Internal::QbsProject *project() const;
QVariantMap toMap() const;
ProjectExplorer::IOutputParser *createOutputParser() const;
bool isEnabled() const;
QString disabledReason() const;
BuildType buildType() const;
void setChangedFiles(const QStringList &files);
QStringList changedFiles() const;
signals:
void qbsConfigurationChanged();
protected:
QbsBuildConfiguration(ProjectExplorer::Target *target, QbsBuildConfiguration *source);
QbsBuildConfiguration(ProjectExplorer::Target *target, const Core::Id id);
bool fromMap(const QVariantMap &map);
private slots:
void buildStepInserted(int pos);
private:
static QbsBuildConfiguration *setup(ProjectExplorer::Target *t,
const QString &defaultDisplayName,
const QString &displayName,
const QVariantMap &buildData,
const Utils::FileName &directory);
void setBuildDirectory(const Utils::FileName &dir);
bool m_isParsing;
bool m_parsingError;
Utils::FileName m_buildDirectory;
QStringList m_changedFiles;
friend class QbsBuildConfigurationFactory;
friend class QbsBuildConfigurationWidget;
};
class QbsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
{
Q_OBJECT
public:
explicit QbsBuildConfigurationFactory(QObject *parent = 0);
~QbsBuildConfigurationFactory();
QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
private:
bool canHandle(const ProjectExplorer::Target *t) const;
};
} // namespace Internal
} // namespace QbsProjectManager
#endif // QBSBUILDCONFIGURATION_H
/****************************************************************************
**
** 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 "qbsbuildconfigurationwidget.h"
#include "qbsbuildconfiguration.h"
#include <utils/detailswidget.h>
#include <utils/pathchooser.h>
#include <QGridLayout>
#include <QLabel>
#include <QWidget>
namespace QbsProjectManager {
namespace Internal {
QbsBuildConfigurationWidget::QbsBuildConfigurationWidget(QbsProjectManager::Internal::QbsBuildConfiguration *bc) :
m_buildConfiguration(bc),
m_ignoreChange(false)
{
connect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0);
Utils::DetailsWidget *container = new Utils::DetailsWidget(this);
container->setState(Utils::DetailsWidget::NoSummary);
vbox->addWidget(container);
QWidget *details = new QWidget(container);
container->setWidget(details);
QGridLayout *layout = new QGridLayout(details);
layout->addWidget(new QLabel(tr("Build directory:"), 0, 0));
m_buildDirChooser = new Utils::PathChooser;
m_buildDirChooser->setExpectedKind(Utils::PathChooser::Directory);
layout->addWidget(m_buildDirChooser, 0, 1);
connect(m_buildDirChooser, SIGNAL(changed(QString)), this, SLOT(buildDirEdited()));
buildDirectoryChanged();
}
void QbsBuildConfigurationWidget::buildDirEdited()
{
m_ignoreChange = true;
m_buildConfiguration->setBuildDirectory(m_buildDirChooser->fileName());
}
void QbsBuildConfigurationWidget::buildDirectoryChanged()
{
if (m_ignoreChange)
return;
m_buildDirChooser->setPath(m_buildConfiguration->buildDirectory());
}
} // namespace Internal
} // namespace QbsProjectManager
/****************************************************************************
**
** 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 QBSBUILDCONFIGURATIONWIDGET_H
#define QBSBUILDCONFIGURATIONWIDGET_H
#include <projectexplorer/namedwidget.h>
namespace Utils {
class DetailsWidget;
class PathChooser;
} // namespace Utils
namespace QbsProjectManager {
namespace Internal {
class QbsBuildConfiguration;
class QbsBuildConfigurationWidget : public ProjectExplorer::NamedWidget
{
Q_OBJECT
public:
QbsBuildConfigurationWidget(Internal::QbsBuildConfiguration *bc);
private slots:
void buildDirEdited();
// Changes triggered from creator
void buildDirectoryChanged();
private:
Internal::QbsBuildConfiguration *m_buildConfiguration;
Utils::PathChooser *m_buildDirChooser;
bool m_ignoreChange;
};
} // namespace Internal
} // namespace QbsProjectManager
#endif // QBSBUILDCONFIGURATIONWIDGET_H
This diff is collapsed.
/****************************************************************************
**
** 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 QBSBUILDSTEP_H
#define QBSBUILDSTEP_H
#include "qbsbuildconfiguration.h"
#include <projectexplorer/buildstep.h>
#include <qbs.h>
namespace QbsProjectManager {
namespace Internal {
class QbsBuildStepConfigWidget;
class QbsBuildStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
public:
QbsBuildStep(ProjectExplorer::BuildStepList *bsl);
QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other);
~QbsBuildStep();
bool init();
void run(QFutureInterface<bool> &fi);
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool runInGuiThread() const;
void cancel();
QVariantMap qbsConfiguration() const;
void setQbsConfiguration(const QVariantMap &config);
bool dryRun() const;
bool keepGoing() const;
int maxJobs() const;
QString buildVariant() const;
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
signals:
void qbsConfigurationChanged();
void qbsBuildOptionsChanged();
private slots:
void buildingDone(bool success);
void handleTaskStarted(const QString &desciption, int max);
void handleProgress(int value);
void handleWarningReport(const qbs::Error &error);
void handleCommandDescriptionReport(const QString &highlight, const QString &message);
void handleProcessResultReport(const qbs::ProcessResult &result);
private:
void createTaskAndOutput(ProjectExplorer::Task::TaskType type,
const QString &message, const QString &file, int line);
void setBuildVariant(const QString &variant);
QString profile() const;
void setDryRun(bool dr);
void setKeepGoing(bool kg);
void setMaxJobs(int jobcount);
QVariantMap m_qbsConfiguration;
qbs::BuildOptions m_qbsBuildOptions;
QStringList m_changedFiles;
QFutureInterface<bool> *m_fi;
qbs::BuildJob *m_job;
int m_progressBase;
bool m_showCompilerOutput;
ProjectExplorer::IOutputParser *m_parser;
friend class QbsBuildStepConfigWidget;
};
namespace Ui { class QbsBuildStepConfigWidget; }
class QbsBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
QbsBuildStepConfigWidget(QbsBuildStep *step);
QString summaryText() const;
QString displayName() const;
private slots:
void updateState();
void changeBuildVariant(int);
void changeDryRun(bool dr);
void changeKeepGoing(bool kg);
void changeJobCount(int count);
private:
Ui::QbsBuildStepConfigWidget *m_ui;
QbsBuildStep *m_step;
QString m_summary;
};
class QbsBuildStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit QbsBuildStepFactory(QObject *parent = 0);
// used to show the list of possible additons to a target, returns a list of types
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
// used to translate the types to names to display to the user
QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id);
// used to recreate the runConfigurations when restoring settings
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product);
};
} // namespace Internal
} // namespace QbsProjectManager
#endif // QBSBUILDSTEP_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QbsProjectManager::Internal::QbsBuildStepConfigWidget</class>
<widget class="QWidget" name="QbsProjectManager::Internal::QbsBuildStepConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>97</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>16</number>
</property>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="dryRunCheckBox">
<property name="text">
<string>Dry run</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="keepGoingCheckBox">
<property name="text">
<string>Keep Going</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="jobSpinBox"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>jobs</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="buildVariantComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Release</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="buildVariantLabel">
<property name="text">
<string>Build variant:</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
/****************************************************************************
**
** 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