[gnome-builder] configuration: add sequence number for configuration changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] configuration: add sequence number for configuration changes
- Date: Tue, 1 Mar 2016 00:55:33 +0000 (UTC)
commit 3584fd55578657854185d10a95274437f6fb0d59
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 29 16:55:08 2016 -0800
configuration: add sequence number for configuration changes
Build systems can use this to disable the dirty bit after they have
bootstrapped the build.
libide/ide-configuration.c | 24 ++++++++++++++++++++++++
libide/ide-configuration.h | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-configuration.c b/libide/ide-configuration.c
index f796218..815c164 100644
--- a/libide/ide-configuration.c
+++ b/libide/ide-configuration.c
@@ -42,6 +42,7 @@ struct _IdeConfiguration
IdeEnvironment *environment;
gint parallelism;
+ guint sequence;
guint dirty : 1;
guint debug : 1;
@@ -747,6 +748,7 @@ ide_configuration_set_dirty (IdeConfiguration *self,
* Always emit the changed signal so that the configuration manager
* can queue a writeback of the configuration.
*/
+ self->sequence++;
g_signal_emit (self, signals [CHANGED], 0);
}
@@ -823,3 +825,25 @@ ide_configuration_duplicate (IdeConfiguration *self)
return copy;
}
+
+/**
+ * ide_configuration_get_sequence:
+ * @self: An #IdeConfiguration
+ *
+ * This returns a sequence number for the configuration. This is useful
+ * for build systems that want to clear the "dirty" bit on the configuration
+ * so that they need not bootstrap a second time. This should be done by
+ * checking the sequence number before executing the bootstrap, and only
+ * cleared if the sequence number matches after performing the bootstrap.
+ * This indicates no changes have been made to the configuration in the
+ * mean time.
+ *
+ * Returns: A monotonic sequence number.
+ */
+guint
+ide_configuration_get_sequence (IdeConfiguration *self)
+{
+ g_return_val_if_fail (IDE_IS_CONFIGURATION (self), 0);
+
+ return self->sequence;
+}
diff --git a/libide/ide-configuration.h b/libide/ide-configuration.h
index e4d0596..81f19f2 100644
--- a/libide/ide-configuration.h
+++ b/libide/ide-configuration.h
@@ -73,6 +73,7 @@ void ide_configuration_set_parallelism (IdeConfiguration *self
gint parallelism);
IdeEnvironment *ide_configuration_get_environment (IdeConfiguration *self);
IdeConfiguration *ide_configuration_duplicate (IdeConfiguration *self);
+guint ide_configuration_get_sequence (IdeConfiguration *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]