BuildStep Class | Extending Qt Creator Manual

Extending Qt Creator Manual | BuildStep

Extending Qt Creator Manual 4.6.0

# BuildStep Class

(ProjectExplorer::BuildStep)

The BuildStep class provides build steps for projects. More...

Header: | #include <BuildStep>
Inherits: | ProjectExplorer::ProjectConfiguration
Inherited By: | ProjectExplorer::AbstractProcessStep

- List of all members, including inherited members

## Public Types

enum | OutputFormat { Stdout, Stderr, NormalMessage, ErrorMessage }
enum | OutputNewlineSetting { DoAppendNewline, DontAppendNewline }

## Public Functions

BuildConfiguration * | buildConfiguration() const
virtual void | cancel()
virtual BuildStepConfigWidget * | createConfigWidget() = 0
DeployConfiguration * | deployConfiguration() const
bool | enabled() const
virtual bool | immutable() const
virtual bool | init(QList<const BuildStep *> &earlierSteps) = 0
ProjectConfiguration * | projectConfiguration() const
virtual void | run(QFutureInterface<bool> &fi) = 0
virtual bool | runInGuiThread() const
void | setEnabled(bool b)
Target * | target() const

## Reimplemented Public Functions

virtual bool | fromMap(const QVariantMap &map) override
virtual bool | isActive() const override
virtual Project * | project() const override
virtual QVariantMap | toMap() const override

- 14 public functions inherited from ProjectExplorer::ProjectConfiguration

## Signals

void | addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format, ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline)
void | addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0)
void | enabledChanged()

- 2 signals inherited from ProjectExplorer::ProjectConfiguration

## Static Public Members

void | reportRunResult(QFutureInterface<bool> &fi, bool success)

- 1 static public member inherited from ProjectExplorer::ProjectConfiguration

## Protected Functions

| BuildStep(BuildStepList *bsl, Core::Id id)

## Detailed Description

The BuildStep class provides build steps for projects.

Build steps are the primary way plugin developers can customize how their projects (or projects from other plugins) are built.

Projects are built by taking the list of build steps from the project and calling first `init()` and then `run()` on them.

To change the way your project is built, reimplement this class and add your build step to the build step list of the project.

Note: The projects own the build step. 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 Utils::runAsync in a separate thread. If you need an event loop, you need to create it yourself.

## Member Type Documentation

### enum BuildStep::OutputFormat

### enum BuildStep::OutputNewlineSetting

## Member Function Documentation

### `[protected]` BuildStep::BuildStep(BuildStepList *bsl, Core::Id id)

Default constructs an instance of BuildStep.

### `[signal]` void BuildStep::addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format, ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline)

### `[signal]` void BuildStep::addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0)

### BuildConfiguration *BuildStep::buildConfiguration() const

### `[virtual]` void BuildStep::cancel()

This function needs to be reimplemented only for build steps that return `false` from runInGuiThread().

See also runInGuiThread().

### `[pure virtual]` BuildStepConfigWidget *BuildStep::createConfigWidget()

Returns the Widget shown in the target settings dialog for this build step. Ownership is transferred to the caller.

### DeployConfiguration *BuildStep::deployConfiguration() const

### bool BuildStep::enabled() const

See also setEnabled().

### `[signal]` void BuildStep::enabledChanged()

### `[override virtual]` bool BuildStep::fromMap(const QVariantMap &map)

### `[virtual]` bool BuildStep::immutable() const

If this function returns `true`, the user cannot delete this build step for this target and the user is prevented from changing the order in which immutable steps are run. The default implementation returns `false`.

### `[pure virtual]` bool BuildStep::init(QList<const BuildStep *> &earlierSteps)

### `[override virtual]` bool BuildStep::isActive() const

### `[override virtual]` Project *BuildStep::project() const

### ProjectConfiguration *BuildStep::projectConfiguration() const

### `[static]` void BuildStep::reportRunResult(QFutureInterface<bool> &fi, bool success)

### `[pure virtual]` void BuildStep::run(QFutureInterface<bool> &fi)

Reimplement this function. It is called when the target is built. By default, this function is NOT run in the GUI thread, but 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

The absolute minimal implementation is:

      fi.reportResult(true);

By returning `true` from runInGuiThread(), this function is called in the GUI thread. Then the function should not block and instead the finished() signal should be emitted.

See also runInGuiThread().

### `[virtual]` bool BuildStep::runInGuiThread() const

### void BuildStep::setEnabled(bool b)

See also enabled().

### Target *BuildStep::target() const

### `[override virtual]` QVariantMap BuildStep::toMap() const