[gnome-builder: 58/139] autotools: port autotools plugin to libide-foundry



commit 4d75da511bf43b3c5321abaf6c977c8599cf8716
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:01:57 2019 -0800

    autotools: port autotools plugin to libide-foundry
    
    This updates the autotools plugin to work with our new libide-foundry
    components. Fairly straightforward port to alter our use of context,
    update includes, and integrate build system discovery.

 src/plugins/autotools/autotools-plugin.c           | 24 ++++--
 src/plugins/autotools/autotools.gresource.xml      |  2 +-
 src/plugins/autotools/autotools.plugin             | 13 +--
 .../gbp-autotools-build-system-discovery.c         | 49 +++++++++++
 .../gbp-autotools-build-system-discovery.h         | 31 +++++++
 .../autotools/ide-autotools-autogen-stage.h        |  2 +-
 src/plugins/autotools/ide-autotools-build-system.c | 94 +++++++++-------------
 src/plugins/autotools/ide-autotools-build-system.h |  2 +-
 .../ide-autotools-build-target-provider.c          |  4 +-
 .../ide-autotools-build-target-provider.h          |  2 +-
 src/plugins/autotools/ide-autotools-build-target.h |  2 +-
 src/plugins/autotools/ide-autotools-make-stage.c   |  1 +
 src/plugins/autotools/ide-autotools-make-stage.h   |  2 +-
 .../autotools/ide-autotools-makecache-stage.c      |  7 +-
 .../autotools/ide-autotools-makecache-stage.h      |  2 +-
 .../autotools/ide-autotools-pipeline-addin.c       | 26 +++---
 .../autotools/ide-autotools-pipeline-addin.h       |  2 +-
 src/plugins/autotools/ide-makecache.c              | 22 ++---
 src/plugins/autotools/ide-makecache.h              |  2 +-
 src/plugins/autotools/meson.build                  | 35 +++-----
 20 files changed, 189 insertions(+), 135 deletions(-)
---
diff --git a/src/plugins/autotools/autotools-plugin.c b/src/plugins/autotools/autotools-plugin.c
index 2a03d44f6..e75a1ca9a 100644
--- a/src/plugins/autotools/autotools-plugin.c
+++ b/src/plugins/autotools/autotools-plugin.c
@@ -18,17 +18,29 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <libpeas/peas.h>
-#include <ide.h>
+#include <libide-foundry.h>
 
 #include "ide-autotools-build-system.h"
+#include "gbp-autotools-build-system-discovery.h"
 #include "ide-autotools-build-target-provider.h"
 #include "ide-autotools-pipeline-addin.h"
 
-void
-ide_autotools_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_ide_autotools_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_PIPELINE_ADDIN, 
IDE_TYPE_AUTOTOOLS_PIPELINE_ADDIN);
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_SYSTEM, 
IDE_TYPE_AUTOTOOLS_BUILD_SYSTEM);
-  peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_TARGET_PROVIDER, 
IDE_TYPE_AUTOTOOLS_BUILD_TARGET_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_PIPELINE_ADDIN,
+                                              IDE_TYPE_AUTOTOOLS_PIPELINE_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_SYSTEM,
+                                              IDE_TYPE_AUTOTOOLS_BUILD_SYSTEM);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_SYSTEM_DISCOVERY,
+                                              GBP_TYPE_AUTOTOOLS_BUILD_SYSTEM_DISCOVERY);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_BUILD_TARGET_PROVIDER,
+                                              IDE_TYPE_AUTOTOOLS_BUILD_TARGET_PROVIDER);
 }
diff --git a/src/plugins/autotools/autotools.gresource.xml b/src/plugins/autotools/autotools.gresource.xml
index 0da868b96..ab16c25e4 100644
--- a/src/plugins/autotools/autotools.gresource.xml
+++ b/src/plugins/autotools/autotools.gresource.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/autotools">
     <file>autotools.plugin</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/autotools/autotools.plugin b/src/plugins/autotools/autotools.plugin
