[gnome-builder] autotools: evict makecaches when vcs is reloaded



commit 3b1b1318ce109e3dae06e6ac73873809614d51d5
Author: Christian Hergert <chergert redhat com>
Date:   Sun Dec 4 15:35:15 2016 -0800

    autotools: evict makecaches when vcs is reloaded
    
    This helps ensure that we rebuild the makecache based on the new content.

 plugins/autotools/ide-autotools-build-system.c |   44 ++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/plugins/autotools/ide-autotools-build-system.c b/plugins/autotools/ide-autotools-build-system.c
index f354cca..044c11f 100644
--- a/plugins/autotools/ide-autotools-build-system.c
+++ b/plugins/autotools/ide-autotools-build-system.c
@@ -527,6 +527,44 @@ ide_autotools_build_system__config_changed_cb (IdeAutotoolsBuildSystem *self,
 }
 
 static void
+ide_autotools_build_system__vcs_changed_cb (IdeAutotoolsBuildSystem *self,
+                                            IdeVcs                  *vcs)
+{
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
+  g_assert (IDE_IS_VCS (vcs));
+
+  IDE_TRACE_MSG ("VCS has changed, evicting cached makecaches");
+
+  egg_task_cache_evict_all (self->task_cache);
+
+  IDE_EXIT;
+}
+
+static void
+ide_autotools_build_system__context_loaded_cb (IdeAutotoolsBuildSystem *self,
+                                               IdeContext              *context)
+{
+  IdeVcs *vcs;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
+  g_assert (IDE_IS_CONTEXT (context));
+
+  vcs = ide_context_get_vcs (context);
+
+  g_signal_connect_object (vcs,
+                           "changed",
+                           G_CALLBACK (ide_autotools_build_system__vcs_changed_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  IDE_EXIT;
+}
+
+static void
 ide_autotools_build_system_constructed (GObject *object)
 {
   IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
@@ -540,6 +578,12 @@ ide_autotools_build_system_constructed (GObject *object)
   buffer_manager = ide_context_get_buffer_manager (context);
   config_manager = ide_context_get_configuration_manager (context);
 
+  g_signal_connect_object (context,
+                           "loaded",
+                           G_CALLBACK (ide_autotools_build_system__context_loaded_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   /*
    * Track change of active configuration so that we invalidate our cached build
    * targets (which might be out of date).


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