[gnome-builder] libide: add parallel.workers config for builders
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add parallel.workers config for builders
- Date: Mon, 23 Mar 2015 23:58:05 +0000 (UTC)
commit 19afa82a4765fd554d3917e33b0bee96f6f3cfcf
Author: Christian Hergert <christian hergert me>
Date: Wed Mar 4 21:49:12 2015 -0800
libide: add parallel.workers config for builders
Build system agnostic plumbing to set the number of workers. Implement
this as "-jN" for automake.
libide/autotools/ide-autotools-build-task.c | 12 +++++++++++-
tools/ide-build.c | 7 +++++++
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/libide/autotools/ide-autotools-build-task.c b/libide/autotools/ide-autotools-build-task.c
index d15accd..0d722a3 100644
--- a/libide/autotools/ide-autotools-build-task.c
+++ b/libide/autotools/ide-autotools-build-task.c
@@ -39,6 +39,7 @@ typedef struct
{
gchar *directory_path;
gchar *project_path;
+ gchar *parallel;
gchar *system_type;
gchar **configure_argv;
gchar **make_targets;
@@ -521,6 +522,7 @@ worker_state_new (IdeAutotoolsBuildTask *self)
GFile *project_dir;
GFile *project_file;
WorkerState *state;
+ gint val32;
g_return_val_if_fail (IDE_IS_AUTOTOOLS_BUILD_TASK (self), NULL);
@@ -543,6 +545,11 @@ worker_state_new (IdeAutotoolsBuildTask *self)
state->project_path = g_file_get_path (project_dir);
state->system_type = g_strdup (ide_device_get_system_type (priv->device));
+ if ((val32 = g_key_file_get_integer (priv->config, "parallel", "workers", NULL)))
+ state->parallel = g_strdup_printf ("-j%u", val32);
+ else
+ state->parallel = g_strdup ("-j1");
+
make_targets = g_ptr_array_new ();
if (priv->config && g_key_file_get_boolean (priv->config, "autotools", "rebuild", NULL))
@@ -577,6 +584,9 @@ worker_state_free (void *data)
g_free (state->directory_path);
g_free (state->project_path);
g_free (state->system_type);
+ g_free (state->parallel);
+ g_strfreev (state->configure_argv);
+ g_strfreev (state->make_targets);
g_slice_free (WorkerState, state);
}
@@ -899,7 +909,7 @@ step_make_all (GTask *task,
{
const gchar *target = targets [i];
- process = log_and_spawn (self, launcher, &error, "make", target, NULL);
+ process = log_and_spawn (self, launcher, &error, "make", target, state->parallel, NULL);
if (!process)
{
diff --git a/tools/ide-build.c b/tools/ide-build.c
index b9f4d99..b7caaa4 100644
--- a/tools/ide-build.c
+++ b/tools/ide-build.c
@@ -35,6 +35,7 @@ static guint64 gBuildStart;
static gboolean gRebuild;
static GList *gLogThreads;
static gboolean gBuildDone;
+static gint gParallel;
static void
quit (gint exit_code)
@@ -220,6 +221,9 @@ build_for_device (IdeContext *context,
if (gRebuild)
g_key_file_set_boolean (config, "autotools", "rebuild", TRUE);
+ if (gParallel)
+ g_key_file_set_integer (config, "parallel", "workers", gParallel);
+
build_system = ide_context_get_build_system (context);
builder = ide_build_system_get_builder (build_system, config, device, &error);
g_key_file_unref (config);
@@ -351,6 +355,9 @@ main (gint argc,
},
{ "rebuild", 'r', 0, G_OPTION_ARG_NONE, &gRebuild,
N_("Clean and rebuild the project.") },
+ { "parallel", 'j', 0, G_OPTION_ARG_INT, &gParallel,
+ N_("Increase parallelism in the build."),
+ N_("N") },
{ NULL }
};
g_autoptr(GOptionContext) context = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]