[gnome-builder] meson: sort by executable and bindir



commit 3f3a5ff85aa9500a1591efa14191e6a0295fc3b9
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 17 22:27:46 2017 -0700

    meson: sort by executable and bindir
    
    This does something closer to our previous implementation from
    Python. This puts bindir executables at the head of the list.

 src/plugins/meson/gbp-meson-build-system.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index 099d641..249b069 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -524,6 +524,7 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject      *object,
       JsonNode *element = json_array_get_element (array, i);
       const gchar *name;
       const gchar *filename;
+      const gchar *type;
       JsonObject *obj;
       JsonNode *member;
       gboolean installed;
@@ -536,10 +537,14 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject      *object,
           NULL != (member = json_object_get_member (obj, "install_filename")) &&
           JSON_NODE_HOLDS_VALUE (member) &&
           NULL != (filename = json_node_get_string (member)) &&
+          NULL != (member = json_object_get_member (obj, "type")) &&
+          JSON_NODE_HOLDS_VALUE (member) &&
+          NULL != (type = json_node_get_string (member)) &&
           NULL != (member = json_object_get_member (obj, "installed")) &&
           JSON_NODE_HOLDS_VALUE (member) &&
           TRUE == (installed = json_node_get_boolean (member)))
         {
+          g_autoptr(IdeBuildTarget) target = NULL;
           g_autofree gchar *install_dir = NULL;
           g_autofree gchar *base = NULL;
           g_autofree gchar *name_of_dir = NULL;
@@ -548,16 +553,21 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject      *object,
           install_dir = g_path_get_dirname (filename);
           name_of_dir = g_path_get_basename (install_dir);
 
-          /* ignore things not in bin */
-          if (!ide_str_equal0 (name_of_dir, "bin"))
-            continue;
-
           g_debug ("Found target %s", name);
 
           base = g_path_get_basename (filename);
           dir = g_file_new_for_path (install_dir);
 
-          g_ptr_array_add (ret, gbp_meson_build_target_new (context, dir, base));
+          target = gbp_meson_build_target_new (context, dir, base);
+
+          /*
+           * Until Builder supports selecting a target to run, we need to prefer
+           * bindir targets over other targets.
+           */
+          if (ide_str_equal0 (name_of_dir, "bin") && ide_str_equal0 (type, "executable"))
+            g_ptr_array_insert (ret, 0, g_steal_pointer (&target));
+          else
+            g_ptr_array_add (ret, g_steal_pointer (&target));
         }
     }
 


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