## IdeBuildManager IdeBuildManager — Manages the active build configuration and pipeline |

## Functions

IdeBuildManager * | ide_build_manager_from_context ()
IdeBuildManager * | ide_build_manager_ref_from_context ()
gboolean | ide_build_manager_get_busy ()
gboolean | ide_build_manager_get_can_build ()
guint | ide_build_manager_get_error_count ()
guint | ide_build_manager_get_warning_count ()
gchar * | ide_build_manager_get_message ()
GDateTime * | ide_build_manager_get_last_build_time ()
GTimeSpan | ide_build_manager_get_running_time ()
void | ide_build_manager_invalidate ()
void | ide_build_manager_cancel ()
IdePipeline * | ide_build_manager_get_pipeline ()
IdePipeline * | ide_build_manager_ref_pipeline ()
void | ide_build_manager_rebuild_async ()
gboolean | ide_build_manager_rebuild_finish ()
void | ide_build_manager_build_async ()
gboolean | ide_build_manager_build_finish ()
void | ide_build_manager_clean_async ()
gboolean | ide_build_manager_clean_finish ()

## Properties

gboolean | busy | Read
gboolean | can-build | Read
guint | error-count | Read
gboolean | has-diagnostics | Read
GDateTime * | last-build-time | Read
gchar * | message | Read
IdePipeline * | pipeline | Read
gint64 | running-time | Read
guint | warning-count | Read

## Signals

void | build-failed | Run Last
void | build-finished | Run Last
void | build-started | Run Last

## Types and Values

#define | IDE_TYPE_BUILD_MANAGER
| IdeBuildManager

## Object Hierarchy

        GObject
        ╰── IdeObject
            ╰── IdeBuildManager

## Implemented Interfaces

IdeBuildManager implements GInitable and GActionGroup.

## Description

The IdeBuildManager is responsible for managing the active build pipeline as well as providing common high-level actions to plugins.

You can use various async operations such as `ide_build_manager_build_async()`, `ide_build_manager_clean_async()`, or `ide_build_manager_rebuild_async()` to build, clean, and rebuild respectively without needing to track the build pipeline.

The IdePipeline is used to specify how and when build operations should occur. Plugins attach build stages to the pipeline to perform build actions.

## Functions

### ide_build_manager_from_context ()

    IdeBuildManager *
    ide_build_manager_from_context (IdeContext *context);

#### Parameters

context | a IdeContext |

#### Returns

an IdeBuildManager.

[transfer none]

Since: 3.32

### ide_build_manager_ref_from_context ()

    IdeBuildManager *
    ide_build_manager_ref_from_context (IdeContext *context);

#### Parameters

context | a IdeContext |

#### Returns

an IdeBuildManager.

[transfer full]

Since: 3.32

### ide_build_manager_get_busy ()

    gboolean
    ide_build_manager_get_busy (IdeBuildManager *self);

Gets if the IdeBuildManager is currently busy building the project.

See “busy” for more information.

#### Parameters

self | An IdeBuildManager |

Since: 3.32

### ide_build_manager_get_can_build ()

    gboolean
    ide_build_manager_get_can_build (IdeBuildManager *self);

Checks if the current pipeline is ready to build.

#### Parameters

self | a IdeBuildManager |

#### Returns

`TRUE` if a build operation can advance the pipeline.

Since: 3.32

### ide_build_manager_get_error_count ()

    guint
    ide_build_manager_get_error_count (IdeBuildManager *self);

### ide_build_manager_get_warning_count ()

    guint
    ide_build_manager_get_warning_count (IdeBuildManager *self);

### ide_build_manager_get_message ()

    gchar *
    ide_build_manager_get_message (IdeBuildManager *self);

This function returns the current build message as a string.

See “message” for more information.

#### Parameters

self | An IdeBuildManager |

#### Returns

A string containing the build message or `NULL`.

[transfer full]

Since: 3.32

### ide_build_manager_get_last_build_time ()

    GDateTime *
    ide_build_manager_get_last_build_time (IdeBuildManager *self);

This function returns a GDateTime of the last build request. If there has not yet been a build request, this will return `NULL`.

See “last-build-time” for more information.

#### Parameters

self | An IdeBuildManager |

