[gnome-builder] foundry: drop cached install state on pipeline rebuild/clean



commit 9e132fb38058c4f632f03d7b794cfa458d4ba21d
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 15 16:18:29 2020 -0700

    foundry: drop cached install state on pipeline rebuild/clean
    
    These states can cause the install state to be invalid, and so we need to
    ensure that we do an install again on the next run request.
    
    Fixes #1315

 src/libide/foundry/ide-pipeline.c            | 36 +++++++++++++++++++++++-----
 src/libide/foundry/ide-run-manager-private.h |  1 +
 src/libide/foundry/ide-run-manager.c         |  8 +++++++
 3 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/foundry/ide-pipeline.c b/src/libide/foundry/ide-pipeline.c
index 7727b57c3..d11a2ed78 100644
--- a/src/libide/foundry/ide-pipeline.c
+++ b/src/libide/foundry/ide-pipeline.c
@@ -49,6 +49,7 @@
 #include "ide-device.h"
 #include "ide-foundry-compat.h"
 #include "ide-foundry-enums.h"
+#include "ide-run-manager-private.h"
 #include "ide-runtime.h"
 #include "ide-toolchain-manager.h"
 #include "ide-toolchain.h"
@@ -393,6 +394,25 @@ static const gchar *task_type_names[] = {
   "rebuild",
 };
 
+static void
+drop_caches (IdePipeline *self)
+{
+  g_autoptr(IdeContext) context = NULL;
+
+  g_assert (IDE_IS_PIPELINE (self));
+
+  /* We need to notify the run manager that it should drop any cached
+   * information about the install state. This would normally be done
+   * with a signal, but to simplify backporting, we can just call private
+   * API between the two modules.
+   */
+  if ((context = ide_object_ref_context (IDE_OBJECT (self))))
+    {
+      IdeRunManager *run_manager = ide_run_manager_from_context (context);
+      _ide_run_manager_drop_caches (run_manager);
+    }
+}
+
 static void
 chained_binding_clear (gpointer data)
 {
@@ -3424,6 +3444,8 @@ ide_pipeline_clean_async (IdePipeline         *self,
   g_assert (IDE_IS_PIPELINE (self));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
+  drop_caches (self);
+
   if (cancellable == NULL)
     cancellable = local_cancellable = g_cancellable_new ();
 
@@ -3680,12 +3702,12 @@ ide_pipeline_tick_rebuild (IdePipeline *self,
  * Since: 3.32
  */
 void
-ide_pipeline_rebuild_async (IdePipeline    *self,
-                                  IdePipelinePhase        phase,
-                                  GPtrArray           *targets,
-                                  GCancellable        *cancellable,
-                                  GAsyncReadyCallback  callback,
-                                  gpointer             user_data)
+ide_pipeline_rebuild_async (IdePipeline         *self,
+                            IdePipelinePhase     phase,
+                            GPtrArray           *targets,
+                            GCancellable        *cancellable,
+                            GAsyncReadyCallback  callback,
+                            gpointer             user_data)
 {
   g_autoptr(IdeTask) task = NULL;
   TaskData *td;
@@ -3696,6 +3718,8 @@ ide_pipeline_rebuild_async (IdePipeline    *self,
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
   g_return_if_fail ((phase & ~IDE_PIPELINE_PHASE_MASK) == 0);
 
+  drop_caches (self);
+
   cancellable = dzl_cancellable_chain (cancellable, self->cancellable);
 
   task = ide_task_new (self, cancellable, callback, user_data);
diff --git a/src/libide/foundry/ide-run-manager-private.h b/src/libide/foundry/ide-run-manager-private.h
index 18c26d27b..c841a8948 100644
--- a/src/libide/foundry/ide-run-manager-private.h
+++ b/src/libide/foundry/ide-run-manager-private.h
@@ -37,5 +37,6 @@ typedef struct
 } IdeRunHandlerInfo;
 
 const GList *_ide_run_manager_get_handlers (IdeRunManager *self);
+void         _ide_run_manager_drop_caches  (IdeRunManager *self);
 
 G_END_DECLS
diff --git a/src/libide/foundry/ide-run-manager.c b/src/libide/foundry/ide-run-manager.c
index 44791ed8c..0c1ae6253 100644
--- a/src/libide/foundry/ide-run-manager.c
+++ b/src/libide/foundry/ide-run-manager.c
@@ -1249,3 +1249,11 @@ ide_run_manager_init (IdeRunManager *self)
                                NULL,
                                NULL);
 }
+
+void
+_ide_run_manager_drop_caches (IdeRunManager *self)
+{
+  g_return_if_fail (IDE_IS_RUN_MANAGER (self));
+
+  self->last_change_seq = 0;
+}


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