[gnome-builder/wip/gtk4-port] plugins/autotools: use pipeline to get launcher
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/autotools: use pipeline to get launcher
- Date: Tue, 28 Jun 2022 19:27:59 +0000 (UTC)
commit f89a34f9c45024fd8665e9eabced529272eb18ac
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 28 12:21:23 2022 -0700
plugins/autotools: use pipeline to get launcher
This switches to using the pipeline to get a launcher so that we don't
have to rely directly on the runtime for a launcher.
.../autotools/ide-autotools-makecache-stage.c | 32 +++++++++++++---------
src/plugins/autotools/ide-makecache.c | 19 ++++++-------
src/plugins/autotools/ide-makecache.h | 1 +
3 files changed, 28 insertions(+), 24 deletions(-)
---
diff --git a/src/plugins/autotools/ide-autotools-makecache-stage.c
b/src/plugins/autotools/ide-autotools-makecache-stage.c
index c9f292e57..abb31fefc 100644
--- a/src/plugins/autotools/ide-autotools-makecache-stage.c
+++ b/src/plugins/autotools/ide-autotools-makecache-stage.c
@@ -73,14 +73,15 @@ ide_autotools_makecache_stage_makecache_cb (GObject *object,
static void
ide_autotools_makecache_stage_build_cb (GObject *object,
- GAsyncResult *result,
- gpointer user_data)
+ GAsyncResult *result,
+ gpointer user_data)
{
IdeAutotoolsMakecacheStage *self = (IdeAutotoolsMakecacheStage *)object;
IdePipelineStage *stage = (IdePipelineStage *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
GCancellable *cancellable;
+ IdePipeline *pipeline;
IDE_ENTRY;
@@ -97,7 +98,10 @@ ide_autotools_makecache_stage_build_cb (GObject *object,
}
cancellable = ide_task_get_cancellable (task);
+ pipeline = ide_task_get_task_data (task);
+
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+ g_assert (IDE_IS_PIPELINE (pipeline));
/*
* Now that we have our makecache file created, we can mmap() it into our
@@ -105,6 +109,7 @@ ide_autotools_makecache_stage_build_cb (GObject *object,
*/
ide_makecache_new_for_cache_file_async (self->runtime,
+ pipeline,
self->cache_file,
cancellable,
ide_autotools_makecache_stage_makecache_cb,
@@ -114,11 +119,11 @@ ide_autotools_makecache_stage_build_cb (GObject *object,
}
static void
-ide_autotools_makecache_stage_build_async (IdePipelineStage *stage,
- IdePipeline *pipeline,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ide_autotools_makecache_stage_build_async (IdePipelineStage *stage,
+ IdePipeline *pipeline,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
IdeAutotoolsMakecacheStage *self = (IdeAutotoolsMakecacheStage *)stage;
g_autoptr(IdeTask) task = NULL;
@@ -131,6 +136,7 @@ ide_autotools_makecache_stage_build_async (IdePipelineStage *stage,
task = ide_task_new (self, cancellable, callback, user_data);
ide_task_set_source_tag (task, ide_autotools_makecache_stage_build_async);
+ ide_task_set_task_data (task, g_object_ref (pipeline), g_object_unref);
/*
* First we need to build our launcher (performed by our parent class).
@@ -139,18 +145,18 @@ ide_autotools_makecache_stage_build_async (IdePipelineStage *stage,
*/
IDE_PIPELINE_STAGE_CLASS (ide_autotools_makecache_stage_parent_class)->build_async (stage,
- pipeline,
- cancellable,
-
ide_autotools_makecache_stage_build_cb,
- g_steal_pointer
(&task));
+ pipeline,
+ cancellable,
+
ide_autotools_makecache_stage_build_cb,
+ g_steal_pointer
(&task));
IDE_EXIT;
}
static gboolean
ide_autotools_makecache_stage_build_finish (IdePipelineStage *stage,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
gboolean ret;
diff --git a/src/plugins/autotools/ide-makecache.c b/src/plugins/autotools/ide-makecache.c
index ee535fe27..c68fbf4f7 100644
--- a/src/plugins/autotools/ide-makecache.c
+++ b/src/plugins/autotools/ide-makecache.c
@@ -55,6 +55,7 @@ struct _IdeMakecache
IdeTaskCache *file_flags_cache;
GPtrArray *build_targets;
IdeRuntime *runtime;
+ IdePipeline *pipeline;
const gchar *make_name;
};
@@ -708,11 +709,8 @@ ide_makecache_get_file_flags_worker (GTask *task,
}
#endif
- launcher = ide_runtime_create_launcher (lookup->self->runtime, &error);
-
- if (launcher == NULL)
+ if (!(launcher = ide_pipeline_create_launcher (lookup->self->pipeline, &error)))
{
- g_assert (error != NULL);
g_task_return_error (task, g_steal_pointer (&error));
IDE_EXIT;
}
@@ -1043,6 +1041,7 @@ ide_makecache_finalize (GObject *object)
g_clear_object (&self->file_targets_cache);
g_clear_object (&self->file_flags_cache);
g_clear_object (&self->runtime);
+ g_clear_object (&self->pipeline);
g_clear_object (&self->parent);
g_clear_pointer (&self->mapped, g_mapped_file_unref);
@@ -1115,6 +1114,7 @@ ide_makecache_validate_worker (GTask *task,
void
ide_makecache_new_for_cache_file_async (IdeRuntime *runtime,
+ IdePipeline *pipeline,
GFile *cache_file,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -1130,6 +1130,7 @@ ide_makecache_new_for_cache_file_async (IdeRuntime *runtime,
IDE_ENTRY;
g_return_if_fail (IDE_IS_RUNTIME (runtime));
+ g_return_if_fail (IDE_IS_PIPELINE (pipeline));
g_return_if_fail (G_IS_FILE (cache_file));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
@@ -1180,6 +1181,7 @@ ide_makecache_new_for_cache_file_async (IdeRuntime *runtime,
self->parent = g_steal_pointer (&parent);
self->mapped = g_steal_pointer (&mapped);
self->runtime = g_object_ref (runtime);
+ self->pipeline = g_object_ref (pipeline);
if (ide_runtime_contains_program_in_path (runtime, "gmake", NULL))
self->make_name = "gmake";
@@ -1703,7 +1705,6 @@ ide_makecache_get_build_targets_async (IdeMakecache *self,
{
g_autoptr(GTask) task = NULL;
GetBuildTargets *data;
- IdeRuntime *runtime;
GPtrArray *ret;
guint i;
@@ -1719,12 +1720,8 @@ ide_makecache_get_build_targets_async (IdeMakecache *self,
data->context = ide_object_ref_context (IDE_OBJECT (self));
data->configmgr = ide_config_manager_from_context (data->context);
data->config = ide_config_manager_get_current (data->configmgr);
-
- if ((runtime = ide_config_get_runtime (data->config)))
- {
- data->runtime = g_object_ref (runtime);
- data->launcher = ide_runtime_create_launcher (runtime, NULL);
- }
+ data->runtime = g_object_ref (self->runtime);
+ data->launcher = ide_pipeline_create_launcher (self->pipeline, NULL);
g_task_set_task_data (task, data, (GDestroyNotify)get_build_targets_free);
diff --git a/src/plugins/autotools/ide-makecache.h b/src/plugins/autotools/ide-makecache.h
index 75604b247..d9dd9cfc3 100644
--- a/src/plugins/autotools/ide-makecache.h
+++ b/src/plugins/autotools/ide-makecache.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (IdeMakecache, ide_makecache, IDE, MAKECACHE, IdeObject)
void ide_makecache_new_for_cache_file_async (IdeRuntime *runtime,
+ IdePipeline *pipeline,
GFile *cache_file,
GCancellable *cancellable,
GAsyncReadyCallback callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]