#### Returns

a GDateTime or `NULL`.

[nullable][transfer none]

Since: 3.32

### ide_build_manager_get_running_time ()

    GTimeSpan
    ide_build_manager_get_running_time (IdeBuildManager *self);

Gets the amount of elapsed time of the current build as a GTimeSpan.

#### Returns

a GTimeSpan containing the elapsed time of the build.

Since: 3.32

### ide_build_manager_invalidate ()

    void
    ide_build_manager_invalidate (IdeBuildManager *self);

Requests that the IdeBuildManager invalidate the current pipeline and setup a new pipeline.

#### Parameters

self | a IdeBuildManager |

Since: 3.32

### ide_build_manager_cancel ()

    void
    ide_build_manager_cancel (IdeBuildManager *self);

This function will cancel any in-flight builds.

You may also activate this using the "cancel" GAction provided by the GActionGroup interface.

#### Parameters

self | An IdeBuildManager |

Since: 3.32

### ide_build_manager_get_pipeline ()

    IdePipeline *
    ide_build_manager_get_pipeline (IdeBuildManager *self);

This function gets the current build pipeline. The pipeline will be reloaded as build configurations change.

#### Parameters

self | An IdeBuildManager |

#### Returns

An IdePipeline.

[transfer none][nullable]

Since: 3.32

### ide_build_manager_ref_pipeline ()

    IdePipeline *
    ide_build_manager_ref_pipeline (IdeBuildManager *self);

A thread-safe variant of `ide_build_manager_get_pipeline()`.

#### Parameters

self | a IdeBuildManager |

#### Returns

an IdePipeline or `NULL`.

[transfer full][nullable]

Since: 3.32

### ide_build_manager_rebuild_async ()

    void
    ide_build_manager_rebuild_async (IdeBuildManager *self,
                                     IdePipelinePhase phase,
                                     GPtrArray *targets,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);

Asynchronously requests that the build pipeline clean and rebuild up to the given phase. This may involve discarding previous build artifacts to allow for the rebuild process.

See `ide_pipeline_rebuild_async()` for more information.

#### Parameters

self | a IdeBuildManager |
phase | the build phase to rebuild to |
targets | an array of GPtrArray of IdeBuildTarget or `NULL`. | [element-type IdeBuildTarget][nullable]
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion, or `NULL`. | [nullable]
user_data | closure data for `callback` |

Since: 3.32

### ide_build_manager_rebuild_finish ()

    gboolean
    ide_build_manager_rebuild_finish (IdeBuildManager *self,
                                      GAsyncResult *result,
                                      GError **error);

Completes an asynchronous request to `ide_build_manager_rebuild_async()`.

#### Parameters

self | a IdeBuildManager |
result | a GAsyncResult |
error | a location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

Since: 3.32

