[gnome-builder/wip/chergert/pipeline] wip: start on build pipeline/stages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/pipeline] wip: start on build pipeline/stages
- Date: Wed, 14 Dec 2016 08:12:16 +0000 (UTC)
commit b89ac5e95c8bfc9a7170ab85c3fdb1817876eb6c
Author: Christian Hergert <chergert redhat com>
Date: Wed Dec 14 00:11:50 2016 -0800
wip: start on build pipeline/stages
libide/Makefile.am | 5 +
libide/buildsystem/ide-build-pipeline.c | 408 +++++++++++++++++++++++++++++++
libide/buildsystem/ide-build-pipeline.h | 74 ++++++
libide/buildsystem/ide-build-stage.c | 214 ++++++++++++++++
libide/buildsystem/ide-build-stage.h | 76 ++++++
libide/ide-enums.c.in | 1 +
libide/ide-types.h | 4 +-
libide/ide.h | 2 +
8 files changed, 783 insertions(+), 1 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 987d890..0a075bb 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -33,6 +33,8 @@ libide_1_0_la_public_headers = \
buildsystem/ide-build-command.h \
buildsystem/ide-build-command-queue.h \
buildsystem/ide-build-manager.h \
+ buildsystem/ide-build-pipeline.h \
+ buildsystem/ide-build-stage.h \
buildsystem/ide-build-result-addin.h \
buildsystem/ide-build-result.h \
buildsystem/ide-build-system.h \
@@ -208,6 +210,8 @@ libide_1_0_la_public_sources = \
buildsystem/ide-build-command.c \
buildsystem/ide-build-command-queue.c \
buildsystem/ide-build-manager.c \
+ buildsystem/ide-build-pipeline.c \
+ buildsystem/ide-build-stage.c \
buildsystem/ide-build-result-addin.c \
buildsystem/ide-build-result.c \
buildsystem/ide-build-system.c \
@@ -612,6 +616,7 @@ endif
glib_enum_headers = \
buffers/ide-buffer.h \
+ buildsystem/ide-build-pipeline.h \
buildsystem/ide-build-result.h \
devices/ide-device.h \
diagnostics/ide-diagnostic.h \
diff --git a/libide/buildsystem/ide-build-pipeline.c b/libide/buildsystem/ide-build-pipeline.c
new file mode 100644
index 0000000..5152003
--- /dev/null
+++ b/libide/buildsystem/ide-build-pipeline.c
@@ -0,0 +1,408 @@
+/* ide-build-pipeline.c
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-build-pipeline"
+
+#include "ide-debug.h"
+#include "ide-enums.h"
+
+#include "buildsystem/ide-build-pipeline.h"
+
+typedef struct
+{
+ IdeBuildPhase phase;
+ gint priority;
+ IdeBuildStage *stage;
+} PipelineEntry;
+
+struct _IdeBuildPipeline
+{
+ IdeObject parent_instance;
+ IdeConfiguration *configuration;
+ GArray *pipeline;
+ gint position;
+ IdeBuildPhase requested_mask;
+ guint failed : 1;
+};
+
+static void ide_build_pipeline_tick (IdeBuildPipeline *self,
+ GTask *task);
+
+G_DEFINE_TYPE (IdeBuildPipeline, ide_build_pipeline, IDE_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_CONFIGURATION,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+IdeBuildPhase
+ide_build_pipeline_get_phase (IdeBuildPipeline *self)
+{
+ g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), 0);
+
+ if (self->position < 0)
+ return IDE_BUILD_PHASE_NONE;
+ else if (self->position < self->pipeline->len)
+ return g_array_index (self->pipeline, PipelineEntry, self->position).phase;
+ else if (self->failed)
+ return IDE_BUILD_PHASE_FAILED;
+ else
+ return IDE_BUILD_PHASE_FINISHED;
+}
+
+/**
+ * ide_build_pipeline_get_configuration:
+ *
+ * Gets the #IdeConfiguration to use for the pipeline.
+ *
+ * Returns: (transfer none): An #IdeConfiguration
+ */
+IdeConfiguration *
+ide_build_pipeline_get_configuration (IdeBuildPipeline *self)
+{
+ g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), NULL);
+
+ return self->configuration;
+}
+
+static void
+clear_pipeline_entry (gpointer data)
+{
+ PipelineEntry *entry = data;
+
+ g_clear_object (&entry->stage);
+}
+
+static gint
+pipeline_entry_compare (gconstpointer a,
+ gconstpointer b)
+{
+ const PipelineEntry *entry_a = a;
+ const PipelineEntry *entry_b = b;
+ gint ret;
+
+ ret = (gint)entry_a->phase - (gint)entry_b->phase;
+
+ if (ret == 0)
+ ret = entry_a->priority - entry_b->priority;
+
+ return ret;
+}
+
+static void
+ide_build_pipeline_set_configuration (IdeBuildPipeline *self,
+ IdeConfiguration *configuration)
+{
+ g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
+ g_return_if_fail (IDE_IS_CONFIGURATION (configuration));
+
+ g_set_object (&self->configuration, configuration);
+}
+
+static void
+ide_build_pipeline_finalize (GObject *object)
+{
+ IdeBuildPipeline *self = (IdeBuildPipeline *)object;
+
+ g_clear_object (&self->configuration);
+ g_clear_pointer (&self->pipeline, g_array_unref);
+
+ G_OBJECT_CLASS (ide_build_pipeline_parent_class)->finalize (object);
+}
+
+static void
+ide_build_pipeline_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ IdeBuildPipeline *self = IDE_BUILD_PIPELINE (object);
+
+ switch (prop_id)
+ {
+ case PROP_CONFIGURATION:
+ g_value_set_object (value, ide_build_pipeline_get_configuration (self));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_build_pipeline_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ IdeBuildPipeline *self = IDE_BUILD_PIPELINE (object);
+
+ switch (prop_id)
+ {
+ case PROP_CONFIGURATION:
+ ide_build_pipeline_set_configuration (self, g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_build_pipeline_class_init (IdeBuildPipelineClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = ide_build_pipeline_finalize;
+ object_class->get_property = ide_build_pipeline_get_property;
+ object_class->set_property = ide_build_pipeline_set_property;
+
+ /**
+ * IdeBuildPipeline:configuration:
+ *
+ * The configuration to use for the build pipeline.
+ */
+ properties [PROP_CONFIGURATION] =
+ g_param_spec_object ("configuration",
+ "Configuration",
+ "Configuration",
+ IDE_TYPE_CONFIGURATION,
+ (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_properties (object_class, N_PROPS, properties);
+}
+
+static void
+ide_build_pipeline_init (IdeBuildPipeline *self)
+{
+ self->position = -1;
+ self->pipeline = g_array_new (FALSE, FALSE, sizeof (PipelineEntry));
+ g_array_set_clear_func (self->pipeline, clear_pipeline_entry);
+}
+
+static void
+ide_build_pipeline_stage_execute_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ IdeBuildStage *stage = (IdeBuildStage *)object;
+ IdeBuildPipeline *self;
+ g_autoptr(GTask) task = user_data;
+ g_autoptr(GError) error = NULL;
+
+ g_assert (IDE_IS_BUILD_STAGE (stage));
+ g_assert (G_IS_ASYNC_RESULT (result));
+ g_assert (G_IS_TASK (task));
+
+ self = g_task_get_source_object (task);
+ g_assert (IDE_IS_BUILD_PIPELINE (self));
+
+ if (!ide_build_stage_execute_finish (stage, result, &error))
+ {
+ self->failed = TRUE;
+ g_task_return_error (task, g_steal_pointer (&error));
+ return;
+ }
+
+ ide_build_pipeline_tick (self, task);
+}
+
+static void
+ide_build_pipeline_tick (IdeBuildPipeline *self,
+ GTask *task)
+{
+ GCancellable *cancellable;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_BUILD_PIPELINE (self));
+ g_assert (G_IS_TASK (task));
+
+ cancellable = g_task_get_cancellable (task);
+
+ for (self->position++; self->position < self->pipeline->len; self->position++)
+ {
+ const PipelineEntry *entry = &g_array_index (self->pipeline, PipelineEntry, self->position);
+
+ g_assert (entry->stage != NULL);
+ g_assert (IDE_IS_BUILD_STAGE (entry->stage));
+
+ if (entry->phase & self->requested_mask)
+ {
+ ide_build_stage_execute_async (entry->stage,
+ cancellable,
+ ide_build_pipeline_stage_execute_cb,
+ g_object_ref (task));
+ IDE_EXIT;
+ }
+ }
+
+ g_task_return_boolean (task, TRUE);
+
+ IDE_EXIT;
+}
+
+/**
+ * ide_build_pipeline_execute_async:
+ *
+ * Asynchronously starts the build pipeline.
+ */
+void
+ide_build_pipeline_execute_async (IdeBuildPipeline *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_autoptr(GTask) task = NULL;
+
+ IDE_ENTRY;
+
+ g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
+ g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, ide_build_pipeline_execute_async);
+
+ ide_build_pipeline_tick (self, task);
+
+ IDE_EXIT;
+}
+
+/**
+ * ide_build_pipeline_execute_finish:
+ *
+ * Returns: %TRUE if successful; otherwise %FALSE and @error is set.
+ */
+gboolean
+ide_build_pipeline_execute_finish (IdeBuildPipeline *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ gboolean ret;
+
+ IDE_ENTRY;
+
+ g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), FALSE);
+ g_return_val_if_fail (G_IS_TASK (result), FALSE);
+
+ ret = g_task_propagate_boolean (G_TASK (result), error);
+
+ IDE_RETURN (ret);
+}
+
+void
+ide_build_pipeline_insert_stage (IdeBuildPipeline *self,
+ IdeBuildPhase phase,
+ gint priority,
+ IdeBuildStage *stage)
+{
+ GFlagsClass *klass;
+
+ IDE_ENTRY;
+
+ g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
+ g_return_if_fail (IDE_IS_BUILD_STAGE (stage));
+ g_return_if_fail (phase != IDE_BUILD_PHASE_NONE);
+ g_return_if_fail (phase != IDE_BUILD_PHASE_FINISHED);
+ g_return_if_fail (phase != IDE_BUILD_PHASE_FAILED);
+
+ if G_UNLIKELY (self->position != -1)
+ {
+ g_warning ("Cannot insert stage into pipeline after execution, ignoring");
+ return;
+ }
+
+ klass = g_type_class_ref (IDE_TYPE_BUILD_PHASE);
+
+ for (guint i = 0; i < klass->n_values; i++)
+ {
+ const GFlagsValue *value = &klass->values[i];
+
+ if (phase == value->value)
+ {
+ PipelineEntry entry = { 0 };
+
+ IDE_TRACE_MSG ("Adding stage to pipeline with phase %s and priority %d",
+ value->value_nick, priority);
+
+ entry.phase = phase;
+ entry.priority = priority;
+ entry.stage = g_object_ref (stage);
+
+ g_array_append_val (self->pipeline, entry);
+ g_array_sort (self->pipeline, pipeline_entry_compare);
+
+ IDE_GOTO (cleanup);
+ }
+ }
+
+ g_warning ("No such pipeline phase %02x", phase);
+
+cleanup:
+ g_type_class_unref (klass);
+
+ IDE_EXIT;
+}
+
+void
+ide_build_pipeline_request_phase (IdeBuildPipeline *self,
+ IdeBuildPhase phase)
+{
+ GFlagsClass *klass;
+
+ IDE_ENTRY;
+
+ g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
+ g_return_if_fail (phase != IDE_BUILD_PHASE_NONE);
+ g_return_if_fail (phase != IDE_BUILD_PHASE_FINISHED);
+ g_return_if_fail (phase != IDE_BUILD_PHASE_FAILED);
+
+ if (self->position != -1)
+ {
+ g_warning ("Cannot request phase after execution has started");
+ IDE_EXIT;
+ }
+
+ klass = g_type_class_ref (IDE_TYPE_BUILD_PHASE);
+
+ for (guint i = 0; i < klass->n_values; i++)
+ {
+ const GFlagsValue *value = &klass->values[i];
+
+ if (phase == value->value)
+ {
+ IDE_TRACE_MSG ("requesting pipeline phase %s", value->value_nick);
+ /*
+ * Each flag is a power of two, so we can simply subtract one
+ * to get a mask of all the previous phases.
+ */
+ self->requested_mask |= phase | (phase - 1);
+ IDE_GOTO (cleanup);
+ }
+ }
+
+ g_warning ("No such phase %02x", (guint)phase);
+
+cleanup:
+ g_type_class_unref (klass);
+
+ IDE_EXIT;
+}
diff --git a/libide/buildsystem/ide-build-pipeline.h b/libide/buildsystem/ide-build-pipeline.h
new file mode 100644
index 0000000..f31aa91
--- /dev/null
+++ b/libide/buildsystem/ide-build-pipeline.h
@@ -0,0 +1,74 @@
+/* ide-build-pipeline.h
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_BUILD_PIPELINE_H
+#define IDE_BUILD_PIPELINE_H
+
+#include <gio/gio.h>
+
+#include "ide-types.h"
+
+#include "buildsystem/ide-build-stage.h"
+#include "buildsystem/ide-configuration.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_BUILD_PIPELINE (ide_build_pipeline_get_type())
+
+typedef enum
+{
+ IDE_BUILD_PHASE_NONE = 0,
+
+ IDE_BUILD_PHASE_PREPARE = 1 << 0,
+
+ IDE_BUILD_PHASE_PREBUILD = 1 << 1,
+ IDE_BUILD_PHASE_BUILD = 1 << 2,
+ IDE_BUILD_PHASE_POSTBUILD = 1 << 3,
+
+ IDE_BUILD_PHASE_PREINSTALL = 1 << 4,
+ IDE_BUILD_PHASE_INSTALL = 1 << 5,
+ IDE_BUILD_PHASE_POSTINSTALL = 1 << 6,
+
+ IDE_BUILD_PHASE_PREEXPORT = 1 << 7,
+ IDE_BUILD_PHASE_EXPORT = 1 << 8,
+ IDE_BUILD_PHASE_POSTEXPORT = 1 << 9,
+
+ IDE_BUILD_PHASE_FINISHED = 1 << 14,
+ IDE_BUILD_PHASE_FAILED = 1 << 15,
+} IdeBuildPhase;
+
+G_DECLARE_FINAL_TYPE (IdeBuildPipeline, ide_build_pipeline, IDE, BUILD_PIPELINE, IdeObject)
+
+IdeConfiguration *ide_build_pipeline_get_configuration (IdeBuildPipeline *self);
+void ide_build_pipeline_request_phase (IdeBuildPipeline *self,
+ IdeBuildPhase phase);
+void ide_build_pipeline_insert_stage (IdeBuildPipeline *self,
+ IdeBuildPhase phase,
+ gint priority,
+ IdeBuildStage *stage);
+void ide_build_pipeline_execute_async (IdeBuildPipeline *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean ide_build_pipeline_execute_finish (IdeBuildPipeline *self,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* IDE_BUILD_PIPELINE_H */
diff --git a/libide/buildsystem/ide-build-stage.c b/libide/buildsystem/ide-build-stage.c
new file mode 100644
index 0000000..87a13c9
--- /dev/null
+++ b/libide/buildsystem/ide-build-stage.c
@@ -0,0 +1,214 @@
+/* ide-build-stage.c
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-build-stage"
+
+#include "ide-build-stage.h"
+
+typedef struct
+{
+ gchar *name;
+} IdeBuildStagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeBuildStage, ide_build_stage, IDE_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static gboolean
+ide_build_stage_real_execute (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return TRUE;
+}
+
+static void
+ide_build_stage_real_execute_worker (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ g_task_return_boolean (task, TRUE);
+}
+
+static void
+ide_build_stage_real_execute_async (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_autoptr(GTask) task = NULL;
+
+ g_assert (IDE_IS_BUILD_STAGE (self));
+ g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, ide_build_stage_real_execute_async);
+ g_task_run_in_thread (task, ide_build_stage_real_execute_worker);
+}
+
+static gboolean
+ide_build_stage_real_execute_finish (IdeBuildStage *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_assert (IDE_IS_BUILD_STAGE (self));
+ g_assert (G_IS_TASK (result));
+
+ return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+IdeBuildStage *
+ide_build_stage_new (void)
+{
+ return g_object_new (IDE_TYPE_BUILD_STAGE, NULL);
+}
+
+const gchar *
+ide_build_stage_get_name (IdeBuildStage *self)
+{
+ IdeBuildStagePrivate *priv = ide_build_stage_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_BUILD_STAGE (self), NULL);
+
+ return priv->name;
+}
+
+void
+ide_build_stage_set_name (IdeBuildStage *self,
+ const gchar *name)
+{
+ IdeBuildStagePrivate *priv = ide_build_stage_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_BUILD_STAGE (self));
+
+ if (g_strcmp0 (name, priv->name) != 0)
+ {
+ g_free (priv->name);
+ priv->name = g_strdup (name);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_NAME]);
+ }
+}
+
+static void
+ide_build_stage_finalize (GObject *object)
+{
+ IdeBuildStage *self = (IdeBuildStage *)object;
+ IdeBuildStagePrivate *priv = ide_build_stage_get_instance_private (self);
+
+ g_clear_pointer (&priv->name, g_free);
+
+ G_OBJECT_CLASS (ide_build_stage_parent_class)->finalize (object);
+}
+
+static void
+ide_build_stage_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ IdeBuildStage *self = IDE_BUILD_STAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ g_value_set_string (value, ide_build_stage_get_name (self));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_build_stage_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ IdeBuildStage *self = IDE_BUILD_STAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ ide_build_stage_set_name (self, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_build_stage_class_init (IdeBuildStageClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = ide_build_stage_finalize;
+ object_class->get_property = ide_build_stage_get_property;
+ object_class->set_property = ide_build_stage_set_property;
+
+ klass->execute = ide_build_stage_real_execute;
+ klass->execute_async = ide_build_stage_real_execute_async;
+ klass->execute_finish = ide_build_stage_real_execute_finish;
+
+ properties [PROP_NAME] =
+ g_param_spec_string ("name",
+ "Name",
+ "The user visible name of the stage",
+ NULL,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_properties (object_class, N_PROPS, properties);
+}
+
+static void
+ide_build_stage_init (IdeBuildStage *self)
+{
+}
+
+void
+ide_build_stage_execute_async (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_autoptr(GTask) task = NULL;
+
+ g_return_if_fail (IDE_IS_BUILD_STAGE (self));
+ g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ IDE_BUILD_STAGE_GET_CLASS (self)->execute_async (self, cancellable, callback, user_data);
+}
+
+gboolean
+ide_build_stage_execute_finish (IdeBuildStage *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_return_val_if_fail (IDE_IS_BUILD_STAGE (self), FALSE);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
+
+ return IDE_BUILD_STAGE_GET_CLASS (self)->execute_finish (self, result, error);
+}
diff --git a/libide/buildsystem/ide-build-stage.h b/libide/buildsystem/ide-build-stage.h
new file mode 100644
index 0000000..90747c1
--- /dev/null
+++ b/libide/buildsystem/ide-build-stage.h
@@ -0,0 +1,76 @@
+/* ide-build-stage.h
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_BUILD_STAGE_H
+#define IDE_BUILD_STAGE_H
+
+#include <gio/gio.h>
+
+#include "buildsystem/ide-configuration.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_BUILD_STAGE (ide_build_stage_get_type())
+
+G_DECLARE_DERIVABLE_TYPE (IdeBuildStage, ide_build_stage, IDE, BUILD_STAGE, IdeObject)
+
+struct _IdeBuildStageClass
+{
+ IdeObjectClass parent_class;
+
+ gboolean (*execute) (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GError **error);
+ void (*execute_async) (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*execute_finish) (IdeBuildStage *self,
+ GAsyncResult *result,
+ GError **error);
+
+ gpointer _reserved1;
+ gpointer _reserved2;
+ gpointer _reserved3;
+ gpointer _reserved4;
+ gpointer _reserved5;
+ gpointer _reserved6;
+ gpointer _reserved7;
+ gpointer _reserved8;
+ gpointer _reserved9;
+ gpointer _reserved10;
+ gpointer _reserved11;
+ gpointer _reserved12;
+};
+
+IdeBuildStage *ide_build_stage_new (void);
+const gchar *ide_build_stage_get_name (IdeBuildStage *self);
+void ide_build_stage_set_name (IdeBuildStage *self,
+ const gchar *name);
+void ide_build_stage_execute_async (IdeBuildStage *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean ide_build_stage_execute_finish (IdeBuildStage *self,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* IDE_BUILD_STAGE_H */
+
diff --git a/libide/ide-enums.c.in b/libide/ide-enums.c.in
index 0f71244..3b8c168 100644
--- a/libide/ide-enums.c.in
+++ b/libide/ide-enums.c.in
@@ -5,6 +5,7 @@
#include "ide-enums.h"
#include "buffers/ide-buffer.h"
+#include "buildsystem/ide-build-pipeline.h"
#include "buildsystem/ide-build-result.h"
#include "devices/ide-device.h"
#include "diagnostics/ide-diagnostic.h"
diff --git a/libide/ide-types.h b/libide/ide-types.h
index 230ebaa..49a6316 100644
--- a/libide/ide-types.h
+++ b/libide/ide-types.h
@@ -35,11 +35,13 @@ typedef struct _IdeBufferChangeMonitor IdeBufferChangeMonitor;
typedef struct _IdeBufferManager IdeBufferManager;
-typedef struct _IdeBuilder IdeBuilder;
typedef struct _IdeBuildCommand IdeBuildCommand;
typedef struct _IdeBuildCommandQueue IdeBuildCommandQueue;
+typedef struct _IdeBuilder IdeBuilder;
typedef struct _IdeBuildManager IdeBuildManager;
+typedef struct _IdeBuildPipeline IdeBuildPipeline;
typedef struct _IdeBuildResult IdeBuildResult;
+typedef struct _IdeBuildStage IdeBuildStage;
typedef struct _IdeBuildSystem IdeBuildSystem;
typedef struct _IdeBuildTarget IdeBuildTarget;
diff --git a/libide/ide.h b/libide/ide.h
index 78aa113..0b0a8ff 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -38,8 +38,10 @@ G_BEGIN_DECLS
#include "buildsystem/ide-build-command.h"
#include "buildsystem/ide-build-command-queue.h"
#include "buildsystem/ide-build-manager.h"
+#include "buildsystem/ide-build-pipeline.h"
#include "buildsystem/ide-build-result-addin.h"
#include "buildsystem/ide-build-result.h"
+#include "buildsystem/ide-build-stage.h"
#include "buildsystem/ide-build-system.h"
#include "buildsystem/ide-build-target.h"
#include "buildsystem/ide-builder.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]