[gnome-builder] builder: add clean flag
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] builder: add clean flag
- Date: Mon, 21 Dec 2015 08:07:15 +0000 (UTC)
commit 6004efc3ed5cb0b2e187c1ab908ccdb1dd20760d
Author: Christian Hergert <chergert redhat com>
Date: Thu Dec 17 03:56:16 2015 -0800
builder: add clean flag
This really belongs as a separate async vfunc pair, but this is minimal
so we can make some quick progress. We'll revisit it soon.
libide/ide-builder.h | 5 ++++-
plugins/autotools/ide-autotools-build-task.c | 15 ++++++++++++++-
plugins/autotools/ide-autotools-builder.c | 15 +++++++++++++++
3 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-builder.h b/libide/ide-builder.h
index bc124c7..0232c6f 100644
--- a/libide/ide-builder.h
+++ b/libide/ide-builder.h
@@ -30,7 +30,10 @@ G_DECLARE_DERIVABLE_TYPE (IdeBuilder, ide_builder, IDE, BUILDER, IdeObject)
typedef enum
{
IDE_BUILDER_BUILD_FLAGS_NONE = 0,
- IDE_BUILDER_BUILD_FLAGS_FORCE_REBUILD = 1 << 0
+ IDE_BUILDER_BUILD_FLAGS_FORCE_REBUILD = 1 << 0,
+
+ /* TODO: this belongs as a vfunc instead */
+ IDE_BUILDER_BUILD_FLAGS_CLEAN = 1 << 1,
} IdeBuilderBuildFlags;
struct _IdeBuilderClass
diff --git a/plugins/autotools/ide-autotools-build-task.c b/plugins/autotools/ide-autotools-build-task.c
index 30f47a3..136e98a 100644
--- a/plugins/autotools/ide-autotools-build-task.c
+++ b/plugins/autotools/ide-autotools-build-task.c
@@ -561,7 +561,11 @@ worker_state_new (IdeAutotoolsBuildTask *self)
g_ptr_array_add (make_targets, g_strdup ("clean"));
}
- g_ptr_array_add (make_targets, g_strdup ("all"));
+ if (priv->config && g_key_file_get_boolean (priv->config, "autotools", "clean-only", NULL))
+ g_ptr_array_add (make_targets, g_strdup ("clean"));
+ else
+ g_ptr_array_add (make_targets, g_strdup ("all"));
+
g_ptr_array_add (make_targets, NULL);
state->make_targets = (gchar **)g_ptr_array_free (make_targets, FALSE);
@@ -785,6 +789,8 @@ step_autogen (GTask *task,
return FALSE;
}
+ ide_build_result_set_mode (IDE_BUILD_RESULT (self), _("Autogening…"));
+
launcher = g_subprocess_launcher_new ((G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE));
g_subprocess_launcher_set_cwd (launcher, state->project_path);
@@ -846,6 +852,8 @@ step_configure (GTask *task,
return TRUE;
}
+ ide_build_result_set_mode (IDE_BUILD_RESULT (self), _("Configuring…"));
+
launcher = g_subprocess_launcher_new ((G_SUBPROCESS_FLAGS_STDERR_PIPE |
G_SUBPROCESS_FLAGS_STDOUT_PIPE));
g_subprocess_launcher_set_cwd (launcher, state->directory_path);
@@ -912,6 +920,11 @@ step_make_all (GTask *task,
{
const gchar *target = targets [i];
+ if (ide_str_equal0 (target, "clean"))
+ ide_build_result_set_mode (IDE_BUILD_RESULT (self), _("Cleaning…"));
+ else
+ ide_build_result_set_mode (IDE_BUILD_RESULT (self), _("Building…"));
+
process = log_and_spawn (self, launcher, &error, GNU_MAKE_NAME, target, state->parallel, NULL);
if (!process)
diff --git a/plugins/autotools/ide-autotools-builder.c b/plugins/autotools/ide-autotools-builder.c
index 549c747..64459f4 100644
--- a/plugins/autotools/ide-autotools-builder.c
+++ b/plugins/autotools/ide-autotools-builder.c
@@ -100,12 +100,21 @@ ide_autotools_builder_build_cb (GObject *object,
g_return_if_fail (IDE_IS_AUTOTOOLS_BUILD_TASK (build_result));
g_return_if_fail (G_IS_TASK (task));
+ ide_build_result_set_running (IDE_BUILD_RESULT (build_result), FALSE);
+
if (!ide_autotools_build_task_execute_finish (build_result, result, &error))
{
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ ide_build_result_set_mode (IDE_BUILD_RESULT (build_result), _("Cancelled"));
+ else
+ ide_build_result_set_mode (IDE_BUILD_RESULT (build_result), _("Failed"));
+
g_task_return_error (task, error);
return;
}
+ ide_build_result_set_mode (IDE_BUILD_RESULT (build_result), _("Finished"));
+
g_task_return_pointer (task, g_object_ref (build_result), g_object_unref);
}
@@ -193,6 +202,10 @@ ide_autotools_builder_build_async (IdeBuilder *builder,
if (flags & IDE_BUILDER_BUILD_FLAGS_FORCE_REBUILD)
g_key_file_set_boolean (self->config, "autotools", "rebuild", TRUE);
+ /* TODO: This belongs as its own vfunc */
+ if (flags & IDE_BUILDER_BUILD_FLAGS_CLEAN)
+ g_key_file_set_boolean (self->config, "autotools", "clean-only", TRUE);
+
task = g_task_new (self, cancellable, callback, user_data);
context = ide_object_get_context (IDE_OBJECT (builder));
@@ -204,6 +217,8 @@ ide_autotools_builder_build_async (IdeBuilder *builder,
"config", self->config,
"device", device,
"directory", directory,
+ "mode", _("Building…"),
+ "running", TRUE,
NULL);
if (result)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]