Commit 7a59c3af authored by Christian Hergert's avatar Christian Hergert
Browse files

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
parent 9255f1f8
......@@ -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));
}
......@@ -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,
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment