[gnome-builder] autotools: purge makecache when current configuration changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] autotools: purge makecache when current configuration changes
- Date: Wed, 17 Aug 2016 13:42:58 +0000 (UTC)
commit 93d8a6dd36828d9066538cc67baf38858b73bac6
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 17 15:42:19 2016 +0200
autotools: purge makecache when current configuration changes
This detects a change in the current configuration and purges our makecache
since it will need to be regenerated.
We might also want to watch for changes within the active configuration for
additional purging, but that feels like a bit overkill right now.
plugins/autotools/ide-autotools-build-system.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/plugins/autotools/ide-autotools-build-system.c b/plugins/autotools/ide-autotools-build-system.c
index 55dd9d7..4f64866 100644
--- a/plugins/autotools/ide-autotools-build-system.c
+++ b/plugins/autotools/ide-autotools-build-system.c
@@ -516,17 +516,39 @@ ide_autotools_build_system__buffer_saved_cb (IdeAutotoolsBuildSystem *self,
}
static void
+ide_autotools_build_system__config_changed_cb (IdeAutotoolsBuildSystem *self,
+ GParamSpec *pspec,
+ IdeConfigurationManager *config_manager)
+{
+ g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
+ g_assert (IDE_IS_CONFIGURATION_MANAGER (config_manager));
+
+ egg_task_cache_evict (self->task_cache, MAKECACHE_KEY);
+}
+
+static void
ide_autotools_build_system_constructed (GObject *object)
{
IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
+ IdeConfigurationManager *config_manager;
IdeBufferManager *buffer_manager;
IdeContext *context;
-
G_OBJECT_CLASS (ide_autotools_build_system_parent_class)->constructed (object);
context = ide_object_get_context (IDE_OBJECT (self));
buffer_manager = ide_context_get_buffer_manager (context);
+ config_manager = ide_context_get_configuration_manager (context);
+
+ /*
+ * Track change of active configuration so that we invalidate our cached build
+ * targets (which might be out of date).
+ */
+ g_signal_connect_object (config_manager,
+ "notify::current",
+ G_CALLBACK (ide_autotools_build_system__config_changed_cb),
+ self,
+ G_CONNECT_SWAPPED);
/*
* FIXME:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]