[gnome-builder] buildsystem: add ide_build_system_get_id() vfunc
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] buildsystem: add ide_build_system_get_id() vfunc
- Date: Tue, 14 Mar 2017 00:45:27 +0000 (UTC)
commit 7a59c3af68c21d9aa13d359ef4e003532c32ec0c
Author: Christian Hergert <chergert redhat com>
Date: Mon Mar 13 15:13:56 2017 -0700
buildsystem: add ide_build_system_get_id() vfunc
This allows for specifying a small identifier for the build system type
such as "autotools" or "cmake" or "meson" or "cargo".
We can use this in future patches for matching up a build system with
a given load hint.
https://bugzilla.gnome.org/show_bug.cgi?id=780006
libide/buildsystem/ide-build-system.c | 11 +++++++++++
libide/buildsystem/ide-build-system.h | 2 ++
plugins/autotools/ide-autotools-build-system.c | 7 +++++++
plugins/cargo/cargo_plugin.py | 3 +++
plugins/cmake/cmake_plugin/__init__.py | 3 +++
plugins/meson/meson_plugin/__init__.py | 3 +++
6 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-system.c b/libide/buildsystem/ide-build-system.c
index 9b0d064..615ed4b 100644
--- a/libide/buildsystem/ide-build-system.c
+++ b/libide/buildsystem/ide-build-system.c
@@ -318,3 +318,14 @@ ide_build_system_get_builddir (IdeBuildSystem *self,
IDE_RETURN (ret);
}
+
+gchar *
+ide_build_system_get_id (IdeBuildSystem *self)
+{
+ g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
+
+ if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_id)
+ return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_id (self);
+
+ return g_strdup (G_OBJECT_TYPE_NAME (self));
+}
diff --git a/libide/buildsystem/ide-build-system.h b/libide/buildsystem/ide-build-system.h
index 1fd05af..f5d00ec 100644
--- a/libide/buildsystem/ide-build-system.h
+++ b/libide/buildsystem/ide-build-system.h
@@ -51,8 +51,10 @@ struct _IdeBuildSystemInterface
GError **error);
gchar *(*get_builddir) (IdeBuildSystem *self,
IdeConfiguration *configuration);
+ gchar *(*get_id) (IdeBuildSystem *self);
};
+gchar *ide_build_system_get_id (IdeBuildSystem *self);
void ide_build_system_new_async (IdeContext *context,
GFile *project_file,
GCancellable *cancellable,
diff --git a/plugins/autotools/ide-autotools-build-system.c b/plugins/autotools/ide-autotools-build-system.c
index beca8c5..75ea1cb 100644
--- a/plugins/autotools/ide-autotools-build-system.c
+++ b/plugins/autotools/ide-autotools-build-system.c
@@ -638,6 +638,12 @@ ide_autotools_build_system_get_builddir (IdeBuildSystem *build_system,
return NULL;
}
+static gchar *
+ide_autotools_build_system_get_id (IdeBuildSystem *build_system)
+{
+ return g_strdup ("autotools");
+}
+
static void
ide_autotools_build_system_finalize (GObject *object)
{
@@ -702,6 +708,7 @@ build_system_iface_init (IdeBuildSystemInterface *iface)
iface->get_builddir = ide_autotools_build_system_get_builddir;
iface->get_build_targets_async = ide_autotools_build_system_get_build_targets_async;
iface->get_build_targets_finish = ide_autotools_build_system_get_build_targets_finish;
+ iface->get_id = ide_autotools_build_system_get_id;
}
static void
diff --git a/plugins/cargo/cargo_plugin.py b/plugins/cargo/cargo_plugin.py
index d926044..6eed797 100644
--- a/plugins/cargo/cargo_plugin.py
+++ b/plugins/cargo/cargo_plugin.py
@@ -34,6 +34,9 @@ _CARGO = 'cargo'
class CargoBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
project_file = GObject.Property(type=Gio.File)
+ def get_id(self):
+ return 'cargo'
+
def do_init_async(self, io_priority, cancellable, callback, data):
task = Gio.Task.new(self, cancellable, callback)
diff --git a/plugins/cmake/cmake_plugin/__init__.py b/plugins/cmake/cmake_plugin/__init__.py
index 2d9cf49..9605c10 100644
--- a/plugins/cmake/cmake_plugin/__init__.py
+++ b/plugins/cmake/cmake_plugin/__init__.py
@@ -31,6 +31,9 @@ _NINJA_NAMES = [ 'ninja-build', 'ninja' ]
class CMakeBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
project_file = GObject.Property(type=Gio.File)
+ def get_id(self):
+ return 'cmake'
+
def do_init_async(self, priority, cancel, callback, data=None):
task = Gio.Task.new(self, cancel, callback)
task.set_priority(priority)
diff --git a/plugins/meson/meson_plugin/__init__.py b/plugins/meson/meson_plugin/__init__.py
index 9a7da2d..307c036 100644
--- a/plugins/meson/meson_plugin/__init__.py
+++ b/plugins/meson/meson_plugin/__init__.py
@@ -59,6 +59,9 @@ def extract_flags(command: str, builddir: str):
class MesonBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
project_file = GObject.Property(type=Gio.File)
+ def get_id(self):
+ return 'meson'
+
def do_init_async(self, priority, cancel, callback, data=None):
task = Gio.Task.new(self, cancel, callback)
task.set_priority(priority)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]