[gnome-builder] plugins/waf: port to run commands
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/waf: port to run commands
- Date: Fri, 16 Sep 2022 00:06:07 +0000 (UTC)
commit 60dd82ff42260a858e75cc7a337b37ee10e846ef
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 15 17:05:59 2022 -0700
plugins/waf: port to run commands
src/plugins/waf/gbp-waf-build-target-provider.c | 13 ++++++-
src/plugins/waf/gbp-waf-pipeline-addin.c | 51 ++++++++++++-------------
2 files changed, 36 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/waf/gbp-waf-build-target-provider.c b/src/plugins/waf/gbp-waf-build-target-provider.c
index b5c826106..076e1ee06 100644
--- a/src/plugins/waf/gbp-waf-build-target-provider.c
+++ b/src/plugins/waf/gbp-waf-build-target-provider.c
@@ -96,6 +96,7 @@ gbp_waf_build_target_provider_get_targets_async (IdeBuildTargetProvider *provide
gpointer user_data)
{
GbpWafBuildTargetProvider *self = (GbpWafBuildTargetProvider *)provider;
+ g_autoptr(IdeRunContext) run_context = NULL;
g_autoptr(IdeSubprocessLauncher) launcher = NULL;
g_autoptr(IdeSubprocess) subprocess = NULL;
g_autoptr(IdeTask) task = NULL;
@@ -147,8 +148,16 @@ gbp_waf_build_target_provider_get_targets_async (IdeBuildTargetProvider *provide
else
python = "python3";
- launcher = ide_pipeline_create_launcher (pipeline, NULL);
- ide_subprocess_launcher_push_args (launcher, IDE_STRV_INIT (python, waf, "list", "--color=no"));
+ run_context = ide_run_context_new ();
+ ide_pipeline_prepare_run_context (pipeline, run_context);
+ ide_run_context_append_args (run_context, IDE_STRV_INIT (python, waf, "list", "--color=no"));
+
+ if (!(launcher = ide_run_context_end (run_context, &error)))
+ {
+ ide_task_return_error (task, g_steal_pointer (&error));
+ IDE_EXIT;
+ }
+
/* There appears to be some installations that will write to stderr instead of stdout */
ide_subprocess_launcher_set_flags (launcher,
(G_SUBPROCESS_FLAGS_STDOUT_PIPE |
diff --git a/src/plugins/waf/gbp-waf-pipeline-addin.c b/src/plugins/waf/gbp-waf-pipeline-addin.c
index c1028d120..6b1935387 100644
--- a/src/plugins/waf/gbp-waf-pipeline-addin.c
+++ b/src/plugins/waf/gbp-waf-pipeline-addin.c
@@ -56,10 +56,10 @@ static void
gbp_waf_pipeline_addin_load (IdePipelineAddin *addin,
IdePipeline *pipeline)
{
- g_autoptr(IdeSubprocessLauncher) config_launcher = NULL;
- g_autoptr(IdeSubprocessLauncher) build_launcher = NULL;
- g_autoptr(IdeSubprocessLauncher) clean_launcher = NULL;
- g_autoptr(IdeSubprocessLauncher) install_launcher = NULL;
+ g_autoptr(IdeRunCommand) config_command = NULL;
+ g_autoptr(IdeRunCommand) build_command = NULL;
+ g_autoptr(IdeRunCommand) clean_command = NULL;
+ g_autoptr(IdeRunCommand) install_command = NULL;
g_autoptr(IdePipelineStage) build_stage = NULL;
g_autoptr(IdePipelineStage) install_stage = NULL;
g_autoptr(IdePipelineStage) config_stage = NULL;
@@ -106,40 +106,39 @@ gbp_waf_pipeline_addin_load (IdePipelineAddin *addin,
else
waf_argv = g_strdupv ((char **)IDE_STRV_INIT (python, waf));
- config_launcher = ide_pipeline_create_launcher (pipeline, NULL);
- ide_subprocess_launcher_set_cwd (config_launcher, srcdir);
- ide_subprocess_launcher_push_args (config_launcher, (const char * const *)waf_argv);
- ide_subprocess_launcher_push_argv (config_launcher, "configure");
- ide_subprocess_launcher_push_argv_format (config_launcher, "--prefix=%s", prefix);
- ide_subprocess_launcher_push_argv_parsed (config_launcher, config_opts);
- config_stage = ide_pipeline_stage_launcher_new (context, config_launcher);
+ config_command = ide_run_command_new ();
+ ide_run_command_set_cwd (config_command, srcdir);
+ ide_run_command_append_args (config_command, (const char * const *)waf_argv);
+ ide_run_command_append_argv (config_command, "configure");
+ ide_run_command_append_formatted (config_command, "--prefix=%s", prefix);
+ ide_run_command_append_parsed (config_command, config_opts, NULL);
+ config_stage = ide_pipeline_stage_command_new (config_command, NULL);
ide_pipeline_stage_set_name (config_stage, _("Configuring project"));
id = ide_pipeline_attach (pipeline, IDE_PIPELINE_PHASE_CONFIGURE, 0, config_stage);
ide_pipeline_addin_track (addin, id);
- build_launcher = ide_pipeline_create_launcher (pipeline, NULL);
- ide_subprocess_launcher_set_cwd (build_launcher, srcdir);
- ide_subprocess_launcher_push_args (build_launcher, (const char * const *)waf_argv);
- ide_subprocess_launcher_push_argv (build_launcher, "build");
+ build_command = ide_run_command_new ();
+ ide_run_command_set_cwd (build_command, srcdir);
+ ide_run_command_append_args (build_command, (const char * const *)waf_argv);
+ ide_run_command_append_argv (build_command, "build");
- clean_launcher = ide_pipeline_create_launcher (pipeline, NULL);
- ide_subprocess_launcher_set_cwd (clean_launcher, srcdir);
- ide_subprocess_launcher_push_args (clean_launcher, (const char * const *)waf_argv);
- ide_subprocess_launcher_push_argv (clean_launcher, "clean");
+ clean_command = ide_run_command_new ();
+ ide_run_command_set_cwd (clean_command, srcdir);
+ ide_run_command_append_args (clean_command, (const char * const *)waf_argv);
+ ide_run_command_append_argv (clean_command, "clean");
- build_stage = ide_pipeline_stage_launcher_new (context, build_launcher);
+ build_stage = ide_pipeline_stage_command_new (build_command, clean_command);
ide_pipeline_stage_set_name (build_stage, _("Building project"));
- ide_pipeline_stage_launcher_set_clean_launcher (IDE_PIPELINE_STAGE_LAUNCHER (build_stage), clean_launcher);
g_signal_connect (build_stage, "query", G_CALLBACK (query_cb), NULL);
id = ide_pipeline_attach (pipeline, IDE_PIPELINE_PHASE_BUILD, 0, build_stage);
ide_pipeline_addin_track (addin, id);
- install_launcher = ide_pipeline_create_launcher (pipeline, NULL);
- ide_subprocess_launcher_set_cwd (install_launcher, srcdir);
- ide_subprocess_launcher_push_args (install_launcher, (const char * const *)waf_argv);
- ide_subprocess_launcher_push_argv (install_launcher, "install");
+ install_command = ide_run_command_new ();
+ ide_run_command_set_cwd (install_command, srcdir);
+ ide_run_command_append_args (install_command, (const char * const *)waf_argv);
+ ide_run_command_append_argv (install_command, "install");
- install_stage = ide_pipeline_stage_launcher_new (context, install_launcher);
+ install_stage = ide_pipeline_stage_command_new (install_command, NULL);
ide_pipeline_stage_set_name (install_stage, _("Installing project"));
id = ide_pipeline_attach (pipeline, IDE_PIPELINE_PHASE_INSTALL, 0, install_stage);
ide_pipeline_addin_track (addin, id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]