index 0e77ccf85..93cbe5b98 100644
--- a/src/plugins/autotools/autotools.plugin
+++ b/src/plugins/autotools/autotools.plugin
@@ -1,10 +1,11 @@
 [Plugin]
-Module=autotools-plugin
-Name=Autotools
-Description=Provides integration with the Autotools build system
 Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2015 Christian Hergert
 Builtin=true
-Embedded=ide_autotools_register_types
-X-Project-File-Filter-Pattern=configure.ac,configure.in
+Copyright=Copyright © 2015-2018 Christian Hergert
+Description=Provides integration with the Autotools build system
+Embedded=_ide_autotools_register_types
+Hidden=true
+Module=autotools
+Name=Autotools
 X-Project-File-Filter-Name=Autotools Project (configure.ac)
+X-Project-File-Filter-Pattern=configure.ac,configure.in
diff --git a/src/plugins/autotools/gbp-autotools-build-system-discovery.c 
b/src/plugins/autotools/gbp-autotools-build-system-discovery.c
new file mode 100644
index 000000000..31239425f
--- /dev/null
+++ b/src/plugins/autotools/gbp-autotools-build-system-discovery.c
@@ -0,0 +1,49 @@
+/* gbp-autotools-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-autotools-build-system-discovery"
+
+#include "config.h"
+
+#include "gbp-autotools-build-system-discovery.h"
+
+struct _GbpAutotoolsBuildSystemDiscovery
+{
+  IdeSimpleBuildSystemDiscovery parent_instance;
+};
+
+G_DEFINE_TYPE (GbpAutotoolsBuildSystemDiscovery,
+               gbp_autotools_build_system_discovery,
+               IDE_TYPE_SIMPLE_BUILD_SYSTEM_DISCOVERY)
+
+static void
+gbp_autotools_build_system_discovery_class_init (GbpAutotoolsBuildSystemDiscoveryClass *klass)
+{
+}
+
+static void
+gbp_autotools_build_system_discovery_init (GbpAutotoolsBuildSystemDiscovery *self)
+{
+  g_object_set (self,
+                "glob", "configure.ac",
+                "hint", "autotools",
+                "priority", 0,
+                NULL);
+}
diff --git a/src/plugins/autotools/gbp-autotools-build-system-discovery.h 
b/src/plugins/autotools/gbp-autotools-build-system-discovery.h
new file mode 100644
index 000000000..61238c280
--- /dev/null
+++ b/src/plugins/autotools/gbp-autotools-build-system-discovery.h
@@ -0,0 +1,31 @@
+/* gbp-autotools-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 <libide-foundry.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_AUTOTOOLS_BUILD_SYSTEM_DISCOVERY (gbp_autotools_build_system_discovery_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpAutotoolsBuildSystemDiscovery, gbp_autotools_build_system_discovery, GBP, 
AUTOTOOLS_BUILD_SYSTEM_DISCOVERY, IdeSimpleBuildSystemDiscovery)
+
+G_END_DECLS
diff --git a/src/plugins/autotools/ide-autotools-autogen-stage.h 
b/src/plugins/autotools/ide-autotools-autogen-stage.h
index ef871f6e5..b3ef5d8c0 100644
--- a/src/plugins/autotools/ide-autotools-autogen-stage.h
+++ b/src/plugins/autotools/ide-autotools-autogen-stage.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/autotools/ide-autotools-build-system.c 
b/src/plugins/autotools/ide-autotools-build-system.c
index bb0e5dca9..360d6134e 100644
--- a/src/plugins/autotools/ide-autotools-build-system.c
+++ b/src/plugins/autotools/ide-autotools-build-system.c
@@ -24,7 +24,8 @@
 
 #include <gio/gio.h>
 #include <gtksourceview/gtksource.h>
-#include <ide.h>
+#include <libide-foundry.h>
+#include <libide-vcs.h>
 #include <string.h>
 
 #include "ide-autotools-build-system.h"
@@ -204,7 +205,7 @@ invalidate_makecache_stage (gpointer data,
 static void
 evict_makecache (IdeContext *context)
 {
-  IdeBuildManager *build_manager = ide_context_get_build_manager (context);
+  IdeBuildManager *build_manager = ide_build_manager_from_context (context);
   IdeBuildPipeline *pipeline = ide_build_manager_get_pipeline (build_manager);
 
   ide_build_pipeline_foreach_stage (pipeline, invalidate_makecache_stage, NULL);
@@ -215,12 +216,12 @@ looks_like_makefile (IdeBuffer *buffer)
 {
   GtkSourceLanguage *language;
   const gchar *path;
-  IdeFile *file;
+  GFile *file;
 
   g_assert (IDE_IS_BUFFER (buffer));
 
   file = ide_buffer_get_file (buffer);
-  path = ide_file_get_path (file);
+  path = g_file_peek_path (file);
 
   if (path != NULL)
     {
@@ -273,45 +274,32 @@ ide_autotools_build_system__vcs_changed_cb (IdeAutotoolsBuildSystem *self,
 }
 
 static void
-ide_autotools_build_system__context_loaded_cb (IdeAutotoolsBuildSystem *self,
-                                               IdeContext              *context)
-{
-  IdeVcs *vcs;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
-  g_assert (IDE_IS_CONTEXT (context));
-
-  vcs = ide_context_get_vcs (context);
-
-  g_signal_connect_object (vcs,
-                           "changed",
-                           G_CALLBACK (ide_autotools_build_system__vcs_changed_cb),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  IDE_EXIT;
-}
-
-static void
-ide_autotools_build_system_constructed (GObject *object)
+ide_autotools_build_system_parent_set (IdeObject *object,
+                                       IdeObject *parent)
 {
   IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
   IdeBufferManager *buffer_manager;
   IdeContext *context;
+  IdeVcs *vcs;
 
-  G_OBJECT_CLASS (ide_autotools_build_system_parent_class)->constructed (object);
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
+  g_assert (!parent || IDE_IS_OBJECT (parent));
+
+  if (parent == NULL)
+    return;
 
   context = ide_object_get_context (IDE_OBJECT (self));
   g_assert (IDE_IS_CONTEXT (context));
 
-  buffer_manager = ide_context_get_buffer_manager (context);
+  buffer_manager = ide_buffer_manager_from_context (context);
   g_assert (IDE_IS_BUFFER_MANAGER (buffer_manager));
 
-  g_signal_connect_object (context,
-                           "loaded",
-                           G_CALLBACK (ide_autotools_build_system__context_loaded_cb),
+  vcs = ide_vcs_from_context (context);
+
+  g_signal_connect_object (vcs,
+                           "changed",
+                           G_CALLBACK (ide_autotools_build_system__vcs_changed_cb),
                            self,
                            G_CONNECT_SWAPPED);
 
@@ -336,7 +324,7 @@ ide_autotools_build_system_constructed (GObject *object)
 static gint
 ide_autotools_build_system_get_priority (IdeBuildSystem *system)
 {
-  return -500;
+  return 0;
 }
 
 static void
@@ -443,7 +431,7 @@ ide_autotools_build_system_get_build_flags_execute_cb (GObject      *object,
 
 static void
 ide_autotools_build_system_get_build_flags_async (IdeBuildSystem      *build_system,
-                                                  IdeFile             *file,
+                                                  GFile               *file,
                                                   GCancellable        *cancellable,
                                                   GAsyncReadyCallback  callback,
                                                   gpointer             user_data)
@@ -456,12 +444,12 @@ ide_autotools_build_system_get_build_flags_async (IdeBuildSystem      *build_sys
   IDE_ENTRY;
 
   g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
-  g_assert (IDE_IS_FILE (file));
+  g_assert (G_IS_FILE (file));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, ide_autotools_build_system_get_build_flags_async);
-  ide_task_set_task_data (task, g_object_ref (ide_file_get_file (file)), g_object_unref);
+  ide_task_set_task_data (task, g_object_ref (file), g_object_unref);
 
   /*
    * To get the build flags for the file, we first need to get the makecache
@@ -472,10 +460,11 @@ ide_autotools_build_system_get_build_flags_async (IdeBuildSystem      *build_sys
    */
 
   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,
                                    ide_autotools_build_system_get_build_flags_execute_cb,
                                    g_steal_pointer (&task));
