[gnome-builder] libide/foundry: set runtime early when possible



commit f44bec66f319691ed061a584ed3528c35d47f247
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 29 23:07:25 2022 -0700

    libide/foundry: set runtime early when possible
    
    This is useful because it means we can have a builddir earlier in the
    process. We still need to catch some situations where plugins are trying
    to access the pipeline before it's marked ready.

 src/libide/foundry/ide-runtime-manager.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/foundry/ide-runtime-manager.c b/src/libide/foundry/ide-runtime-manager.c
index 808823223..1813219fc 100644
--- a/src/libide/foundry/ide-runtime-manager.c
+++ b/src/libide/foundry/ide-runtime-manager.c
@@ -322,7 +322,7 @@ ide_runtime_manager_prepare_cb (GObject      *object,
 
 void
 _ide_runtime_manager_prepare_async (IdeRuntimeManager   *self,
-                                    IdePipeline    *pipeline,
+                                    IdePipeline         *pipeline,
                                     GCancellable        *cancellable,
                                     GAsyncReadyCallback  callback,
                                     gpointer             user_data)
@@ -332,6 +332,7 @@ _ide_runtime_manager_prepare_async (IdeRuntimeManager   *self,
   PrepareState *state;
   const gchar *runtime_id;
   InstallLookup lookup = { 0 };
+  IdeRuntime *runtime;
 
   IDE_ENTRY;
 
@@ -366,8 +367,8 @@ _ide_runtime_manager_prepare_async (IdeRuntimeManager   *self,
    * the runtime as already registered. But that isn't enough since we
    * might need to also install an SDK.
    */
-
-  lookup.runtime_id = runtime_id;
+  if ((runtime = ide_runtime_manager_get_runtime (self, runtime_id)))
+    _ide_pipeline_set_runtime (pipeline, runtime);
 
   /*
    * Detect extensions that are a runtime-provider for the configured runtime_id.
@@ -375,6 +376,7 @@ _ide_runtime_manager_prepare_async (IdeRuntimeManager   *self,
    * that they do provide the runtime for the current runtime_id. The runtime can then
    * use the bootstrap_async method to finish the setup and let us know when it's ready.
    */
+  lookup.runtime_id = runtime_id;
   ide_extension_set_adapter_foreach (self->extensions,
                                      (IdeExtensionSetAdapterForeachFunc) provides_lookup_cb,
                                      &lookup);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]