[gnome-builder] flatpak: invalidate pipeline after installing runtimes



commit 0f6b6d7a12931feee4253929859ed262a92eddab
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 25 11:08:55 2020 -0800

    flatpak: invalidate pipeline after installing runtimes
    
    If a runtime has been downloaded, we might have new binaries available
    that could be used by the loaded project. Invalidate the pipeline so the
    addins are reloaded.
    
    Without this, a pipeline could be left in a degredaded state where things
    like meson were not discovered.

 src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c 
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 639855961..c9c31b171 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -464,6 +464,28 @@ gbp_flatpak_runtime_provider_locate_sdk_cb (GObject      *object,
   IDE_EXIT;
 }
 
+static void
+install_task_completed_cb (GbpFlatpakRuntimeProvider *self,
+                           GParamSpec                *pspec,
+                           IdeTask                   *task)
+{
+  g_autoptr(IdeContext) context = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_FLATPAK_RUNTIME_PROVIDER (self));
+  g_assert (pspec != NULL);
+  g_assert (IDE_IS_TASK (task));
+
+  context = ide_object_ref_context (IDE_OBJECT (self));
+
+  if (context != NULL)
+    ide_build_manager_invalidate (ide_build_manager_from_context (context));
+
+  IDE_EXIT;
+}
+
 static void
 gbp_flatpak_runtime_provider_install_async (IdeRuntimeProvider  *provider,
                                             const gchar         *runtime_id,
@@ -495,6 +517,16 @@ gbp_flatpak_runtime_provider_install_async (IdeRuntimeProvider  *provider,
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, gbp_flatpak_runtime_provider_install_async);
 
+  /* Track completion so that we can reload the build pipeline. This
+   * may be necessary to pick up new programs like "meson" that are
+   * provided in the SDK which could cause their plugin to not load.
+   */
+  g_signal_connect_object (task,
+                           "notify::completed",
+                           G_CALLBACK (install_task_completed_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   if (!g_str_has_prefix (runtime_id, "flatpak:"))
     IDE_GOTO (unknown_runtime_id);
 


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