@@ -514,8 +503,8 @@ ide_autotools_build_system_get_builddir (IdeBuildSystem   *build_system,
    */
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  vcs = ide_context_get_vcs (context);
-  workdir = ide_vcs_get_working_directory (vcs);
+  vcs = ide_vcs_from_context (context);
+  workdir = ide_vcs_get_workdir (vcs);
 
   if (!g_file_is_native (workdir))
     return NULL;
@@ -541,14 +530,14 @@ ide_autotools_build_system_get_display_name (IdeBuildSystem *build_system)
 }
 
 static void
-ide_autotools_build_system_finalize (GObject *object)
+ide_autotools_build_system_destroy (IdeObject *object)
 {
   IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
 
   g_clear_pointer (&self->tarball_name, g_free);
   g_clear_object (&self->project_file);
 
-  G_OBJECT_CLASS (ide_autotools_build_system_parent_class)->finalize (object);
+  IDE_OBJECT_CLASS (ide_autotools_build_system_parent_class)->destroy (object);
 }
 
 static void
@@ -610,12 +599,14 @@ static void
 ide_autotools_build_system_class_init (IdeAutotoolsBuildSystemClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
 
-  object_class->constructed = ide_autotools_build_system_constructed;
-  object_class->finalize = ide_autotools_build_system_finalize;
   object_class->get_property = ide_autotools_build_system_get_property;
   object_class->set_property = ide_autotools_build_system_set_property;
 
+  i_object_class->parent_set = ide_autotools_build_system_parent_set;
+  i_object_class->destroy = ide_autotools_build_system_destroy;
+
   properties [PROP_TARBALL_NAME] =
     g_param_spec_string ("tarball-name",
                          "Tarball Name",
@@ -728,28 +719,23 @@ ide_autotools_build_system_init_async (GAsyncInitable      *initable,
                                        GAsyncReadyCallback  callback,
                                        gpointer             user_data)
 {
-  IdeAutotoolsBuildSystem *system = (IdeAutotoolsBuildSystem *)initable;
+  IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)initable;
   g_autoptr(IdeTask) task = NULL;
-  IdeContext *context;
-  GFile *project_file;
 
   IDE_ENTRY;
 
-  g_return_if_fail (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (system));
+  g_return_if_fail (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
-  task = ide_task_new (initable, cancellable, callback, user_data);
+  task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, ide_autotools_build_system_init_async);
   ide_task_set_priority (task, G_PRIORITY_LOW);
 
-  context = ide_object_get_context (IDE_OBJECT (system));
-  project_file = ide_context_get_project_file (context);
-
-  ide_autotools_build_system_discover_file_async (system,
-                                                  project_file,
+  ide_autotools_build_system_discover_file_async (self,
+                                                  self->project_file,
                                                   cancellable,
                                                   discover_file_cb,
-                                                  g_object_ref (task));
+                                                  g_steal_pointer (&task));
 
   IDE_EXIT;
 }
diff --git a/src/plugins/autotools/ide-autotools-build-system.h 
b/src/plugins/autotools/ide-autotools-build-system.h
index 34f8138e5..f1340d515 100644
--- a/src/plugins/autotools/ide-autotools-build-system.h
+++ b/src/plugins/autotools/ide-autotools-build-system.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/autotools/ide-autotools-build-target-provider.c 
b/src/plugins/autotools/ide-autotools-build-target-provider.c
index 8f716e5d4..422dd13dd 100644
--- a/src/plugins/autotools/ide-autotools-build-target-provider.c
+++ b/src/plugins/autotools/ide-autotools-build-target-provider.c
@@ -96,7 +96,7 @@ ide_autotools_build_target_provider_get_targets_async (IdeBuildTargetProvider *p
   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 (!IDE_IS_AUTOTOOLS_BUILD_SYSTEM (build_system))
     {
@@ -107,7 +107,7 @@ ide_autotools_build_target_provider_get_targets_async (IdeBuildTargetProvider *p
       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);
   builddir = ide_build_pipeline_get_builddir (pipeline);
   builddir_file = g_file_new_for_path (builddir);
diff --git a/src/plugins/autotools/ide-autotools-build-target-provider.h 
b/src/plugins/autotools/ide-autotools-build-target-provider.h
index 98781f408..9d0700e29 100644
--- a/src/plugins/autotools/ide-autotools-build-target-provider.h
+++ b/src/plugins/autotools/ide-autotools-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/autotools/ide-autotools-build-target.h 
b/src/plugins/autotools/ide-autotools-build-target.h
index 02a103e30..ffd415607 100644
--- a/src/plugins/autotools/ide-autotools-build-target.h
+++ b/src/plugins/autotools/ide-autotools-build-target.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/autotools/ide-autotools-make-stage.c 
b/src/plugins/autotools/ide-autotools-make-stage.c
index 395c3e0a3..546101a30 100644
--- a/src/plugins/autotools/ide-autotools-make-stage.c
+++ b/src/plugins/autotools/ide-autotools-make-stage.c
@@ -340,6 +340,7 @@ ide_autotools_make_stage_clean_finish (IdeBuildStage  *stage,
 static void
 ide_autotools_make_stage_query (IdeBuildStage    *stage,
                                 IdeBuildPipeline *pipeline,
+                                GPtrArray        *targets,
                                 GCancellable     *cancellable)
 {
   IDE_ENTRY;
diff --git a/src/plugins/autotools/ide-autotools-make-stage.h 
b/src/plugins/autotools/ide-autotools-make-stage.h
index 543fae230..fca10a50d 100644
--- a/src/plugins/autotools/ide-autotools-make-stage.h
+++ b/src/plugins/autotools/ide-autotools-make-stage.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/autotools/ide-autotools-makecache-stage.c 
b/src/plugins/autotools/ide-autotools-makecache-stage.c
index b4d71bf0d..81ae9743e 100644
--- a/src/plugins/autotools/ide-autotools-makecache-stage.c
+++ b/src/plugins/autotools/ide-autotools-makecache-stage.c
@@ -61,7 +61,9 @@ ide_autotools_makecache_stage_makecache_cb (GObject      *object,
   self = ide_task_get_source_object (task);
   g_assert (IDE_IS_AUTOTOOLS_MAKECACHE_STAGE (self));
 
-  g_clear_object (&self->makecache);
+  ide_clear_and_destroy_object (&self->makecache);
+  ide_object_append (IDE_OBJECT (self), IDE_OBJECT (makecache));
+
   self->makecache = g_steal_pointer (&makecache);
 
   ide_task_return_boolean (task, TRUE);
@@ -207,13 +209,11 @@ ide_autotools_makecache_stage_new_for_pipeline (IdeBuildPipeline  *pipeline,
   const gchar *make = "make";
   IdeConfiguration *config;
   IdeRuntime *runtime;
-  IdeContext *context;
 
   IDE_ENTRY;
 
   g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (pipeline), NULL);
 
-  context = ide_object_get_context (IDE_OBJECT (pipeline));
   config = ide_build_pipeline_get_configuration (pipeline);
   runtime = ide_configuration_get_runtime (config);
 
@@ -231,7 +231,6 @@ ide_autotools_makecache_stage_new_for_pipeline (IdeBuildPipeline  *pipeline,
   ide_subprocess_launcher_push_argv (launcher, "-s");
 
   stage = g_object_new (IDE_TYPE_AUTOTOOLS_MAKECACHE_STAGE,
-                        "context", context,
                         "launcher", launcher,
                         "ignore-exit-status", TRUE,
                         NULL);
diff --git a/src/plugins/autotools/ide-autotools-makecache-stage.h 
b/src/plugins/autotools/ide-autotools-makecache-stage.h
index 4e6c771ec..98b6a1d55 100644
--- a/src/plugins/autotools/ide-autotools-makecache-stage.h
+++ b/src/plugins/autotools/ide-autotools-makecache-stage.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 #include "ide-makecache.h"
 
diff --git a/src/plugins/autotools/ide-autotools-pipeline-addin.c 
b/src/plugins/autotools/ide-autotools-pipeline-addin.c
index 9a3e33ce7..628819828 100644
--- a/src/plugins/autotools/ide-autotools-pipeline-addin.c
+++ b/src/plugins/autotools/ide-autotools-pipeline-addin.c
@@ -28,8 +28,6 @@
 #include "ide-autotools-makecache-stage.h"
 #include "ide-autotools-pipeline-addin.h"
 
-#include "toolchain/ide-simple-toolchain.h"
-
 static gboolean
 register_autoreconf_stage (IdeAutotoolsPipelineAddin  *self,
                            IdeBuildPipeline           *pipeline,
@@ -37,7 +35,6 @@ register_autoreconf_stage (IdeAutotoolsPipelineAddin  *self,
 {
   g_autofree gchar *configure_path = NULL;
   g_autoptr(IdeBuildStage) stage = NULL;
-  IdeContext *context;
   const gchar *srcdir;
   gboolean completed;
   guint stage_id;
@@ -45,7 +42,6 @@ register_autoreconf_stage (IdeAutotoolsPipelineAddin  *self,
   g_assert (IDE_IS_AUTOTOOLS_PIPELINE_ADDIN (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
-  context = ide_object_get_context (IDE_OBJECT (self));
   configure_path = ide_build_pipeline_build_srcdir_path (pipeline, "configure", NULL);
   completed = g_file_test (configure_path, G_FILE_TEST_IS_REGULAR);
   srcdir = ide_build_pipeline_get_srcdir (pipeline);
@@ -53,11 +49,10 @@ register_autoreconf_stage (IdeAutotoolsPipelineAddin  *self,
   stage = g_object_new (IDE_TYPE_AUTOTOOLS_AUTOGEN_STAGE,
                         "name", _("Bootstrapping build system"),
                         "completed", completed,
-                        "context", context,
                         "srcdir", srcdir,
                         NULL);
 
-  stage_id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_AUTOGEN, 0, stage);
+  stage_id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_AUTOGEN, 0, stage);
 
   ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
 
@@ -99,6 +94,7 @@ compare_mtime (const gchar *path_a,
 static void
 check_configure_status (IdeAutotoolsPipelineAddin *self,
                         IdeBuildPipeline          *pipeline,
+                        GPtrArray                 *targets,
                         GCancellable              *cancellable,
                         IdeBuildStage             *stage)
 {
@@ -291,7 +287,6 @@ register_configure_stage (IdeAutotoolsPipelineAddin  *self,
 
   stage = g_object_new (IDE_TYPE_BUILD_STAGE_LAUNCHER,
                         "name", _("Configuring project"),
-                        "context", ide_object_get_context (IDE_OBJECT (self)),
                         "launcher", launcher,
                         NULL);
 
@@ -314,7 +309,7 @@ register_configure_stage (IdeAutotoolsPipelineAddin  *self,
                            self,
                            G_CONNECT_SWAPPED);
 
-  stage_id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_CONFIGURE, 0, stage);
+  stage_id = ide_build_pipeline_attach (pipeline, IDE_BUILD_PHASE_CONFIGURE, 0, stage);
 
   ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
 
@@ -331,26 +326,23 @@ register_make_stage (IdeAutotoolsPipelineAddin  *self,
 {
   g_autoptr(IdeBuildStage) stage = NULL;
   IdeConfiguration *config;
-  IdeContext *context;
   guint stage_id;
   gint parallel;
 
   g_assert (IDE_IS_AUTOTOOLS_PIPELINE_ADDIN (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
-  context = ide_object_get_context (IDE_OBJECT (pipeline));
   config = ide_build_pipeline_get_configuration (pipeline);
   parallel = ide_configuration_get_parallelism (config);
 
   stage = g_object_new (IDE_TYPE_AUTOTOOLS_MAKE_STAGE,
                         "name", _("Building project"),
                         "clean-target", clean_target,
-                        "context", context,
                         "parallel", parallel,
                         "target", target,
                         NULL);
 
-  stage_id = ide_build_pipeline_connect (pipeline, phase, 0, stage);
+  stage_id = ide_build_pipeline_attach (pipeline, phase, 0, stage);
   ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
 
   return TRUE;
@@ -372,10 +364,10 @@ register_makecache_stage (IdeAutotoolsPipelineAddin  *self,
 
   ide_build_stage_set_name (stage, _("Caching build commands"));
 
-  stage_id = ide_build_pipeline_connect (pipeline,
-                                         IDE_BUILD_PHASE_CONFIGURE | IDE_BUILD_PHASE_AFTER,
-                                         0,
-                                         stage);
+  stage_id = ide_build_pipeline_attach (pipeline,
+                                        IDE_BUILD_PHASE_CONFIGURE | IDE_BUILD_PHASE_AFTER,
+                                        0,
+                                        stage);
   ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
 
   return TRUE;
@@ -394,7 +386,7 @@ ide_autotools_pipeline_addin_load (IdeBuildPipelineAddin *addin,
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
   context = ide_object_get_context (IDE_OBJECT (addin));
-  build_system = ide_context_get_build_system (context);
+  build_system = ide_build_system_from_context (context);
 
   if (!IDE_IS_AUTOTOOLS_BUILD_SYSTEM (build_system))
     return;
diff --git a/src/plugins/autotools/ide-autotools-pipeline-addin.h 
b/src/plugins/autotools/ide-autotools-pipeline-addin.h
index f8f992972..988bd3cc3 100644
--- a/src/plugins/autotools/ide-autotools-pipeline-addin.h
+++ b/src/plugins/autotools/ide-autotools-pipeline-addin.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/autotools/ide-makecache.c b/src/plugins/autotools/ide-makecache.c
index 1a7e6408d..3aa5ad5a6 100644
--- a/src/plugins/autotools/ide-makecache.c
+++ b/src/plugins/autotools/ide-makecache.c
@@ -32,7 +32,9 @@
 #include <glib/gstdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <ide.h>
+
+#include <libide-foundry.h>
+#include <libide-vcs.h>
 
 #include "ide-autotools-build-target.h"
 #include "ide-makecache.h"
@@ -125,8 +127,8 @@ ide_makecache_get_relative_path (IdeMakecache *self,
   g_assert (G_IS_FILE (file));
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  vcs = ide_context_get_vcs (context);
-  workdir = ide_vcs_get_working_directory (vcs);
+  vcs = ide_vcs_from_context (context);
+  workdir = ide_vcs_get_workdir (vcs);
 
   return g_file_get_relative_path (workdir, file);
 }
@@ -145,8 +147,6 @@ is_target_interesting (const gchar *target)
  * ide_makecache_get_file_targets_searched:
  *
  * Returns: (transfer container): a #GPtrArray of #IdeMakecacheTarget.
- *
- * Since: 3.32
  */
 static GPtrArray *
 ide_makecache_get_file_targets_searched (GMappedFile *mapped,
@@ -1110,7 +1110,6 @@ ide_makecache_new_for_cache_file_async (IdeRuntime          *runtime,
   g_autoptr(GMappedFile) mapped = NULL;
   g_autoptr(GError) error = NULL;
   g_autofree gchar *cache_path = NULL;
-  IdeContext *context;
 
   IDE_ENTRY;
 
@@ -1152,11 +1151,7 @@ ide_makecache_new_for_cache_file_async (IdeRuntime          *runtime,
       IDE_EXIT;
     }
 
-  context = ide_object_get_context (IDE_OBJECT (runtime));
-
-  self = g_object_new (IDE_TYPE_MAKECACHE,
-                       "context", context,
-                       NULL);
+  self = g_object_new (IDE_TYPE_MAKECACHE, NULL);
 
   mapped = g_mapped_file_new (cache_path, FALSE, &error);
 
@@ -1247,8 +1242,6 @@ ide_makecache_get_file_targets_async (IdeMakecache        *self,
  * Completes an asynchronous request to ide_makecache_get_file_flags_async().
  *
  * Returns: (transfer container) (element-type Ide.MakecacheTarget): An array of targets.
- *
- * Since: 3.32
  */
 GPtrArray *
 ide_makecache_get_file_targets_finish (IdeMakecache  *self,
@@ -1488,7 +1481,7 @@ ide_makecache_get_build_targets_worker (GTask        *task,
    */
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  configmgr = ide_context_get_configuration_manager (context);
+  configmgr = ide_configuration_manager_from_context (context);
   config = ide_configuration_manager_get_current (configmgr);
   runtime = ide_configuration_get_runtime (config);
 
@@ -1681,7 +1674,6 @@ ide_makecache_get_build_targets_worker (GTask        *task,
 
               target = g_object_new (IDE_TYPE_AUTOTOOLS_BUILD_TARGET,
                                      "build-directory", makedir,
-                                     "context", context,
                                      "install-directory", installdir,
                                      "name", name,
                                      NULL);
diff --git a/src/plugins/autotools/ide-makecache.h b/src/plugins/autotools/ide-makecache.h
index 9792c0f15..75604b247 100644
--- a/src/plugins/autotools/ide-makecache.h
+++ b/src/plugins/autotools/ide-makecache.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 #include "ide-makecache-target.h"
 
diff --git a/src/plugins/autotools/meson.build b/src/plugins/autotools/meson.build
index 94506d3dd..93c592742 100644
--- a/src/plugins/autotools/meson.build
+++ b/src/plugins/autotools/meson.build
@@ -1,34 +1,25 @@
-if get_option('with_autotools')
+if get_option('plugin_autotools')
 
-autotools_resources = gnome.compile_resources(    
-  'ide-autotools-resources',                      
-  'autotools.gresource.xml',                      
-  c_name: 'ide_autotools',                        
-)                                           
-
-autotools_sources = [
+plugins_sources += files([
   'autotools-plugin.c',
   'ide-autotools-autogen-stage.c',
-  'ide-autotools-autogen-stage.h',
   'ide-autotools-build-system.c',
-  'ide-autotools-build-system.h',
-  'ide-autotools-build-target.c',
-  'ide-autotools-build-target.h',
+  'gbp-autotools-build-system-discovery.c',
   'ide-autotools-build-target-provider.c',
-  'ide-autotools-build-target-provider.h',
+  'ide-autotools-build-target.c',
   'ide-autotools-make-stage.c',
-  'ide-autotools-make-stage.h',
   'ide-autotools-makecache-stage.c',
-  'ide-autotools-makecache-stage.h',
   'ide-autotools-pipeline-addin.c',
-  'ide-autotools-pipeline-addin.h',
-  'ide-makecache.c',
-  'ide-makecache.h',
   'ide-makecache-target.c',
-  'ide-makecache-target.h',
-]
+  'ide-makecache.c',
+])
+
+plugin_autotools_resources = gnome.compile_resources(
+  'gbp-autotools-resources',
+  'autotools.gresource.xml',
+  c_name: 'gbp_autotools',
+)
 
-gnome_builder_plugins_sources += files(autotools_sources)       
-gnome_builder_plugins_sources += autotools_resources[0]         
+plugins_sources += plugin_autotools_resources[0]
 
 endif


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