[gnome-builder] pipeline: add ability to mark a pipeline as failed
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] pipeline: add ability to mark a pipeline as failed
- Date: Fri, 19 Jan 2018 03:00:30 +0000 (UTC)
commit 40e736895978cc5cf24b3eb1639a8186c2cb1ead
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 18 18:47:46 2018 -0800
pipeline: add ability to mark a pipeline as failed
src/libide/buildsystem/ide-build-pipeline.c | 49 ++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index 75a428598..9e081f7eb 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -238,6 +238,13 @@ struct _IdeBuildPipeline
* asynchronously and after the processes/stage has completed.
*/
guint errors_on_stdout : 1;
+
+ /*
+ * This is set to TRUE if the pipeline has failed initialization. That means
+ * that all future operations will fail (but we can keep the object alive to
+ * ensure that the manager has a valid object instance for the pipeline).
+ */
+ guint broken : 1;
};
typedef enum
@@ -631,6 +638,25 @@ ide_build_pipeline_release_transients (IdeBuildPipeline *self)
IDE_EXIT;
}
+static gboolean
+ide_build_pipeline_check_ready (IdeBuildPipeline *self,
+ GTask *task)
+{
+ g_assert (IDE_IS_BUILD_PIPELINE (self));
+ g_assert (G_IS_TASK (task));
+
+ if (self->broken)
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ _("The build pipeline is in a failed state"));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/**
* ide_build_pipeline_get_phase:
*
@@ -1554,7 +1580,8 @@ ide_build_pipeline_build_async (IdeBuildPipeline *self,
g_task_set_source_tag (task, ide_build_pipeline_build_async);
g_task_set_priority (task, G_PRIORITY_LOW);
- dzl_cancellable_chain (cancellable, self->cancellable);
+ if (!ide_build_pipeline_check_ready (self, task))
+ return;
/*
* If the requested phase has already been met (by a previous build
@@ -2757,6 +2784,9 @@ ide_build_pipeline_clean_async (IdeBuildPipeline *self,
g_task_set_priority (task, G_PRIORITY_LOW);
g_task_set_source_tag (task, ide_build_pipeline_clean_async);
+ if (!ide_build_pipeline_check_ready (self, task))
+ return;
+
dzl_cancellable_chain (cancellable, self->cancellable);
td = task_data_new (task, TASK_CLEAN);
@@ -3006,6 +3036,9 @@ ide_build_pipeline_rebuild_async (IdeBuildPipeline *self,
g_task_set_priority (task, G_PRIORITY_LOW);
g_task_set_source_tag (task, ide_build_pipeline_rebuild_async);
+ if (!ide_build_pipeline_check_ready (self, task))
+ return;
+
td = task_data_new (task, TASK_REBUILD);
td->phase = phase;
g_task_set_task_data (task, td, task_data_free);
@@ -3050,6 +3083,9 @@ ide_build_pipeline_get_can_export (IdeBuildPipeline *self)
{
g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), FALSE);
+ if (self->broken)
+ return FALSE;
+
for (guint i = 0; i < self->pipeline->len; i++)
{
const PipelineEntry *entry = &g_array_index (self->pipeline, PipelineEntry, i);
@@ -3117,6 +3153,9 @@ ide_build_pipeline_has_configured (IdeBuildPipeline *self)
{
g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), FALSE);
+ if (self->broken)
+ return FALSE;
+
/*
* We need to walk from beginning towards end (instead of
* taking a cleaner approach that would be to walk from the
@@ -3168,3 +3207,11 @@ ide_build_pipeline_has_configured (IdeBuildPipeline *self)
return FALSE;
}
+
+void
+_ide_build_pipeline_mark_broken (IdeBuildPipeline *self)
+{
+ g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
+
+ self->broken = TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]