[gnome-builder/wip/libide-merge] allow build system to alter project file path
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge] allow build system to alter project file path
- Date: Fri, 20 Mar 2015 10:00:36 +0000 (UTC)
commit d1e4b90d34ce6032184d5820ef2db86cc095c983
Author: Christian Hergert <christian hergert me>
Date: Fri Mar 20 03:00:29 2015 -0700
allow build system to alter project file path
libide/autotools/ide-autotools-build-system.c | 3 +++
libide/autotools/ide-autotools-build-task.c | 3 ++-
libide/ide-build-system.c | 25 ++++++++++++++-----------
libide/ide-build-system.h | 1 +
libide/ide-context.c | 14 ++++++++------
libide/ide-internal.h | 2 ++
6 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/libide/autotools/ide-autotools-build-system.c b/libide/autotools/ide-autotools-build-system.c
index 2643120..1625eb3 100644
--- a/libide/autotools/ide-autotools-build-system.c
+++ b/libide/autotools/ide-autotools-build-system.c
@@ -25,6 +25,7 @@
#include "ide-device.h"
#include "ide-device-manager.h"
#include "ide-file.h"
+#include "ide-internal.h"
#include "ide-makecache.h"
typedef struct
@@ -651,6 +652,8 @@ discover_file_cb (GObject *object,
return;
}
+ _ide_build_system_set_project_file (IDE_BUILD_SYSTEM (self), file);
+
ide_autotools_build_system_parse_async (self,
file,
g_task_get_cancellable (task),
diff --git a/libide/autotools/ide-autotools-build-task.c b/libide/autotools/ide-autotools-build-task.c
index 0d722a3..21862ba 100644
--- a/libide/autotools/ide-autotools-build-task.c
+++ b/libide/autotools/ide-autotools-build-task.c
@@ -769,7 +769,8 @@ step_autogen (GTask *task,
g_task_return_new_error (task,
G_IO_ERROR,
G_IO_ERROR_FAILED,
- _("autogen.sh is missing from project directory."));
+ _("autogen.sh is missing from project directory (%s)."),
+ state->project_path);
return FALSE;
}
diff --git a/libide/ide-build-system.c b/libide/ide-build-system.c
index ef70def..4aae341 100644
--- a/libide/ide-build-system.c
+++ b/libide/ide-build-system.c
@@ -87,6 +87,14 @@ ide_build_system_get_build_flags_finish (IdeBuildSystem *self,
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)
{
@@ -97,22 +105,17 @@ ide_build_system_get_project_file (IdeBuildSystem *system)
return priv->project_file;
}
-static void
-ide_build_system_set_project_file (IdeBuildSystem *system,
- GFile *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 (project_file != priv->project_file)
- {
- g_clear_object (&priv->project_file);
- priv->project_file = g_object_ref (project_file);
- g_object_notify_by_pspec (G_OBJECT (system),
- gParamSpecs [PROP_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
@@ -156,7 +159,7 @@ ide_build_system_set_property (GObject *object,
switch (prop_id)
{
case PROP_PROJECT_FILE:
- ide_build_system_set_project_file (self, g_value_get_object (value));
+ _ide_build_system_set_project_file (self, g_value_get_object (value));
break;
default:
diff --git a/libide/ide-build-system.h b/libide/ide-build-system.h
index 6b9ee58..3c2e47c 100644
--- a/libide/ide-build-system.h
+++ b/libide/ide-build-system.h
@@ -48,6 +48,7 @@ struct _IdeBuildSystemClass
GError **error);
};
+GFile *ide_build_system_get_project_file (IdeBuildSystem *self);
void ide_build_system_get_build_flags_async (IdeBuildSystem *self,
IdeFile *file,
GCancellable *cancellable,
diff --git a/libide/ide-context.c b/libide/ide-context.c
index f7f9692..38d4a95 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -338,12 +338,8 @@ ide_context_set_project_file (IdeContext *self,
{
g_return_if_fail (IDE_IS_CONTEXT (self));
- if (project_file != self->project_file)
- {
- if (g_set_object (&self->project_file, project_file))
- g_object_notify_by_pspec (G_OBJECT (self),
- gParamSpecs [PROP_PROJECT_FILE]);
- }
+ if (g_set_object (&self->project_file, project_file))
+ g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_PROJECT_FILE]);
}
/**
@@ -883,6 +879,7 @@ ide_context_init_build_system_cb (GObject *object,
g_autoptr(GTask) task = user_data;
IdeContext *self;
GError *error = NULL;
+ GFile *project_file;
self = g_task_get_source_object (task);
@@ -894,6 +891,11 @@ 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);
+ if (project_file != NULL)
+ ide_context_set_project_file (self, project_file);
+
g_task_return_boolean (task, TRUE);
}
diff --git a/libide/ide-internal.h b/libide/ide-internal.h
index 2c36419..404201e 100644
--- a/libide/ide-internal.h
+++ b/libide/ide-internal.h
@@ -53,6 +53,8 @@ IdeBackForwardItem *_ide_back_forward_list_find (IdeBackForwardList *s
gboolean _ide_buffer_get_loading (IdeBuffer *self);
void _ide_buffer_set_loading (IdeBuffer *self,
gboolean loading);
+void _ide_build_system_set_project_file (IdeBuildSystem *self,
+ GFile *project_file);
void _ide_diagnostic_add_range (IdeDiagnostic *self,
IdeSourceRange *range);
IdeDiagnostic *_ide_diagnostic_new (IdeDiagnosticSeverity severity,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]