2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "buildstep.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "buildconfiguration.h"
|
|
|
|
|
#include "buildsteplist.h"
|
2011-02-21 17:38:12 +01:00
|
|
|
#include "deployconfiguration.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "target.h"
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::BuildStep
|
|
|
|
|
|
|
|
|
|
\brief BuildSteps are the primary way plugin developers can customize
|
|
|
|
|
how their projects (or projects from other plugins) are build.
|
|
|
|
|
|
|
|
|
|
Building a project, is done by taking the list of buildsteps
|
|
|
|
|
from the project and calling first init() than run() on them.
|
|
|
|
|
|
|
|
|
|
That means to change the way your project is build, reimplemnt
|
|
|
|
|
this class and add your Step to the buildStep list of the project.
|
|
|
|
|
|
|
|
|
|
Note: The projects own the buildstep, do not delete them yourself.
|
|
|
|
|
|
|
|
|
|
init() is called in the GUI thread and can be used to query the
|
|
|
|
|
project for any information you need.
|
|
|
|
|
|
|
|
|
|
run() is run via QtConccurrent in a own thread, if you need an
|
|
|
|
|
eventloop you need to create it yourself!
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn bool ProjectExplorer::BuildStep::init()
|
|
|
|
|
|
|
|
|
|
This function is run in the gui thread,
|
|
|
|
|
use it to retrieve any information that you need in run()
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
|
|
|
|
|
Reimplement this. This function is called when the target is build.
|
2011-07-07 15:15:43 +02:00
|
|
|
By default this function is NOT run in the gui thread. It runs in its
|
|
|
|
|
own thread. If you need an event loop, you need to create one.
|
|
|
|
|
This function should block until the task is done
|
2011-04-14 12:58:14 +02:00
|
|
|
|
|
|
|
|
The absolute minimal implementation is:
|
|
|
|
|
\code
|
|
|
|
|
fi.reportResult(true);
|
|
|
|
|
\endcode
|
2011-07-07 15:15:43 +02:00
|
|
|
|
|
|
|
|
By returning true from \sa runInGuiThread() this function is called in the
|
|
|
|
|
gui thread. Then the function should not block and instead the
|
|
|
|
|
finished() signal should be emitted.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn BuildStepConfigWidget *ProjectExplorer::BuildStep::createConfigWidget()
|
|
|
|
|
|
|
|
|
|
Returns the Widget shown in the target settings dialog for this buildStep;
|
|
|
|
|
ownership is transferred to the caller.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn bool ProjectExplorer::BuildStep::immutable() const
|
|
|
|
|
|
|
|
|
|
If this function returns true, the user can't delete this BuildStep for this target
|
|
|
|
|
and the user is prevented from changing the order immutable steps are run
|
|
|
|
|
the default implementation returns false.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::addTask(const ProjectExplorer::Task &task)
|
|
|
|
|
\brief Add a task.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format,
|
|
|
|
|
ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting)
|
|
|
|
|
|
|
|
|
|
The string is added to the generated output, usually in the output window.
|
|
|
|
|
It should be in plain text, with the format in the parameter.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-07-07 15:15:43 +02:00
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::cancel() const
|
|
|
|
|
|
|
|
|
|
This function needs to be reimplemented only for BuildSteps that return false from \sa runInGuiThread.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::finished()
|
|
|
|
|
\brief This signal needs to be emitted if the BuildStep runs in the gui thread.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-04-20 16:29:46 +02:00
|
|
|
using namespace ProjectExplorer;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep::BuildStep(BuildStepList *bsl, const QString &id) :
|
|
|
|
|
ProjectConfiguration(bsl, id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(bsl);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
|
|
|
|
|
ProjectConfiguration(bsl, bs)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(bsl);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildStep::~BuildStep()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildConfiguration *BuildStep::buildConfiguration() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-10-21 13:06:26 +00:00
|
|
|
return qobject_cast<BuildConfiguration *>(parent()->parent());
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-21 17:38:12 +01:00
|
|
|
DeployConfiguration *BuildStep::deployConfiguration() const
|
|
|
|
|
{
|
2011-10-21 13:06:26 +00:00
|
|
|
return qobject_cast<DeployConfiguration *>(parent()->parent());
|
2011-02-21 17:38:12 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-24 13:10:38 +00:00
|
|
|
ProjectConfiguration *BuildStep::projectConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<ProjectConfiguration *>(parent()->parent());
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
Target *BuildStep::target() const
|
|
|
|
|
{
|
|
|
|
|
return qobject_cast<Target *>(parent()->parent()->parent());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-21 13:06:26 +00:00
|
|
|
Project *BuildStep::project() const
|
|
|
|
|
{
|
|
|
|
|
return target()->project();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
bool BuildStep::immutable() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-07 15:15:43 +02:00
|
|
|
bool BuildStep::runInGuiThread() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStep::cancel()
|
|
|
|
|
{
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
IBuildStepFactory::IBuildStepFactory(QObject *parent) :
|
|
|
|
|
QObject(parent)
|
2010-07-16 14:00:41 +02:00
|
|
|
{ }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
IBuildStepFactory::~IBuildStepFactory()
|
2010-07-16 14:00:41 +02:00
|
|
|
{ }
|