[gnome-builder: 102/139] meson: port to libide-foundry



commit bfbc5738c5b292256799141fd952af972288bfa0
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:29:48 2019 -0800

    meson: port to libide-foundry

 .../meson/gbp-meson-build-stage-cross-file.c       |  2 +-
 .../meson/gbp-meson-build-stage-cross-file.h       |  2 +-
 .../meson/gbp-meson-build-system-discovery.c       | 91 ++++++++++++++++++++++
 .../meson/gbp-meson-build-system-discovery.h       | 32 ++++++++
 src/plugins/meson/gbp-meson-build-system.c         | 76 ++++--------------
 src/plugins/meson/gbp-meson-build-system.h         |  2 +-
 .../meson/gbp-meson-build-target-provider.c        | 37 ++++++---
 .../meson/gbp-meson-build-target-provider.h        |  2 +-
 src/plugins/meson/gbp-meson-build-target.c         | 53 ++++++++++---
 src/plugins/meson/gbp-meson-build-target.h         | 11 ++-
 src/plugins/meson/gbp-meson-pipeline-addin.c       | 74 +++++++++++++++---
 src/plugins/meson/gbp-meson-pipeline-addin.h       |  2 +-
 src/plugins/meson/gbp-meson-test-provider.c        | 19 +++--
 src/plugins/meson/gbp-meson-test-provider.h        |  2 +-
 src/plugins/meson/gbp-meson-test.h                 |  2 +-
 src/plugins/meson/gbp-meson-tool-row.c             |  2 +-
 src/plugins/meson/gbp-meson-tool-row.h             |  2 +-
 ...gbp-meson-toolchain-edition-preferences-addin.c |  7 +-
 ...gbp-meson-toolchain-edition-preferences-addin.h |  2 +-
 .../gbp-meson-toolchain-edition-preferences-row.c  |  2 +-
 .../gbp-meson-toolchain-edition-preferences-row.h  |  2 +-
 src/plugins/meson/gbp-meson-toolchain-provider.c   |  5 +-
 src/plugins/meson/gbp-meson-toolchain-provider.h   |  2 +-
 src/plugins/meson/gbp-meson-toolchain.c            | 10 +--
 src/plugins/meson/gbp-meson-toolchain.h            |  2 +-
 src/plugins/meson/gbp-meson-utils.h                |  2 +-
 src/plugins/meson/meson-plugin.c                   | 35 ++++++---
 src/plugins/meson/meson.build                      | 35 +++------
 src/plugins/meson/meson.gresource.xml              |  4 +-
 src/plugins/meson/meson.plugin                     | 13 ++--
 30 files changed, 360 insertions(+), 172 deletions(-)
