[gnome-builder] buildconfig: add builddir option similar to flatpak manifests



commit f2b4665f4def8a8c17a5b41e232d10ce7ae13620
Author: Christian Hergert <chergert redhat com>
Date:   Mon Apr 2 14:02:07 2018 -0700

    buildconfig: add builddir option similar to flatpak manifests
    
    This lets us specify either builddir = true or builddir = false in the
    config group to indicate if an out-of-tree build directory should be used.
    
    This is mostly useful for situations where the project cannot be built
    out-of-tree.
    
    We may want to alter subprocess launchers to take this into account when
    running programs, but it should mostly happen automatically for pipeline
    operations where builddir will now be within the project dir.

 .../buildconfig/ide-buildconfig-configuration-provider.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/libide/buildconfig/ide-buildconfig-configuration-provider.c 
b/src/libide/buildconfig/ide-buildconfig-configuration-provider.c
index 0026df2e3..a74f1cf7f 100644
--- a/src/libide/buildconfig/ide-buildconfig-configuration-provider.c
+++ b/src/libide/buildconfig/ide-buildconfig-configuration-provider.c
@@ -191,6 +191,7 @@ ide_buildconfig_configuration_provider_create (IdeBuildconfigConfigurationProvid
 {
   g_autoptr(IdeConfiguration) config = NULL;
   g_autofree gchar *env_group = NULL;
+  g_autofree gchar *locality = NULL;
   IdeContext *context;
 
   g_assert (IDE_IS_BUILDCONFIG_CONFIGURATION_PROVIDER (self));
@@ -213,6 +214,14 @@ ide_buildconfig_configuration_provider_create (IdeBuildconfigConfigurationProvid
   load_strv (config, self->key_file, config_id, "prebuild", "prebuild");
   load_strv (config, self->key_file, config_id, "postbuild", "postbuild");
 
+  if (g_key_file_has_key (self->key_file, config_id, "builddir", NULL))
+    {
+      if (g_key_file_get_boolean (self->key_file, config_id, "builddir", NULL))
+        ide_configuration_set_locality (config, IDE_BUILD_LOCALITY_OUT_OF_TREE);
+      else
+        ide_configuration_set_locality (config, IDE_BUILD_LOCALITY_IN_TREE);
+    }
+
   env_group = g_strdup_printf ("%s.environment", config_id);
   if (g_key_file_has_group (self->key_file, env_group))
     load_environ (config, self->key_file, env_group);
@@ -427,6 +436,13 @@ ide_buildconfig_configuration_provider_save_async (IdeConfigurationProvider *pro
 #undef PERSIST_STRING_KEY
 #undef PERSIST_STRV_KEY
 
+      if (ide_configuration_get_locality (config) == IDE_BUILD_LOCALITY_IN_TREE)
+        g_key_file_set_boolean (self->key_file, config_id, "builddir", FALSE);
+      else if (ide_configuration_get_locality (config) == IDE_BUILD_LOCALITY_OUT_OF_TREE)
+        g_key_file_set_boolean (self->key_file, config_id, "builddir", TRUE);
+      else
+        g_key_file_remove_key (self->key_file, config_id, "builddir", NULL);
+
       if (config == ide_configuration_manager_get_current (manager))
         g_key_file_set_boolean (self->key_file, config_id, "default", TRUE);
       else


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