### ide_build_manager_build_async ()

    void
    ide_build_manager_build_async (IdeBuildManager *self,
                                   IdePipelinePhase phase,
                                   GPtrArray *targets,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

This function will request that `phase` is completed in the underlying build pipeline and execute a build. Upon completion, `callback` will be executed and it can determine the success or failure of the operation using `ide_build_manager_build_finish()`.

#### Parameters

self | An IdeBuildManager |
phase | An IdePipelinePhase or 0 |
targets | an array of IdeBuildTarget to build. | [nullable][element-type IdeBuildTarget]
cancellable | a GCancellable or `NULL`. | [nullable]
callback | A callback to execute upon completion |
user_data | user data for `callback` |

Since: 3.32

### ide_build_manager_build_finish ()

    gboolean
    ide_build_manager_build_finish (IdeBuildManager *self,
                                    GAsyncResult *result,
                                    GError **error);

Completes a request to `ide_build_manager_build_async()`.

#### Parameters

self | An IdeBuildManager |
result | a GAsyncResult |
error | A location for a GError or `NULL` |

#### Returns

`TRUE` if successful, otherwise `FALSE` and `error` is set.

Since: 3.32

### ide_build_manager_clean_async ()

    void
    ide_build_manager_clean_async (IdeBuildManager *self,
                                   IdePipelinePhase phase,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously requests that the build pipeline clean up to `phase` .

See `ide_pipeline_clean_async()` for more information.

#### Parameters

self | a IdeBuildManager |
phase | the build phase to clean |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion, or `NULL`. | [nullable]
user_data | closure data for `callback` |

Since: 3.32

### ide_build_manager_clean_finish ()

    gboolean
    ide_build_manager_clean_finish (IdeBuildManager *self,
                                    GAsyncResult *result,
                                    GError **error);

Completes an asynchronous request to `ide_build_manager_clean_async()`.

#### Parameters

self | a IdeBuildManager |
result | a GAsyncResult |
error | a location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

Since: 3.32

## Types and Values

### IDE_TYPE_BUILD_MANAGER

    #define IDE_TYPE_BUILD_MANAGER (ide_build_manager_get_type())

### IdeBuildManager

    typedef struct _IdeBuildManager IdeBuildManager;

## Property Details

### The `“busy”` property

      “busy”                     gboolean

The "busy" property indicates if there is currently a build executing. This can be bound to UI elements to display to the user that a build is active (and therefore other builds cannot be activated at the moment).

Owner: IdeBuildManager

Flags: Read

Default value: FALSE

Since: 3.32

### The `“can-build”` property

      “can-build”                gboolean

Gets if the build manager can queue a build request.

This might be false if the required runtime is not available or other errors in setting up the build pipeline.

Owner: IdeBuildManager

Flags: Read

Default value: FALSE

Since: 3.32

### The `“error-count”` property

      “error-count”              guint

The number of errors discovered during the build process.

Owner: IdeBuildManager

Flags: Read

Default value: 0

Since: 3.32

### The `“has-diagnostics”` property

      “has-diagnostics”          gboolean

The "has-diagnostics" property indicates that there have been diagnostics found during the last execution of the build pipeline.

Owner: IdeBuildManager

Flags: Read

Default value: FALSE

Since: 3.32

### The `“last-build-time”` property

      “last-build-time”          GDateTime *

The "last-build-time" property contains a GDateTime of the time the last build request was submitted.

Owner: IdeBuildManager

Flags: Read

Since: 3.32

### The `“message”` property

      “message”                  gchar *

The "message" property contains a string message describing the current state of the build process. This may be bound to UI elements to notify the user of the buid progress.

Owner: IdeBuildManager

Flags: Read

Default value: NULL

Since: 3.32

### The `“pipeline”` property

      “pipeline”                 IdePipeline *

The "pipeline" property is the build pipeline that the build manager is currently managing.

Owner: IdeBuildManager

Flags: Read

Since: 3.32

### The `“running-time”` property

      “running-time”             gint64

The "running-time" property can be bound by UI elements that want to track how long the current build has taken. `g_object_notify()` is called on a regular interval during the build so that the UI elements may automatically update.

The value of this property is a GTimeSpan, which are 64-bit signed integers with microsecond precision. See `G_USEC_PER_SEC` for a constant to tranform this to seconds.

Owner: IdeBuildManager

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 3.32

### The `“warning-count”` property

      “warning-count”            guint

The "warning-count" property contains the number of warnings that have been discovered in the current build request.

Owner: IdeBuildManager

Flags: Read

Default value: 0

Since: 3.32

## Signal Details

### The `“build-failed”` signal

    void
    user_function (IdeBuildManager *self,
                   IdePipeline     *pipeline,
                   gpointer         user_data)

The "build-failed" signal is emitted when a build that was previously notified via “build-started” has failed to complete successfully.

Contrast this with “build-finished” for a successful build.

#### Parameters

self | An IdeBuildManager |
pipeline | An IdePipeline |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32

### The `“build-finished”` signal

    void
    user_function (IdeBuildManager *self,
                   IdePipeline     *pipeline,
                   gpointer         user_data)

The "build-finished" signal is emitted when a build completed successfully.

#### Parameters

self | An IdeBuildManager |
pipeline | An IdePipeline |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32

### The `“build-started”` signal

    void
    user_function (IdeBuildManager *self,
                   IdePipeline     *pipeline,
                   gpointer         user_data)

The "build-started" signal is emitted when a new build has started. The build may be an incremental build. The `pipeline` instance is the build pipeline which is being executed.

#### Parameters

self | An IdeBuildManager |
pipeline | An IdePipeline |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32