Commit cbbab048 authored by Christian Hergert's avatar Christian Hergert

plugins: move build systems and miners to plugins

This touches a lot of components, so splitting things up would not allow
us to be in a buildable state.

In particular:

 - IdeBuildSystem made an interface
 - IdeProjectMiner made an interface
 - Autotools plugin created, with build system and miner
 - Fallback plugin created, with directory fallback build system
 - Context updated to take this into account
 - IdeObject can now be used to create build systems from plugins

We should follow this up by moving version control to plugins as well.
parent 098e1f9f
......@@ -393,12 +393,14 @@ AC_CONFIG_FILES([
libide/Makefile
plugins/Makefile
plugins/autotools/Makefile
plugins/clang/Makefile
plugins/command-bar/Makefile
plugins/c-pack/Makefile
plugins/ctags/Makefile
plugins/devhelp/Makefile
plugins/device-manager/Makefile
plugins/fallback/Makefile
plugins/file-search/Makefile
plugins/gnome-code-assistance/Makefile
plugins/html-completion/Makefile
......
......@@ -7,8 +7,6 @@ pkglibdir = $(libdir)/gnome-builder
pkglib_LTLIBRARIES = libide-1.0.la
libide_1_0_la_public_sources = \
directory/ide-directory-build-system.c \
directory/ide-directory-build-system.h \
directory/ide-directory-vcs.c \
directory/ide-directory-vcs.h \
doap/ide-doap-person.c \
......@@ -182,18 +180,6 @@ libide_1_0_la_public_sources = \
libide_1_0_la_SOURCES = \
$(libide_1_0_la_public_sources) \
autotools/ide-autotools-build-system.c \
autotools/ide-autotools-build-system.h \
autotools/ide-autotools-build-task.c \
autotools/ide-autotools-build-task.h \
autotools/ide-autotools-builder.c \
autotools/ide-autotools-builder.h \
autotools/ide-autotools-project-miner.c \
autotools/ide-autotools-project-miner.h \
autotools/ide-makecache-target.c \
autotools/ide-makecache-target.h \
autotools/ide-makecache.c \
autotools/ide-makecache.h \
editorconfig/editorconfig-glib.c \
editorconfig/editorconfig-glib.h \
editorconfig/ide-editorconfig-file-settings.c \
......@@ -269,7 +255,6 @@ libide_1_0_la_includes = \
-I$(top_srcdir)/contrib/search \
-I$(top_srcdir)/contrib/xml \
-I$(srcdir) \
-I$(srcdir)/autotools \
-I$(srcdir)/directory \
-I$(srcdir)/doap \
-I$(srcdir)/editorconfig \
......
......@@ -22,22 +22,39 @@
#include "ide-context.h"
#include "ide-device.h"
#include "ide-file.h"
#include "ide-object.h"
typedef struct
{
GFile *project_file;
} IdeBuildSystemPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (IdeBuildSystem, ide_build_system, IDE_TYPE_OBJECT)
G_DEFINE_INTERFACE (IdeBuildSystem, ide_build_system, IDE_TYPE_OBJECT)
enum {
PROP_0,
PROP_CONTEXT,
PROP_PROJECT_FILE,
LAST_PROP
};
static GParamSpec *gParamSpecs [LAST_PROP];
gint
ide_build_system_get_priority (IdeBuildSystem *self)
{
IdeBuildSystemInterface *iface;
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), 0);
iface = IDE_BUILD_SYSTEM_GET_IFACE (self);
if (iface->get_priority != NULL)
return iface->get_priority (self);
return 0;
}
/**
* ide_build_system_get_build_flags_async:
*
......@@ -58,8 +75,8 @@ ide_build_system_get_build_flags_async (IdeBuildSystem *self,
g_return_if_fail (IDE_IS_FILE (file));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
if (IDE_BUILD_SYSTEM_GET_CLASS (self)->get_build_flags_async)
return IDE_BUILD_SYSTEM_GET_CLASS (self)->get_build_flags_async (self, file, cancellable,
if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_async)
return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_async (self, file, cancellable,
callback, user_data);
task = g_task_new (self, cancellable, callback, user_data);
......@@ -81,116 +98,41 @@ ide_build_system_get_build_flags_finish (IdeBuildSystem *self,
{
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
if (IDE_BUILD_SYSTEM_GET_CLASS (self)->get_build_flags_finish)
return IDE_BUILD_SYSTEM_GET_CLASS (self)->get_build_flags_finish (self, result, error);
if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_finish)
return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_finish (self, result, error);
return g_new0 (gchar*, 1);
}
/**
* ide_build_system_get_project_file:
* @self: (in): A #IdeBuildSystem.
*
* Gets the #IdeBuildSystem:project-file property.
*
* Returns: (transfer none): A #GFile.
*/
GFile *
ide_build_system_get_project_file (IdeBuildSystem *system)
{
IdeBuildSystemPrivate *priv = ide_build_system_get_instance_private (system);
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (system), NULL);
return priv->project_file;
}
void
_ide_build_system_set_project_file (IdeBuildSystem *system,
GFile *project_file)
{
IdeBuildSystemPrivate *priv = ide_build_system_get_instance_private (system);
g_return_if_fail (IDE_IS_BUILD_SYSTEM (system));
g_return_if_fail (G_IS_FILE (project_file));
if (g_set_object (&priv->project_file, project_file))
g_object_notify_by_pspec (G_OBJECT (system), gParamSpecs [PROP_PROJECT_FILE]);
}
static void
ide_build_system_finalize (GObject *object)
ide_build_system_default_init (IdeBuildSystemInterface *iface)
{
IdeBuildSystem *self = (IdeBuildSystem *)object;
IdeBuildSystemPrivate *priv = ide_build_system_get_instance_private (self);
g_clear_object (&priv->project_file);
G_OBJECT_CLASS (ide_build_system_parent_class)->finalize (object);
}
static void
ide_build_system_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
IdeBuildSystem *self = IDE_BUILD_SYSTEM (object);
switch (prop_id)
{
case PROP_PROJECT_FILE:
g_value_set_object (value, ide_build_system_get_project_file (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_build_system_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
IdeBuildSystem *self = IDE_BUILD_SYSTEM (object);
switch (prop_id)
{
case PROP_PROJECT_FILE:
_ide_build_system_set_project_file (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_build_system_class_init (IdeBuildSystemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ide_build_system_finalize;
object_class->get_property = ide_build_system_get_property;
object_class->set_property = ide_build_system_set_property;
gParamSpecs [PROP_PROJECT_FILE] =
g_param_spec_object ("project-file",
_("Project File"),
_("The project file."),
G_TYPE_FILE,
(G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface, gParamSpecs [PROP_PROJECT_FILE]);
gParamSpecs [PROP_CONTEXT] =
g_param_spec_object ("context",
_("Context"),
_("Context"),
IDE_TYPE_CONTEXT,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface, gParamSpecs [PROP_CONTEXT]);
}
static void
ide_build_system_init (IdeBuildSystem *self)
static gint
sort_priority (gconstpointer a,
gconstpointer b,
gpointer data)
{
IdeBuildSystem **as = (IdeBuildSystem **)a;
IdeBuildSystem **bs = (IdeBuildSystem **)b;
return ide_build_system_get_priority (*as) - ide_build_system_get_priority (*bs);
}
/**
......@@ -218,16 +160,16 @@ ide_build_system_new_async (IdeContext *context,
g_return_if_fail (IDE_IS_CONTEXT (context));
g_return_if_fail (G_IS_FILE (project_file));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback);
ide_object_new_async (IDE_BUILD_SYSTEM_EXTENSION_POINT,
G_PRIORITY_DEFAULT,
cancellable,
callback,
user_data,
"context", context,
"project-file", project_file,
NULL);
ide_object_new_for_extension_async (IDE_TYPE_BUILD_SYSTEM,
sort_priority, NULL,
G_PRIORITY_DEFAULT,
cancellable,
callback,
user_data,
"context", context,
"project-file", project_file,
NULL);
}
/**
......@@ -248,7 +190,7 @@ ide_build_system_new_finish (GAsyncResult *result,
ret = ide_object_new_finish (result, error);
return IDE_BUILD_SYSTEM (ret);
return ret ? IDE_BUILD_SYSTEM (ret) : NULL;
}
/**
......@@ -269,17 +211,17 @@ ide_build_system_get_builder (IdeBuildSystem *system,
IdeDevice *device,
GError **error)
{
IdeBuildSystemClass *klass;
IdeBuildSystemInterface *iface;
IdeBuilder *ret = NULL;
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (system), NULL);
g_return_val_if_fail (config, NULL);
g_return_val_if_fail (IDE_IS_DEVICE (device), NULL);
klass = IDE_BUILD_SYSTEM_GET_CLASS (system);
iface = IDE_BUILD_SYSTEM_GET_IFACE (system);
if (klass->get_builder)
ret = klass->get_builder (system, config, device, error);
if (iface->get_builder)
ret = iface->get_builder (system, config, device, error);
else
g_set_error (error,
G_IO_ERROR,
......
......@@ -25,15 +25,15 @@
G_BEGIN_DECLS
#define IDE_TYPE_BUILD_SYSTEM (ide_build_system_get_type())
#define IDE_BUILD_SYSTEM_EXTENSION_POINT "org.gnome.libide.extensions.build-system"
#define IDE_TYPE_BUILD_SYSTEM (ide_build_system_get_type())
G_DECLARE_DERIVABLE_TYPE (IdeBuildSystem, ide_build_system, IDE, BUILD_SYSTEM, IdeObject)
G_DECLARE_INTERFACE (IdeBuildSystem, ide_build_system, IDE, BUILD_SYSTEM, IdeObject)
struct _IdeBuildSystemClass
struct _IdeBuildSystemInterface
{
IdeObjectClass parent;
GTypeInterface parent_iface;
gint (*get_priority) (IdeBuildSystem *system);
IdeBuilder *(*get_builder) (IdeBuildSystem *system,
GKeyFile *config,
IdeDevice *device,
......@@ -48,7 +48,7 @@ struct _IdeBuildSystemClass
GError **error);
};
GFile *ide_build_system_get_project_file (IdeBuildSystem *self);
gint ide_build_system_get_priority (IdeBuildSystem *self);
void ide_build_system_get_build_flags_async (IdeBuildSystem *self,
IdeFile *file,
GCancellable *cancellable,
......
......@@ -947,8 +947,8 @@ ide_context_init_build_system_cb (GObject *object,
g_autoptr(IdeBuildSystem) build_system = NULL;
g_autoptr(GTask) task = user_data;
IdeContext *self;
g_autoptr(GFile) project_file = NULL;
GError *error = NULL;
GFile *project_file;
self = g_task_get_source_object (task);
......@@ -961,7 +961,9 @@ ide_context_init_build_system_cb (GObject *object,
self->build_system = g_object_ref (build_system);
/* allow the build system to override the project file */
project_file = ide_build_system_get_project_file (self->build_system);
g_object_get (self->build_system,
"project-file", &project_file,
NULL);
if (project_file != NULL)
ide_context_set_project_file (self, project_file);
......
......@@ -20,7 +20,7 @@
#include "ide-project-miner.h"
G_DEFINE_ABSTRACT_TYPE (IdeProjectMiner, ide_project_miner, G_TYPE_OBJECT)
G_DEFINE_INTERFACE (IdeProjectMiner, ide_project_miner, G_TYPE_OBJECT)
enum {
DISCOVERED,
......@@ -30,7 +30,7 @@ enum {
static guint gSignals [LAST_SIGNAL];
static void
ide_project_miner_class_init (IdeProjectMinerClass *klass)
ide_project_miner_default_init (IdeProjectMinerInterface *iface)
{
/**
* IdeProjectMiner::discovered:
......@@ -42,20 +42,15 @@ ide_project_miner_class_init (IdeProjectMinerClass *klass)
* ide_project_miner_emit_discovered() was used to emit the signal.
*/
gSignals [DISCOVERED] = g_signal_new ("discovered",
G_TYPE_FROM_CLASS (klass),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IdeProjectMinerClass, discovered),
G_STRUCT_OFFSET (IdeProjectMinerInterface, discovered),
NULL, NULL, NULL,
G_TYPE_NONE,
1,
IDE_TYPE_PROJECT_INFO);
}
static void
ide_project_miner_init (IdeProjectMiner *self)
{
}
static gboolean
emit_discovered_cb (gpointer user_data)
{
......@@ -95,7 +90,7 @@ ide_project_miner_mine_async (IdeProjectMiner *self,
g_return_if_fail (IDE_IS_PROJECT_MINER (self));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
IDE_PROJECT_MINER_GET_CLASS (self)->mine_async (self, cancellable, callback, user_data);
IDE_PROJECT_MINER_GET_IFACE (self)->mine_async (self, cancellable, callback, user_data);
}
gboolean
......@@ -106,5 +101,5 @@ ide_project_miner_mine_finish (IdeProjectMiner *self,
g_return_val_if_fail (IDE_IS_PROJECT_MINER (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
return IDE_PROJECT_MINER_GET_CLASS (self)->mine_finish (self, result, error);
return IDE_PROJECT_MINER_GET_IFACE (self)->mine_finish (self, result, error);
}
......@@ -25,14 +25,13 @@
G_BEGIN_DECLS
#define IDE_TYPE_PROJECT_MINER (ide_project_miner_get_type())
#define IDE_PROJECT_MINER_EXTENSION_POINT "org.gnome.builder.extensions.project-miner"
#define IDE_TYPE_PROJECT_MINER (ide_project_miner_get_type())
G_DECLARE_DERIVABLE_TYPE (IdeProjectMiner, ide_project_miner, IDE, PROJECT_MINER, GObject)
G_DECLARE_INTERFACE (IdeProjectMiner, ide_project_miner, IDE, PROJECT_MINER, GObject)
struct _IdeProjectMinerClass
struct _IdeProjectMinerInterface
{
GObjectClass parent;
GTypeInterface parent_iface;
void (*discovered) (IdeProjectMiner *self,
IdeProjectInfo *project_info);
......
......@@ -18,6 +18,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libpeas/peas.h>
#include "ide-global.h"
#include "ide-project-miner.h"
......@@ -257,6 +258,22 @@ ide_recent_projects_get_item (GListModel *model,
return NULL;
}
static void
foreach_miner_func (PeasExtensionSet *set,
PeasPluginInfo *plugin_info,
PeasExtension *exten,
gpointer user_data)
{
IdeRecentProjects *self = user_data;
g_assert (PEAS_IS_EXTENSION_SET (set));
g_assert (plugin_info != NULL);
g_assert (IDE_IS_PROJECT_MINER (exten));
g_assert (IDE_IS_RECENT_PROJECTS (self));
ide_recent_projects_add_miner (self, IDE_PROJECT_MINER (exten));
}
static void
ide_recent_projects_finalize (GObject *object)
{
......@@ -290,8 +307,8 @@ ide_recent_projects_class_init (IdeRecentProjectsClass *klass)
static void
ide_recent_projects_init (IdeRecentProjects *self)
{
GIOExtensionPoint *extension_point;
GList *extensions;
PeasExtensionSet *set;
PeasEngine *engine;
self->projects = g_sequence_new (g_object_unref);
self->miners = g_ptr_array_new_with_free_func (g_object_unref);
......@@ -302,28 +319,10 @@ ide_recent_projects_init (IdeRecentProjects *self)
IDE_RECENT_PROJECTS_BOOKMARK_FILENAME,
NULL);
extension_point = g_io_extension_point_lookup (IDE_PROJECT_MINER_EXTENSION_POINT);
extensions = g_io_extension_point_get_extensions (extension_point);
for (; extensions; extensions = extensions->next)
{
IdeProjectMiner *miner;
GIOExtension *extension = extensions->data;
GType type_id;
type_id = g_io_extension_get_type (extension);
if (!g_type_is_a (type_id, IDE_TYPE_PROJECT_MINER))
{
g_warning ("%s is not an IdeProjectMiner", g_type_name (type_id));
continue;
}
miner = g_object_new (type_id, NULL);
ide_recent_projects_add_miner (self, miner);
g_object_unref (miner);
}
engine = peas_engine_get_default ();
set = peas_extension_set_new (engine, IDE_TYPE_PROJECT_MINER, NULL);
peas_extension_set_foreach (set, foreach_miner_func, self);
g_clear_object (&set);
}
/**
......
......@@ -24,9 +24,6 @@
#include "gconstructor.h"
#include "ide.h"
#include "ide-autotools-build-system.h"
#include "ide-autotools-project-miner.h"
#include "ide-directory-build-system.h"
#include "ide-directory-vcs.h"
#include "ide-editorconfig-file-settings.h"
#include "ide-file-settings.h"
......@@ -80,24 +77,12 @@ ide_init_ctor (void)
g_irepository_prepend_search_path (LIBDIR"/gnome-builder/girepository-1.0");
g_type_ensure (IDE_TYPE_CONTEXT);
g_type_ensure (IDE_TYPE_BUILD_SYSTEM);
g_type_ensure (IDE_TYPE_VCS);
g_io_extension_point_register (IDE_BUILD_SYSTEM_EXTENSION_POINT);
g_io_extension_point_register (IDE_FILE_SETTINGS_EXTENSION_POINT);
g_io_extension_point_register (IDE_PROJECT_MINER_EXTENSION_POINT);
g_io_extension_point_register (IDE_SCRIPT_EXTENSION_POINT);
g_io_extension_point_register (IDE_VCS_EXTENSION_POINT);
g_io_extension_point_implement (IDE_BUILD_SYSTEM_EXTENSION_POINT,
IDE_TYPE_AUTOTOOLS_BUILD_SYSTEM,
IDE_BUILD_SYSTEM_EXTENSION_POINT".autotools",
-100);
g_io_extension_point_implement (IDE_BUILD_SYSTEM_EXTENSION_POINT,
IDE_TYPE_DIRECTORY_BUILD_SYSTEM,
IDE_BUILD_SYSTEM_EXTENSION_POINT".directory",
-200);
g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT,
IDE_TYPE_MODELINES_FILE_SETTINGS,
IDE_FILE_SETTINGS_EXTENSION_POINT".modelines",
......@@ -111,11 +96,6 @@ ide_init_ctor (void)
IDE_FILE_SETTINGS_EXTENSION_POINT".gsettings",
-300);
g_io_extension_point_implement (IDE_PROJECT_MINER_EXTENSION_POINT,
IDE_TYPE_AUTOTOOLS_PROJECT_MINER,
IDE_PROJECT_MINER_EXTENSION_POINT".autotools",
0);
g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT,
IDE_TYPE_GJS_SCRIPT,
IDE_SCRIPT_EXTENSION_POINT".gjs",
......
......@@ -87,14 +87,13 @@ G_BEGIN_DECLS
#include "ide-target.h"
#include "ide-test-case.h"
#include "ide-test-suite.h"
#include "ide-thread-pool.h"
#include "ide-types.h"
#include "ide-unsaved-file.h"
#include "ide-unsaved-files.h"
#include "ide-vcs.h"
#include "ide-vcs-uri.h"
#include "autotools/ide-autotools-build-system.h"
#include "directory/ide-directory-build-system.h"
#include "directory/ide-directory-vcs.h"
#include "doap/ide-doap-person.h"
#include "doap/ide-doap.h"
......@@ -102,6 +101,7 @@ G_BEGIN_DECLS
#include "git/ide-git-vcs.h"
#include "local/ide-local-device.h"
#include "theatrics/ide-animation.h"
#include "util/ide-line-reader.h"
#undef IDE_INSIDE
......
SUBDIRS = \
autotools \
clang \
command-bar \
c-pack \
ctags \
devhelp \
device-manager \
fallback \
file-search \
gnome-code-assistance \
html-completion \
......
plugindir = $(libdir)/gnome-builder/plugins
plugin_LTLIBRARIES = libautotools-plugin.la
plugin_DATA = autotools.plugin
libautotools_plugin_la_SOURCES = \
autotools-plugin.c \
ide-autotools-builder.c \
ide-autotools-builder.h \
ide-autotools-build-system.c \
ide-autotools-build-system.h \
ide-autotools-build-task.c \
ide-autotools-build-task.h \
ide-autotools-project-miner.c \
ide-autotools-project-miner.h \
ide-makecache.c \
ide-makecache.h \
ide-makecache-target.c \
ide-makecache-target.h \
$(NULL)
libautotools_plugin_la_CFLAGS = \
$(BUILDER_CFLAGS) \
-I$(top_srcdir)/contrib/egg \
-I$(top_srcdir)/libide \
$(NULL)
libautotools_plugin_la_LDFLAGS = \
-avoid-version \
-module \
$(NULL)
-include $(top_srcdir)/git.mk
/* autotools-plugin.c
*
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
*
* 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/>.
*/
#include <libpeas/peas.h>
#include <ide.h>
#include "ide-autotools-build-system.h"
#include "ide-autotools-project-miner.h"
void
peas_register_types (PeasObjectModule *module)
{
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_PROJECT_MINER, IDE_TYPE_AUTOTOOLS_PROJECT_MINER);
}
[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
Hidden=true
......@@ -41,24 +41,27 @@
struct _IdeAutotoolsBuildSystem
{
IdeBuildSystem parent_instance;
IdeObject parent_instance;
EggTaskCache *task_cache;
gchar *tarball_name;
GFile *project_file;
EggTaskCache *task_cache;
gchar *tarball_name;
};
static void async_initable_iface_init (GAsyncInitableIface *iface);
static void build_system_iface_init (IdeBuildSystemInterface *iface);
G_DEFINE_TYPE_WITH_CODE (IdeAutotoolsBuildSystem,
ide_autotools_build_system,
IDE_TYPE_BUILD_SYSTEM,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
async_initable_iface_init))
IDE_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
G_IMPLEMENT_INTERFACE (IDE_TYPE_BUILD_SYSTEM, build_system_iface_init))
EGG_DEFINE_COUNTER (build_flags, "Autotools", "Flags Requests", "Requests count for build flags")
enum {
PROP_0,
PROP_PROJECT_FILE,
PROP_TARBALL_NAME,
LAST_PROP
};
......@@ -588,6 +591,12 @@ ide_autotools_build_system_constructed (GObject *object)
G_CONNECT_SWAPPED);
}
static gint
ide_autotools_build_system_get_priority (IdeBuildSystem *system)
{
return -100;
}
static void
ide_autotools_build_system_finalize (GObject *object)
{
......@@ -609,6 +618,10 @@ ide_autotools_build_system_get_property (GObject *object,
switch (prop_id)
{
case PROP_PROJECT_FILE:
g_value_set_object (value, self->project_file);
break;
case PROP_TARBALL_NAME:
g_value_set_string (value,
ide_autotools_build_system_get_tarball_name (self));
......@@ -619,19 +632,44 @@ ide_autotools_build_system_get_property (GObject *object,
}
}
static void
ide_autotools_build_system_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
IdeAutotoolsBuildSystem *self = IDE_AUTOTOOLS_BUILD_SYSTEM (object);
switch (prop_id)
{
case PROP_PROJECT_FILE:
g_clear_object (&self->project_file);
self->project_file = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
build_system_iface_init (IdeBuildSystemInterface *iface)
{
iface->get_priority = ide_autotools_build_system_get_priority;