[gnome-builder/gnome-builder-3-20] autotools: check for NO_BUILD to avoid autogen when CLEAN is set



commit 2ee311a3c46d24877f4cc90d23f93e51051b2fe0
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 4 15:40:01 2016 +0300

    autotools: check for NO_BUILD to avoid autogen when CLEAN is set
    
    We were forcing autogen.sh when we'd perform a clean using the Build
    panel. We want to avoid this when possible.
    
    This also cleans up our flag checking to make things a bit more readable.
    Although, it could use a lot more of it.

 plugins/autotools/ide-autotools-build-task.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/plugins/autotools/ide-autotools-build-task.c b/plugins/autotools/ide-autotools-build-task.c
index cd76f10..2e6a778 100644
--- a/plugins/autotools/ide-autotools-build-task.c
+++ b/plugins/autotools/ide-autotools-build-task.c
@@ -28,6 +28,9 @@
 
 #include "ide-autotools-build-task.h"
 
+#define FLAG_SET(_f,_n) (((_f) & (_n)) != 0)
+#define FLAG_UNSET(_f,_n) (((_f) & (_n)) == 0)
+
 struct _IdeAutotoolsBuildTask
 {
   IdeBuildResult    parent;
@@ -420,8 +423,8 @@ worker_state_new (IdeAutotoolsBuildTask *self,
 
   state = g_slice_new0 (WorkerState);
   state->sequence = ide_configuration_get_sequence (self->configuration);
-  state->require_autogen = self->require_autogen || !!(flags & IDE_BUILDER_BUILD_FLAGS_FORCE_BOOTSTRAP);
-  state->require_configure = self->require_configure || (state->require_autogen && !(flags & 
IDE_BUILDER_BUILD_FLAGS_NO_CONFIGURE));
+  state->require_autogen = self->require_autogen || FLAG_SET (flags, 
IDE_BUILDER_BUILD_FLAGS_FORCE_BOOTSTRAP);
+  state->require_configure = self->require_configure || (state->require_autogen && FLAG_UNSET (flags, 
IDE_BUILDER_BUILD_FLAGS_NO_CONFIGURE));
   state->directory_path = g_file_get_path (self->directory);
   state->project_path = g_file_get_path (project_dir);
   state->system_type = g_strdup (ide_device_get_system_type (device));
@@ -438,21 +441,24 @@ worker_state_new (IdeAutotoolsBuildTask *self,
 
   make_targets = g_ptr_array_new ();
 
-  if (0 != (flags & IDE_BUILDER_BUILD_FLAGS_FORCE_CLEAN))
+  if (FLAG_SET (flags, IDE_BUILDER_BUILD_FLAGS_FORCE_CLEAN))
     {
-      state->require_autogen = TRUE;
-      state->require_configure = TRUE;
+      if (FLAG_UNSET (flags, IDE_BUILDER_BUILD_FLAGS_NO_BUILD))
+        {
+          state->require_autogen = TRUE;
+          state->require_configure = TRUE;
+        }
       g_ptr_array_add (make_targets, g_strdup ("clean"));
     }
 
-  if (0 == (flags & IDE_BUILDER_BUILD_FLAGS_NO_BUILD))
+  if (FLAG_UNSET (flags, IDE_BUILDER_BUILD_FLAGS_NO_BUILD))
     g_ptr_array_add (make_targets, g_strdup ("all"));
 
   g_ptr_array_add (make_targets, NULL);
 
   state->make_targets = (gchar **)g_ptr_array_free (make_targets, FALSE);
 
-  if (0 != (flags & IDE_BUILDER_BUILD_FLAGS_NO_CONFIGURE))
+  if (FLAG_SET (flags, IDE_BUILDER_BUILD_FLAGS_NO_CONFIGURE))
     {
       state->require_autogen = TRUE;
       state->require_configure = TRUE;


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