---
diff --git a/src/plugins/meson/gbp-meson-build-stage-cross-file.c 
b/src/plugins/meson/gbp-meson-build-stage-cross-file.c
index e12eb089f..491e62b6e 100644
--- a/src/plugins/meson/gbp-meson-build-stage-cross-file.c
+++ b/src/plugins/meson/gbp-meson-build-stage-cross-file.c
@@ -49,6 +49,7 @@ add_lang_executable (const gchar *lang,
 static void
 gbp_meson_build_stage_cross_file_query (IdeBuildStage    *stage,
                                         IdeBuildPipeline *pipeline,
+                                        GPtrArray        *targets,
                                         GCancellable     *cancellable)
 {
   GbpMesonBuildStageCrossFile *self = (GbpMesonBuildStageCrossFile *)stage;
@@ -178,7 +179,6 @@ gbp_meson_build_stage_cross_file_class_init (GbpMesonBuildStageCrossFileClass *k
 static void
 gbp_meson_build_stage_cross_file_init (GbpMesonBuildStageCrossFile *self)
 {
-  
 }
 
 GbpMesonBuildStageCrossFile *
diff --git a/src/plugins/meson/gbp-meson-build-stage-cross-file.h 
b/src/plugins/meson/gbp-meson-build-stage-cross-file.h
index a6c0ee494..4873772c2 100644
--- a/src/plugins/meson/gbp-meson-build-stage-cross-file.h
+++ b/src/plugins/meson/gbp-meson-build-stage-cross-file.h
@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-build-system-discovery.c 
b/src/plugins/meson/gbp-meson-build-system-discovery.c
new file mode 100644
index 000000000..4028af51a
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-build-system-discovery.c
@@ -0,0 +1,91 @@
+/* gbp-meson-build-system-discovery.c
+ *
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-meson-build-system-discovery"
+
+#include "config.h"
+
+#include <libide-foundry.h>
+
+#include "gbp-meson-build-system-discovery.h"
+
+struct _GbpMesonBuildSystemDiscovery
+{
+  GObject parent_instance;
+};
+
+static gchar *
+gbp_meson_build_system_discovery_discover (IdeBuildSystemDiscovery  *discovery,
+                                           GFile                    *directory,
+                                           GCancellable             *cancellable,
+                                           gint                     *priority,
+                                           GError                  **error)
+{
+  g_autoptr(GFile) meson_build = NULL;
+  g_autoptr(GFileInfo) info = NULL;
+
+  g_assert (!IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_MESON_BUILD_SYSTEM_DISCOVERY (discovery));
+  g_assert (G_IS_FILE (directory));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+  g_assert (priority != NULL);
+
+  *priority = 0;
+
+  meson_build = g_file_get_child (directory, "meson.build");
+  info = g_file_query_info (meson_build,
+                            G_FILE_ATTRIBUTE_STANDARD_TYPE,
+                            G_FILE_QUERY_INFO_NONE,
+                            cancellable,
+                            NULL);
+
+  if (info == NULL || g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR)
+    {
+      g_set_error (error,
+                   G_IO_ERROR,
+                   G_IO_ERROR_NOT_SUPPORTED,
+                   "Meson is not supported in this project");
+      return NULL;
+    }
+
+  *priority = GBP_MESON_BUILD_SYSTEM_DISCOVERY_PRIORITY;
+
+  return g_strdup ("meson");
+}
+
+static void
+build_system_discovery_iface_init (IdeBuildSystemDiscoveryInterface *iface)
+{
+  iface->discover = gbp_meson_build_system_discovery_discover;
+}
+
+G_DEFINE_TYPE_WITH_CODE (GbpMesonBuildSystemDiscovery, gbp_meson_build_system_discovery, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (IDE_TYPE_BUILD_SYSTEM_DISCOVERY,
+                                                build_system_discovery_iface_init))
+
+static void
+gbp_meson_build_system_discovery_class_init (GbpMesonBuildSystemDiscoveryClass *klass)
+{
+}
+
+static void
+gbp_meson_build_system_discovery_init (GbpMesonBuildSystemDiscovery *self)
+{
+}
diff --git a/src/plugins/meson/gbp-meson-build-system-discovery.h 
b/src/plugins/meson/gbp-meson-build-system-discovery.h
new file mode 100644
index 000000000..3596b11bd
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-build-system-discovery.h
@@ -0,0 +1,32 @@
+/* gbp-meson-build-system-discovery.h
+ *
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_MESON_BUILD_SYSTEM_DISCOVERY     (gbp_meson_build_system_discovery_get_type())
+#define GBP_MESON_BUILD_SYSTEM_DISCOVERY_PRIORITY (100)
+
+G_DECLARE_FINAL_TYPE (GbpMesonBuildSystemDiscovery, gbp_meson_build_system_discovery, GBP, 
MESON_BUILD_SYSTEM_DISCOVERY, GObject)
+
+G_END_DECLS
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index bd2e52004..b5b913fbf 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -87,10 +87,11 @@ gbp_meson_build_system_ensure_config_async (GbpMesonBuildSystem *self,
   ide_task_set_priority (task, G_PRIORITY_LOW);
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
 
   ide_build_manager_execute_async (build_manager,
                                    IDE_BUILD_PHASE_CONFIGURE,
+                                   NULL,
                                    cancellable,
                                    gbp_meson_build_system_ensure_config_cb,
                                    g_steal_pointer (&task));
@@ -205,7 +206,7 @@ gbp_meson_build_system_load_commands_config_cb (GObject      *object,
     }
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
 
   if (pipeline == NULL)
@@ -283,7 +284,7 @@ gbp_meson_build_system_load_commands_async (GbpMesonBuildSystem *self,
    */
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
 
   /*
@@ -468,23 +469,22 @@ gbp_meson_build_system_get_build_flags_for_files_cb (GObject      *object,
 
   /* Get non-standard system includes */
   context = ide_object_get_context (IDE_OBJECT (self));
-  config_manager = ide_context_get_configuration_manager (context);
+  config_manager = ide_configuration_manager_from_context (context);
   config = ide_configuration_manager_get_current (config_manager);
   if (NULL != (runtime = ide_configuration_get_runtime (config)))
     system_includes = ide_runtime_get_system_include_dirs (runtime);
 
-  ret = g_hash_table_new_full ((GHashFunc)ide_file_hash,
-                               (GEqualFunc)ide_file_equal,
+  ret = g_hash_table_new_full (g_file_hash,
+                               (GEqualFunc)g_file_equal,
                                g_object_unref,
                                (GDestroyNotify)g_strfreev);
 
   for (guint i = 0; i < files->len; i++)
     {
-      IdeFile *file = g_ptr_array_index (files, i);
-      GFile *gfile = ide_file_get_file (file);
+      GFile *file = g_ptr_array_index (files, i);
       g_auto(GStrv) flags = NULL;
 
-      flags = ide_compile_commands_lookup (compile_commands, gfile,
+      flags = ide_compile_commands_lookup (compile_commands, file,
                                            (const gchar * const *)system_includes,
                                            NULL, NULL);
       g_hash_table_insert (ret, g_object_ref (file), g_steal_pointer (&flags));
@@ -528,7 +528,7 @@ gbp_meson_build_system_get_build_flags_cb (GObject      *object,
 
   /* Get non-standard system includes */
   context = ide_object_get_context (IDE_OBJECT (self));
-  config_manager = ide_context_get_configuration_manager (context);
+  config_manager = ide_configuration_manager_from_context (context);
   config = ide_configuration_manager_get_current (config_manager);
   if (NULL != (runtime = ide_configuration_get_runtime (config)))
     system_includes = ide_runtime_get_system_include_dirs (runtime);
@@ -547,27 +547,24 @@ gbp_meson_build_system_get_build_flags_cb (GObject      *object,
 
 static void
 gbp_meson_build_system_get_build_flags_async (IdeBuildSystem      *build_system,
-                                              IdeFile             *file,
+                                              GFile               *file,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data)
 {
   GbpMesonBuildSystem *self = (GbpMesonBuildSystem *)build_system;
   g_autoptr(IdeTask) task = NULL;
-  GFile *gfile;
 
   IDE_ENTRY;
 
   g_assert (GBP_IS_MESON_BUILD_SYSTEM (self));
-  g_assert (IDE_IS_FILE (file));
+  g_assert (G_IS_FILE (file));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
-  gfile = ide_file_get_file (file);
-
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_priority (task, G_PRIORITY_LOW);
   ide_task_set_source_tag (task, gbp_meson_build_system_get_build_flags_async);
-  ide_task_set_task_data (task, g_object_ref (gfile), g_object_unref);
+  ide_task_set_task_data (task, g_object_ref (file), g_object_unref);
 
   gbp_meson_build_system_load_commands_async (self,
                                               cancellable,
@@ -712,49 +709,6 @@ gbp_meson_build_system_notify_pipeline (GbpMesonBuildSystem *self,
   IDE_EXIT;
 }
 
-static void
-gbp_meson_build_system_init_worker (IdeTask      *task,
-                                    gpointer      source_object,
-                                    gpointer      task_data,
-                                    GCancellable *cancellable)
-{
-  GFile *project_file = task_data;
-  g_autofree gchar *name = NULL;
-
-  IDE_ENTRY;
-
-  g_assert (GBP_IS_MESON_BUILD_SYSTEM (source_object));
-  g_assert (G_IS_FILE (project_file));
-  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  name = g_file_get_basename (project_file);
-
-  if (dzl_str_equal0 (name, "meson.build"))
-    {
-      ide_task_return_pointer (task, g_object_ref (project_file), g_object_unref);
-      IDE_EXIT;
-    }
-
-  if (g_file_query_file_type (project_file, 0, cancellable) == G_FILE_TYPE_DIRECTORY)
-    {
-      g_autoptr(GFile) meson_build = g_file_get_child (project_file, "meson.build");
-
-      if (g_file_query_exists (meson_build, cancellable))
-        {
-          ide_task_return_pointer (task, g_object_ref (meson_build), g_object_unref);
-          IDE_EXIT;
-        }
-    }
-
-  ide_task_return_new_error (task,
-                             G_IO_ERROR,
-                             G_IO_ERROR_NOT_SUPPORTED,
-                             "%s is not supported by the meson plugin",
-                             name);
-
-  IDE_EXIT;
-}
-
 static void
 gbp_meson_build_system_init_async (GAsyncInitable      *initable,
                                    gint                 io_priority,
@@ -776,7 +730,7 @@ gbp_meson_build_system_init_async (GAsyncInitable      *initable,
   context = ide_object_get_context (IDE_OBJECT (self));
   g_assert (IDE_IS_CONTEXT (context));
 
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   g_assert (IDE_IS_BUILD_MANAGER (build_manager));
 
   task = ide_task_new (self, cancellable, callback, user_data);
@@ -794,7 +748,7 @@ gbp_meson_build_system_init_async (GAsyncInitable      *initable,
                            self,
                            G_CONNECT_SWAPPED);
 
-  ide_task_run_in_thread (task, gbp_meson_build_system_init_worker);
+  ide_task_return_boolean (task, TRUE);
 
   IDE_EXIT;
 }
diff --git a/src/plugins/meson/gbp-meson-build-system.h b/src/plugins/meson/gbp-meson-build-system.h
index 7664ab1c6..16a6747d5 100644
--- a/src/plugins/meson/gbp-meson-build-system.h
+++ b/src/plugins/meson/gbp-meson-build-system.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-build-target-provider.c 
b/src/plugins/meson/gbp-meson-build-target-provider.c
index 22c9b9f26..434a16718 100644
--- a/src/plugins/meson/gbp-meson-build-target-provider.c
+++ b/src/plugins/meson/gbp-meson-build-target-provider.c
@@ -41,7 +41,7 @@ create_launcher (IdeContext  *context,
   g_assert (IDE_IS_CONTEXT (context));
   g_assert (error == NULL || *error == NULL);
 
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
 
   if (pipeline == NULL)
@@ -130,7 +130,12 @@ gbp_meson_build_target_provider_communicate_cb2 (GObject      *object,
 
           /* We only need one result */
           ret = g_ptr_array_new_with_free_func (g_object_unref);
-          g_ptr_array_add (ret, gbp_meson_build_target_new (context, gdir, name));
+          g_ptr_array_add (ret,
+                           gbp_meson_build_target_new (context,
+                                                       gdir,
+                                                       name,
+                                                       NULL,
+                                                       IDE_ARTIFACT_KIND_EXECUTABLE));
           ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
 
           return;
@@ -210,6 +215,7 @@ gbp_meson_build_target_provider_communicate_cb (GObject      *object,
     {
       JsonNode *element = json_array_get_element (array, i);
       const gchar *name;
+      const gchar *install_filename;
       const gchar *filename;
       const gchar *type;
       JsonObject *obj;
@@ -223,6 +229,9 @@ gbp_meson_build_target_provider_communicate_cb (GObject      *object,
           NULL != (name = json_node_get_string (member)) &&
           NULL != (member = json_object_get_member (obj, "install_filename")) &&
           JSON_NODE_HOLDS_VALUE (member) &&
+          NULL != (install_filename = json_node_get_string (member)) &&
+          NULL != (member = json_object_get_member (obj, "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) &&
@@ -236,24 +245,32 @@ gbp_meson_build_target_provider_communicate_cb (GObject      *object,
           g_autofree gchar *base = NULL;
           g_autofree gchar *name_of_dir = NULL;
           g_autoptr(GFile) dir = NULL;
+          IdeArtifactKind kind = 0;
 
-          install_dir = g_path_get_dirname (filename);
+          install_dir = g_path_get_dirname (install_filename);
           name_of_dir = g_path_get_basename (install_dir);
 
           g_debug ("Found target %s", name);
 
-          base = g_path_get_basename (filename);
+          base = g_path_get_basename (install_filename);
           dir = g_file_new_for_path (install_dir);
 
-          target = gbp_meson_build_target_new (context, dir, base);
+          if (ide_str_equal0 (type, "executable"))
+            kind = IDE_ARTIFACT_KIND_EXECUTABLE;
+          else if (ide_str_equal0 (type, "static library"))
+            kind = IDE_ARTIFACT_KIND_STATIC_LIBRARY;
+          else if (ide_str_equal0 (type, "shared library"))
+            kind = IDE_ARTIFACT_KIND_SHARED_LIBRARY;
+
+          target = gbp_meson_build_target_new (context, dir, base, filename, kind);
 
-          found_bindir |= dzl_str_equal0 (name_of_dir, "bin");
+          found_bindir |= ide_str_equal0 (name_of_dir, "bin");
 
           /*
            * Until Builder supports selecting a target to run, we need to prefer
            * bindir targets over other targets.
            */
-          if (dzl_str_equal0 (name_of_dir, "bin") && dzl_str_equal0 (type, "executable"))
+          if (ide_str_equal0 (name_of_dir, "bin") && kind == IDE_ARTIFACT_KIND_EXECUTABLE)
             g_ptr_array_insert (ret, 0, g_steal_pointer (&target));
           else
             g_ptr_array_add (ret, g_steal_pointer (&target));
@@ -280,7 +297,7 @@ gbp_meson_build_target_provider_communicate_cb (GObject      *object,
     }
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
   cancellable = ide_task_get_cancellable (task);
 
@@ -330,7 +347,7 @@ gbp_meson_build_target_provider_get_targets_async (IdeBuildTargetProvider *provi
   ide_task_set_priority (task, G_PRIORITY_LOW);
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_system = ide_context_get_build_system (context);
+  build_system = ide_build_system_from_context (context);
 
   if (!GBP_IS_MESON_BUILD_SYSTEM (build_system))
     {
@@ -341,7 +358,7 @@ gbp_meson_build_target_provider_get_targets_async (IdeBuildTargetProvider *provi
       IDE_EXIT;
     }
 
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
 
   if (pipeline == NULL)
diff --git a/src/plugins/meson/gbp-meson-build-target-provider.h 
b/src/plugins/meson/gbp-meson-build-target-provider.h
index a0742aed1..3d1b1d0dc 100644
--- a/src/plugins/meson/gbp-meson-build-target-provider.h
+++ b/src/plugins/meson/gbp-meson-build-target-provider.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-build-target.c b/src/plugins/meson/gbp-meson-build-target.c
index 6eeee27ef..43f770daa 100644
--- a/src/plugins/meson/gbp-meson-build-target.c
+++ b/src/plugins/meson/gbp-meson-build-target.c
@@ -24,16 +24,19 @@
 
 struct _GbpMesonBuildTarget
 {
-  IdeObject  parent_instance;
+  IdeObject        parent_instance;
 
-  GFile     *install_directory;
-  gchar     *name;
+  GFile           *install_directory;
+  gchar           *name;
+  gchar           *filename;
+  IdeArtifactKind  kind;
 };
 
 enum {
   PROP_0,
   PROP_INSTALL_DIRECTORY,
   PROP_NAME,
+  PROP_FILE_NAME,
   N_PROPS
 };
 
@@ -59,11 +62,18 @@ gbp_meson_build_target_get_name (IdeBuildTarget *build_target)
   return self->name ? g_strdup (self->name) : NULL;
 }
 
+static IdeArtifactKind
+gbp_meson_build_target_get_kind (IdeBuildTarget *target)
+{
+  return GBP_MESON_BUILD_TARGET (target)->kind;
+}
+
 static void
 build_target_iface_init (IdeBuildTargetInterface *iface)
 {
   iface->get_install_directory = gbp_meson_build_target_get_install_directory;
   iface->get_name = gbp_meson_build_target_get_name;
+  iface->get_kind = gbp_meson_build_target_get_kind;
 }
 
 G_DEFINE_TYPE_WITH_CODE (GbpMesonBuildTarget, gbp_meson_build_target, IDE_TYPE_OBJECT,
@@ -87,6 +97,10 @@ gbp_meson_build_target_get_property (GObject    *object,
       g_value_set_string (value, self->name);
       break;
 
+    case PROP_FILE_NAME:
+      g_value_set_string (value, self->filename);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -110,6 +124,10 @@ gbp_meson_build_target_set_property (GObject      *object,
       self->name = g_value_dup_string (value);
       break;
 
+    case PROP_FILE_NAME:
+      self->filename = g_value_dup_string (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -149,6 +167,13 @@ gbp_meson_build_target_class_init (GbpMesonBuildTargetClass *klass)
                          NULL,
                          (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_FILE_NAME] =
+    g_param_spec_string ("file-name",
+                         NULL,
+                         NULL,
+                         NULL,
+                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_properties (object_class, N_PROPS, properties);
 }
 
@@ -158,9 +183,11 @@ gbp_meson_build_target_init (GbpMesonBuildTarget *self)
 }
 
 IdeBuildTarget *
-gbp_meson_build_target_new (IdeContext *context,
-                            GFile      *install_directory,
-                            gchar      *name)
+gbp_meson_build_target_new (IdeContext      *context,
+                            GFile           *install_directory,
+                            const gchar     *name,
+                            const gchar     *filename,
+                            IdeArtifactKind  kind)
 {
   GbpMesonBuildTarget *self;
 
@@ -168,11 +195,19 @@ gbp_meson_build_target_new (IdeContext *context,
   g_return_val_if_fail (G_IS_FILE (install_directory), NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  self = g_object_new (GBP_TYPE_MESON_BUILD_TARGET,
-                       "context", context,
-                       NULL);
+  self = g_object_new (GBP_TYPE_MESON_BUILD_TARGET, NULL);
   g_set_object (&self->install_directory, install_directory);
   self->name = g_strdup (name);
+  self->filename = g_strdup (filename);
+  self->kind = kind;
 
   return IDE_BUILD_TARGET (self);
 }
+
+const gchar *
+gbp_meson_build_target_get_filename (GbpMesonBuildTarget *self)
+{
+  g_return_val_if_fail (GBP_IS_MESON_BUILD_TARGET (self), NULL);
+
+  return self->filename;
+}
diff --git a/src/plugins/meson/gbp-meson-build-target.h b/src/plugins/meson/gbp-meson-build-target.h
index c39fdc6fc..1ef5f5172 100644
--- a/src/plugins/meson/gbp-meson-build-target.h
+++ b/src/plugins/meson/gbp-meson-build-target.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
@@ -28,8 +28,11 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbpMesonBuildTarget, gbp_meson_build_target, GBP, MESON_BUILD_TARGET, IdeObject)
 
-IdeBuildTarget *gbp_meson_build_target_new (IdeContext *context,
-                                            GFile      *install_directory,
-                                            gchar      *name);
+IdeBuildTarget *gbp_meson_build_target_new          (IdeContext          *context,
+                                                     GFile               *install_directory,
+                                                     const gchar         *name,
+                                                     const gchar         *filename,
+                                                     IdeArtifactKind      kind);
+const gchar    *gbp_meson_build_target_get_filename (GbpMesonBuildTarget *self);
 
 G_END_DECLS
diff --git a/src/plugins/meson/gbp-meson-pipeline-addin.c b/src/plugins/meson/gbp-meson-pipeline-addin.c
index e6fe7dd56..9c638faf2 100644
--- a/src/plugins/meson/gbp-meson-pipeline-addin.c
+++ b/src/plugins/meson/gbp-meson-pipeline-addin.c
@@ -25,6 +25,7 @@
 #include "gbp-meson-toolchain.h"
 #include "gbp-meson-build-stage-cross-file.h"
 #include "gbp-meson-build-system.h"
+#include "gbp-meson-build-target.h"
 #include "gbp-meson-pipeline-addin.h"
 
 struct _GbpMesonPipelineAddin
@@ -35,9 +36,60 @@ struct _GbpMesonPipelineAddin
 static const gchar *ninja_names[] = { "ninja", "ninja-build" };
 
 static void
-on_stage_query (IdeBuildStage    *stage,
-                IdeBuildPipeline *pipeline,
-                GCancellable     *cancellable)
+on_build_stage_query (IdeBuildStage    *stage,
+                      IdeBuildPipeline *pipeline,
+                      GPtrArray        *targets,
+                      GCancellable     *cancellable)
+{
+  IdeSubprocessLauncher *launcher;
+  g_autoptr(GPtrArray) replace = NULL;
+  const gchar * const *argv;
+
+  g_assert (IDE_IS_BUILD_STAGE (stage));
+  g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  /* Defer to ninja to determine completed status */
+  ide_build_stage_set_completed (stage, FALSE);
+
+  /* Clear any previous argv items from a possible previous build */
+  launcher = ide_build_stage_launcher_get_launcher (IDE_BUILD_STAGE_LAUNCHER (stage));
+  argv = ide_subprocess_launcher_get_argv (launcher);
+  replace = g_ptr_array_new_with_free_func (g_free);
+  for (guint i = 0; argv[i]; i++)
+    {
+      g_ptr_array_add (replace, g_strdup (argv[i]));
+      if (g_strv_contains (ninja_names, argv[i]))
+        break;
+    }
+  g_ptr_array_add (replace, NULL);
+  ide_subprocess_launcher_set_argv (launcher, (const gchar * const *)replace->pdata);
+
+  /* If we have targets to build, specify them */
+  if (targets != NULL)
+    {
+      for (guint i = 0; i < targets->len; i++)
+        {
+          IdeBuildTarget *target = g_ptr_array_index (targets, i);
+
+          if (GBP_IS_MESON_BUILD_TARGET (target))
+            {
+              const gchar *filename;
+
+              filename = gbp_meson_build_target_get_filename (GBP_MESON_BUILD_TARGET (target));
+
+              if (filename != NULL)
+                ide_subprocess_launcher_push_argv (launcher, filename);
+            }
+        }
+    }
+}
+
+static void
+on_install_stage_query (IdeBuildStage    *stage,
+                        IdeBuildPipeline *pipeline,
+                        GPtrArray        *targets,
+                        GCancellable     *cancellable)
 {
   g_assert (IDE_IS_BUILD_STAGE (stage));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
@@ -82,7 +134,7 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
 
   context = ide_object_get_context (IDE_OBJECT (self));
 
-  build_system = ide_context_get_build_system (context);
+  build_system = ide_build_system_from_context (context);
   if (!GBP_IS_MESON_BUILD_SYSTEM (build_system))
     IDE_GOTO (failure);
 
@@ -141,7 +193,7 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
       cross_file_stage = gbp_meson_build_stage_cross_file_new (context, toolchain);
       crossbuild_file = gbp_meson_build_stage_cross_file_get_path (cross_file_stage, pipeline);
 
-      id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_PREPARE, 0, IDE_BUILD_STAGE 
(cross_file_stage));
+      id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_PREPARE, 0, IDE_BUILD_STAGE 
(cross_file_stage));
       ide_build_pipeline_addin_track (addin, id);
     }
 
@@ -158,7 +210,7 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
       ide_subprocess_launcher_push_argv (config_launcher, crossbuild_file);
     }
 
-  if (!dzl_str_empty0 (config_opts))
+  if (!ide_str_empty0 (config_opts))
     {
       g_auto(GStrv) argv = NULL;
       gint argc;
@@ -175,7 +227,7 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
   if (g_file_test (build_ninja, G_FILE_TEST_IS_REGULAR))
     ide_build_stage_set_completed (config_stage, TRUE);
 
-  id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_CONFIGURE, 0, config_stage);
+  id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_CONFIGURE, 0, config_stage);
   ide_build_pipeline_addin_track (addin, id);
 
   /*
@@ -200,9 +252,9 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
   ide_build_stage_launcher_set_clean_launcher (IDE_BUILD_STAGE_LAUNCHER (build_stage), clean_launcher);
   ide_build_stage_set_check_stdout (build_stage, TRUE);
   ide_build_stage_set_name (build_stage, _("Building project"));
-  g_signal_connect (build_stage, "query", G_CALLBACK (on_stage_query), NULL);
+  g_signal_connect (build_stage, "query", G_CALLBACK (on_build_stage_query), NULL);
 
-  id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_BUILD, 0, build_stage);
+  id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_BUILD, 0, build_stage);
   ide_build_pipeline_addin_track (addin, id);
 
   /* Setup our install stage */
@@ -210,8 +262,8 @@ gbp_meson_pipeline_addin_load (IdeBuildPipelineAddin *addin,
   ide_subprocess_launcher_push_argv (install_launcher, "install");
   install_stage = ide_build_stage_launcher_new (context, install_launcher);
   ide_build_stage_set_name (install_stage, _("Installing project"));
-  g_signal_connect (install_stage, "query", G_CALLBACK (on_stage_query), NULL);
-  id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_INSTALL, 0, install_stage);
+  g_signal_connect (install_stage, "query", G_CALLBACK (on_install_stage_query), NULL);
+  id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_INSTALL, 0, install_stage);
   ide_build_pipeline_addin_track (addin, id);
 
   IDE_EXIT;
diff --git a/src/plugins/meson/gbp-meson-pipeline-addin.h b/src/plugins/meson/gbp-meson-pipeline-addin.h
index f20c40430..f2b24093e 100644
--- a/src/plugins/meson/gbp-meson-pipeline-addin.h
+++ b/src/plugins/meson/gbp-meson-pipeline-addin.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-test-provider.c b/src/plugins/meson/gbp-meson-test-provider.c
index eb79512a7..509fcd4a7 100644
--- a/src/plugins/meson/gbp-meson-test-provider.c
+++ b/src/plugins/meson/gbp-meson-test-provider.c
@@ -21,6 +21,7 @@
 #define G_LOG_DOMAIN "gbp-meson-test-provider"
 
 #include <json-glib/json-glib.h>
+#include <libide-threading.h>
 
 #include "gbp-meson-build-system.h"
 #include "gbp-meson-test.h"
@@ -287,7 +288,7 @@ gbp_meson_test_provider_reload (gpointer user_data)
    * Check that we're working with a meson build system.
    */
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_system = ide_context_get_build_system (context);
+  build_system = ide_build_system_from_context (context);
   if (!GBP_IS_MESON_BUILD_SYSTEM (build_system))
     IDE_RETURN (G_SOURCE_REMOVE);
 
@@ -295,7 +296,7 @@ gbp_meson_test_provider_reload (gpointer user_data)
    * Get access to the pipeline so we can create a launcher to
    * introspect meson from within the build environment.
    */
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
   if (pipeline == NULL)
     IDE_RETURN (G_SOURCE_REMOVE);
@@ -376,6 +377,7 @@ gbp_meson_test_provider_run_cb (GObject      *object,
     }
 
   ide_test_set_status (test, IDE_TEST_STATUS_SUCCESS);
+  ide_object_destroy (IDE_OBJECT (runner));
 
   ide_task_return_boolean (task, TRUE);
 }
@@ -522,18 +524,21 @@ gbp_meson_test_provider_run_finish (IdeTestProvider  *provider,
 }
 
 static void
-gbp_meson_test_provider_constructed (GObject *object)
+gbp_meson_test_provider_parent_set (IdeObject *object,
+                                    IdeObject *parent)
 {
   GbpMesonTestProvider *self = (GbpMesonTestProvider *)object;
   IdeBuildManager *build_manager;
   IdeContext *context;
 
   g_assert (GBP_IS_MESON_TEST_PROVIDER (self));
+  g_assert (!parent || IDE_IS_OBJECT (parent));
 
-  G_OBJECT_CLASS (gbp_meson_test_provider_parent_class)->constructed (object);
+  if (parent == NULL)
+    return;
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_manager = ide_context_get_build_manager (context);
+  build_manager = ide_build_manager_from_context (context);
 
   g_signal_connect_object (build_manager,
                            "notify::pipeline",
@@ -560,11 +565,13 @@ static void
 gbp_meson_test_provider_class_init (GbpMesonTestProviderClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
   IdeTestProviderClass *provider_class = IDE_TEST_PROVIDER_CLASS (klass);
 
-  object_class->constructed = gbp_meson_test_provider_constructed;
   object_class->dispose = gbp_meson_test_provider_dispose;
 
+  i_object_class->parent_set = gbp_meson_test_provider_parent_set;
+
   provider_class->run_async = gbp_meson_test_provider_run_async;
   provider_class->run_finish = gbp_meson_test_provider_run_finish;
   provider_class->reload = gbp_meson_test_provider_queue_reload;
diff --git a/src/plugins/meson/gbp-meson-test-provider.h b/src/plugins/meson/gbp-meson-test-provider.h
index a048d1c0b..2ed6efd51 100644
--- a/src/plugins/meson/gbp-meson-test-provider.h
+++ b/src/plugins/meson/gbp-meson-test-provider.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-test.h b/src/plugins/meson/gbp-meson-test.h
index 23e802d21..5f35bbde8 100644
--- a/src/plugins/meson/gbp-meson-test.h
+++ b/src/plugins/meson/gbp-meson-test.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-tool-row.c b/src/plugins/meson/gbp-meson-tool-row.c
index abbe579cd..35976e185 100644
--- a/src/plugins/meson/gbp-meson-tool-row.c
+++ b/src/plugins/meson/gbp-meson-tool-row.c
@@ -217,7 +217,7 @@ gbp_meson_tool_row_class_init (GbpMesonToolRowClass *klass)
                                 G_TYPE_NONE,
                                 0);
 
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/meson-plugin/gbp-meson-tool-row.ui");
+  gtk_widget_class_set_template_from_resource (widget_class, "/plugins/meson/gbp-meson-tool-row.ui");
   gtk_widget_class_bind_template_child (widget_class, GbpMesonToolRow, name_label);
   gtk_widget_class_bind_template_child (widget_class, GbpMesonToolRow, delete_button);
 }
diff --git a/src/plugins/meson/gbp-meson-tool-row.h b/src/plugins/meson/gbp-meson-tool-row.h
index a12aa407d..42727a00c 100644
--- a/src/plugins/meson/gbp-meson-tool-row.h
+++ b/src/plugins/meson/gbp-meson-tool-row.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.c 
b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.c
index 3705b1b8b..50560bad6 100644
--- a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.c
+++ b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.c
@@ -22,6 +22,7 @@
 #define G_LOG_DOMAIN "gbp-meson-toolchain-edition-preferences-addin"
 
 #include <glib/gi18n.h>
+#include <libide-gui.h>
 
 #include "gbp-meson-toolchain-edition-preferences-addin.h"
 #include "gbp-meson-toolchain-edition-preferences-row.h"
@@ -73,7 +74,9 @@ meson_toolchain_edition_preferences_add_new (GbpMesonToolchainEditionPreferences
                            NULL);
 
   file = g_file_new_for_path (new_target);
-  output_stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error);
+
+  if ((output_stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error)))
+    g_output_stream_close (G_OUTPUT_STREAM (output_stream), NULL, NULL);
 
   id = dzl_preferences_add_custom (self->preferences, "sdk", "toolchain", GTK_WIDGET (pref_row), "", 1);
   g_array_append_val (self->ids, id);
@@ -175,7 +178,7 @@ gbp_meson_toolchain_edition_preferences_addin_load_finish (GObject      *object,
       id = dzl_preferences_add_custom (self->preferences, "sdk", "toolchain", GTK_WIDGET (pref_row), NULL, 
i);
       g_array_append_val (self->ids, id);
     }
-  
+
 }
 
 static void
diff --git a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.h 
b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.h
index e1d70e730..b9e5784a2 100644
--- a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.h
+++ b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-addin.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.c 
b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.c
index 7f8148236..75bac586b 100644
--- a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.c
+++ b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.c
@@ -439,7 +439,7 @@ gbp_meson_toolchain_edition_preferences_row_class_init (GbpMesonToolchainEdition
 
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/meson-plugin/gbp-meson-toolchain-edition-preferences-row.ui");
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/plugins/meson/gbp-meson-toolchain-edition-preferences-row.ui");
   gtk_widget_class_bind_template_child (widget_class, GbpMesonToolchainEditionPreferencesRow, display_name);
   gtk_widget_class_bind_template_child (widget_class, GbpMesonToolchainEditionPreferencesRow, popover);
   gtk_widget_class_bind_template_child (widget_class, GbpMesonToolchainEditionPreferencesRow, name_entry);
diff --git a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.h 
b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.h
index ac9cbf3db..2570cc7ef 100644
--- a/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.h
+++ b/src/plugins/meson/gbp-meson-toolchain-edition-preferences-row.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-toolchain-provider.c 
b/src/plugins/meson/gbp-meson-toolchain-provider.c
index e2656f2eb..ba8afd07a 100644
--- a/src/plugins/meson/gbp-meson-toolchain-provider.c
+++ b/src/plugins/meson/gbp-meson-toolchain-provider.c
@@ -230,7 +230,7 @@ gbp_meson_toolchain_provider_load_async (IdeToolchainProvider     *provider,
   ide_task_set_priority (task, G_PRIORITY_LOW);
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  build_system = ide_context_get_build_system (context);
+  build_system = ide_build_system_from_context (context);
 
   if (!GBP_IS_MESON_BUILD_SYSTEM (build_system))
     {
@@ -254,7 +254,7 @@ gbp_meson_toolchain_provider_load_async (IdeToolchainProvider     *provider,
   user_folder_path = g_build_filename (g_get_user_data_dir (), "meson", "cross", NULL);
   folders = g_list_append (folders, g_file_new_for_path (user_folder_path));
 
-  project_folder = g_file_get_parent (ide_context_get_project_file (context));
+  project_folder = ide_context_ref_workdir (context);
   folders = g_list_append (folders, g_steal_pointer (&project_folder));
 
   fs = file_searching_new ();
@@ -342,5 +342,4 @@ gbp_meson_toolchain_provider_class_init (GbpMesonToolchainProviderClass *klass)
 static void
 gbp_meson_toolchain_provider_init (GbpMesonToolchainProvider *self)
 {
-  
 }
diff --git a/src/plugins/meson/gbp-meson-toolchain-provider.h 
b/src/plugins/meson/gbp-meson-toolchain-provider.h
index 8d5fcca3b..c8ef84127 100644
--- a/src/plugins/meson/gbp-meson-toolchain-provider.h
+++ b/src/plugins/meson/gbp-meson-toolchain-provider.h
@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-toolchain.c b/src/plugins/meson/gbp-meson-toolchain.c
index aa54367a3..272f44902 100644
--- a/src/plugins/meson/gbp-meson-toolchain.c
+++ b/src/plugins/meson/gbp-meson-toolchain.c
@@ -46,16 +46,9 @@ static GParamSpec *properties [N_PROPS];
 GbpMesonToolchain *
 gbp_meson_toolchain_new (IdeContext *context)
 {
-  g_autoptr(GbpMesonToolchain) toolchain = NULL;
-
   g_return_val_if_fail (IDE_IS_CONTEXT (context), NULL);
 
-  toolchain = g_object_new (GBP_TYPE_MESON_TOOLCHAIN,
-                            "context", context,
-                            NULL);
-
-
-  return g_steal_pointer (&toolchain);
+  return g_object_new (GBP_TYPE_MESON_TOOLCHAIN, NULL);
 }
 
 gboolean
@@ -186,5 +179,4 @@ gbp_meson_toolchain_class_init (GbpMesonToolchainClass *klass)
 static void
 gbp_meson_toolchain_init (GbpMesonToolchain *self)
 {
-  
 }
diff --git a/src/plugins/meson/gbp-meson-toolchain.h b/src/plugins/meson/gbp-meson-toolchain.h
index e065d13f6..b5229bc44 100644
--- a/src/plugins/meson/gbp-meson-toolchain.h
+++ b/src/plugins/meson/gbp-meson-toolchain.h
@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/gbp-meson-utils.h b/src/plugins/meson/gbp-meson-utils.h
index af80d385b..3eff486a2 100644
--- a/src/plugins/meson/gbp-meson-utils.h
+++ b/src/plugins/meson/gbp-meson-utils.h
@@ -21,7 +21,7 @@
  */
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/meson/meson-plugin.c b/src/plugins/meson/meson-plugin.c
index c8efb7e36..b19008e34 100644
--- a/src/plugins/meson/meson-plugin.c
+++ b/src/plugins/meson/meson-plugin.c
@@ -19,22 +19,39 @@
  */
 
 #include <libpeas/peas.h>
-#include <ide.h>
+#include <libide-foundry.h>
+#include <libide-gui.h>
 
 #include "gbp-meson-build-system.h"
+#include "gbp-meson-build-system-discovery.h"
 #include "gbp-meson-build-target-provider.h"
 #include "gbp-meson-pipeline-addin.h"
 #include "gbp-meson-test-provider.h"
 #include "gbp-meson-toolchain-provider.h"
 #include "gbp-meson-toolchain-edition-preferences-addin.h"
 
-void
-gbp_meson_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_meson_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_PIPELINE_ADDIN, 
GBP_TYPE_MESON_PIPELINE_ADDIN);
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_SYSTEM, GBP_TYPE_MESON_BUILD_SYSTEM);
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_TARGET_PROVIDER, 
GBP_TYPE_MESON_BUILD_TARGET_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_TEST_PROVIDER, GBP_TYPE_MESON_TEST_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_TOOLCHAIN_PROVIDER, 
GBP_TYPE_MESON_TOOLCHAIN_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_PREFERENCES_ADDIN, 
GBP_TYPE_MESON_TOOLCHAIN_EDITION_PREFERENCES_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_PIPELINE_ADDIN,
+                                              GBP_TYPE_MESON_PIPELINE_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_SYSTEM,
+                                              GBP_TYPE_MESON_BUILD_SYSTEM);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_SYSTEM_DISCOVERY,
+                                              GBP_TYPE_MESON_BUILD_SYSTEM_DISCOVERY);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_TARGET_PROVIDER,
+                                              GBP_TYPE_MESON_BUILD_TARGET_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TEST_PROVIDER,
+                                              GBP_TYPE_MESON_TEST_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TOOLCHAIN_PROVIDER,
+                                              GBP_TYPE_MESON_TOOLCHAIN_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_PREFERENCES_ADDIN,
+                                              GBP_TYPE_MESON_TOOLCHAIN_EDITION_PREFERENCES_ADDIN);
 }
diff --git a/src/plugins/meson/meson.build b/src/plugins/meson/meson.build
index 90319af7a..a08a119b3 100644
--- a/src/plugins/meson/meson.build
+++ b/src/plugins/meson/meson.build
@@ -1,42 +1,29 @@
-if get_option('with_meson')
+if get_option('plugin_meson')
 
-meson_resources = gnome.compile_resources(    
-  'gbp-meson-resources',                      
-  'meson.gresource.xml',                      
-  c_name: 'gbp_meson',                        
-)                                           
-
-meson_sources = [
+plugins_sources += files([
   'meson-plugin.c',
   'gbp-meson-toolchain-edition-preferences-addin.c',
-  'gbp-meson-toolchain-edition-preferences-addin.h',
   'gbp-meson-toolchain-edition-preferences-row.c',
-  'gbp-meson-toolchain-edition-preferences-row.h',
   'gbp-meson-build-stage-cross-file.c',
-  'gbp-meson-build-stage-cross-file.h',
   'gbp-meson-build-system.c',
-  'gbp-meson-build-system.h',
+  'gbp-meson-build-system-discovery.c',
   'gbp-meson-build-target.c',
-  'gbp-meson-build-target.h',
   'gbp-meson-build-target-provider.c',
-  'gbp-meson-build-target-provider.h',
   'gbp-meson-pipeline-addin.c',
-  'gbp-meson-pipeline-addin.h',
   'gbp-meson-test-provider.c',
-  'gbp-meson-test-provider.h',
   'gbp-meson-test.c',
-  'gbp-meson-test.h',
   'gbp-meson-toolchain.c',
-  'gbp-meson-toolchain.h',
   'gbp-meson-toolchain-provider.c',
-  'gbp-meson-toolchain-provider.h',
   'gbp-meson-tool-row.c',
-  'gbp-meson-tool-row.h',
   'gbp-meson-utils.c',
-  'gbp-meson-utils.h',
-]
+])
+
+plugin_meson_resources = gnome.compile_resources(
+  'gbp-meson-resources',
+  'meson.gresource.xml',
+  c_name: 'gbp_meson',
+)
 
-gnome_builder_plugins_sources += files(meson_sources)       
-gnome_builder_plugins_sources += meson_resources[0]         
+plugins_sources += plugin_meson_resources[0]
 
 endif
diff --git a/src/plugins/meson/meson.gresource.xml b/src/plugins/meson/meson.gresource.xml
index a74ad8587..7aba3f64d 100644
--- a/src/plugins/meson/meson.gresource.xml
+++ b/src/plugins/meson/meson.gresource.xml
@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/meson">
     <file>meson.plugin</file>
-  </gresource>
-  <gresource prefix="/org/gnome/builder/plugins/meson-plugin">
     <file>gbp-meson-toolchain-edition-preferences-row.ui</file>
     <file>gbp-meson-tool-row.ui</file>
   </gresource>
diff --git a/src/plugins/meson/meson.plugin b/src/plugins/meson/meson.plugin
index 04941e4ae..8d9ab2349 100644
--- a/src/plugins/meson/meson.plugin
+++ b/src/plugins/meson/meson.plugin
@@ -1,10 +1,11 @@
 [Plugin]
-Module=meson-plugin
-Name=Meson
-Description=Provides integration with the Meson build system
 Authors=Patrick Griffis <tingping tingping se>
-Copyright=Copyright © 2016 Patrick Griffis
 Builtin=true
-X-Project-File-Filter-Pattern=meson.build
+Copyright=Copyright © 2016 Patrick Griffis
+Description=Provides integration with the Meson build system
+Embedded=_gbp_meson_register_types
+Hidden=true
+Module=meson
+Name=Meson
 X-Project-File-Filter-Name=Meson Project (meson.build)
-Embedded=gbp_meson_register_types
+X-Project-File-Filter-Pattern=meson.build


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