[gnome-builder] subprocess-launcher: rename spawn_sync() to spawn()



commit 0d4516a049bd977cff9dcbaff7cd6409786a34f8
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 28 20:38:48 2016 -0700

    subprocess-launcher: rename spawn_sync() to spawn()
    
    Now that we only have synchronous spawning, this can be renamed to
    something simpler.

 doc/reference/libide/libide-sections.txt       |    2 +-
 libide/buildsystem/ide-build-command.c         |    4 ++--
 libide/runner/ide-runner.c                     |    2 +-
 libide/subprocess/ide-subprocess-launcher.c    |   12 ++++++------
 libide/subprocess/ide-subprocess-launcher.h    |    4 ++--
 libide/subprocess/ide-subprocess-supervisor.c  |    2 +-
 libidemm/src/libide_docs.xml                   |    2 +-
 libidemm/src/libide_methods.defs               |    4 ++--
 plugins/autotools/ide-autotools-build-system.c |    2 +-
 plugins/autotools/ide-autotools-build-task.c   |   11 +++++++----
 plugins/autotools/ide-makecache.c              |    2 +-
 plugins/cargo/cargo_plugin.py                  |    2 +-
 plugins/flatpak/gbp-flatpak-runtime.c          |    4 ++--
 plugins/jhbuild/jhbuild_plugin.py              |    4 ++--
 plugins/rust-langserv/rust_langserv_plugin.py  |    2 +-
 plugins/terminal/gb-terminal-view.c            |    4 ++--
 16 files changed, 33 insertions(+), 30 deletions(-)
---
diff --git a/doc/reference/libide/libide-sections.txt b/doc/reference/libide/libide-sections.txt
index b01985e..2782611 100644
--- a/doc/reference/libide/libide-sections.txt
+++ b/doc/reference/libide/libide-sections.txt
@@ -1934,7 +1934,7 @@ ide_subprocess_launcher_setenv
 ide_subprocess_launcher_overlay_environment
 ide_subprocess_launcher_push_args
 ide_subprocess_launcher_push_argv
-ide_subprocess_launcher_spawn_sync
+ide_subprocess_launcher_spawn
 IdeSubprocessLauncher
 </SECTION>
 
diff --git a/libide/buildsystem/ide-build-command.c b/libide/buildsystem/ide-build-command.c
index 72990b5..3439358 100644
--- a/libide/buildsystem/ide-build-command.c
+++ b/libide/buildsystem/ide-build-command.c
@@ -138,7 +138,7 @@ ide_build_command_real_run (IdeBuildCommand  *self,
   if (launcher == NULL)
     IDE_RETURN (FALSE);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, error);
   if (subprocess == NULL)
     return FALSE;
 
@@ -188,7 +188,7 @@ ide_build_command_real_run_async (IdeBuildCommand     *self,
       IDE_EXIT;
     }
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, &error);
 
   if (subprocess == NULL)
     {
diff --git a/libide/runner/ide-runner.c b/libide/runner/ide-runner.c
index 2f427cb..bcc0990 100644
--- a/libide/runner/ide-runner.c
+++ b/libide/runner/ide-runner.c
@@ -221,7 +221,7 @@ ide_runner_real_run_async (IdeRunner           *self,
    */
   ide_subprocess_launcher_set_cwd (launcher, g_get_home_dir ());
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, &error);
 
   g_assert (subprocess == NULL || IDE_IS_SUBPROCESS (subprocess));
 
diff --git a/libide/subprocess/ide-subprocess-launcher.c b/libide/subprocess/ide-subprocess-launcher.c
index cb60d75..ea5a64c 100644
--- a/libide/subprocess/ide-subprocess-launcher.c
+++ b/libide/subprocess/ide-subprocess-launcher.c
@@ -303,7 +303,7 @@ ide_subprocess_launcher_spawn_worker (GTask        *task,
 }
 
 static IdeSubprocess *
-ide_subprocess_launcher_real_spawn_sync (IdeSubprocessLauncher  *self,
+ide_subprocess_launcher_real_spawn (IdeSubprocessLauncher  *self,
                                          GCancellable           *cancellable,
                                          GError                **error)
 {
@@ -313,7 +313,7 @@ ide_subprocess_launcher_real_spawn_sync (IdeSubprocessLauncher  *self,
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = g_task_new (self, cancellable, NULL, NULL);
-  g_task_set_source_tag (task, ide_subprocess_launcher_real_spawn_sync);
+  g_task_set_source_tag (task, ide_subprocess_launcher_real_spawn);
 
   if (should_use_breakout_process (self))
     g_task_run_in_thread_sync (task, ide_subprocess_launcher_spawn_host_worker);
@@ -424,7 +424,7 @@ ide_subprocess_launcher_class_init (IdeSubprocessLauncherClass *klass)
   object_class->get_property = ide_subprocess_launcher_get_property;
   object_class->set_property = ide_subprocess_launcher_set_property;
 
-  klass->spawn_sync = ide_subprocess_launcher_real_spawn_sync;
+  klass->spawn = ide_subprocess_launcher_real_spawn;
 
   properties [PROP_CLEAR_ENV] =
     g_param_spec_boolean ("clean-env",
@@ -597,21 +597,21 @@ ide_subprocess_launcher_push_argv (IdeSubprocessLauncher *self,
 }
 
 /**
- * ide_subprocess_launcher_spawn_sync:
+ * ide_subprocess_launcher_spawn:
  *
  * Synchronously spawn a process using the internal state.
  *
  * Returns: (transfer full): A #IdeSubprocess or %NULL upon error.
  */
 IdeSubprocess *
-ide_subprocess_launcher_spawn_sync (IdeSubprocessLauncher  *self,
+ide_subprocess_launcher_spawn (IdeSubprocessLauncher  *self,
                                     GCancellable           *cancellable,
                                     GError                **error)
 {
   g_return_val_if_fail (IDE_IS_SUBPROCESS_LAUNCHER (self), NULL);
   g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), NULL);
 
-  return IDE_SUBPROCESS_LAUNCHER_GET_CLASS (self)->spawn_sync (self, cancellable, error);
+  return IDE_SUBPROCESS_LAUNCHER_GET_CLASS (self)->spawn (self, cancellable, error);
 }
 
 void
diff --git a/libide/subprocess/ide-subprocess-launcher.h b/libide/subprocess/ide-subprocess-launcher.h
index 02799cd..c3a2ad9 100644
--- a/libide/subprocess/ide-subprocess-launcher.h
+++ b/libide/subprocess/ide-subprocess-launcher.h
@@ -33,7 +33,7 @@ struct _IdeSubprocessLauncherClass
 {
   GObjectClass parent_class;
 
-  IdeSubprocess *(*spawn_sync)   (IdeSubprocessLauncher  *self,
+  IdeSubprocess *(*spawn)   (IdeSubprocessLauncher  *self,
                                   GCancellable           *cancellable,
                                   GError                **error);
 
@@ -74,7 +74,7 @@ void                   ide_subprocess_launcher_push_args           (IdeSubproces
 void                   ide_subprocess_launcher_push_argv           (IdeSubprocessLauncher  *self,
                                                                     const gchar            *argv);
 gchar                 *ide_subprocess_launcher_pop_argv            (IdeSubprocessLauncher  *self) 
G_GNUC_WARN_UNUSED_RESULT;
-IdeSubprocess         *ide_subprocess_launcher_spawn_sync          (IdeSubprocessLauncher  *self,
+IdeSubprocess         *ide_subprocess_launcher_spawn          (IdeSubprocessLauncher  *self,
                                                                     GCancellable           *cancellable,
                                                                     GError                **error);
 void                   ide_subprocess_launcher_take_stdin_fd       (IdeSubprocessLauncher  *self,
diff --git a/libide/subprocess/ide-subprocess-supervisor.c b/libide/subprocess/ide-subprocess-supervisor.c
index 2b218a3..d3ec5cd 100644
--- a/libide/subprocess/ide-subprocess-supervisor.c
+++ b/libide/subprocess/ide-subprocess-supervisor.c
@@ -84,7 +84,7 @@ ide_subprocess_supervisor_real_supervise (IdeSubprocessSupervisor *self,
 
   ide_subprocess_supervisor_reset (self);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, NULL, &error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error);
 
   if (subprocess != NULL)
     ide_subprocess_supervisor_set_subprocess (self, subprocess);
diff --git a/libidemm/src/libide_docs.xml b/libidemm/src/libide_docs.xml
index f54b335..ea15f04 100644
--- a/libidemm/src/libide_docs.xml
+++ b/libidemm/src/libide_docs.xml
@@ -5217,7 +5217,7 @@ Complete a request to asynchronously spawn a process.
 </return>
 </function>
 
-<function name="ide_subprocess_launcher_spawn_sync">
+<function name="ide_subprocess_launcher_spawn">
 <description>
 Synchronously spawn a process using the internal state.
 
diff --git a/libidemm/src/libide_methods.defs b/libidemm/src/libide_methods.defs
index 4b93a2f..7aacbc6 100644
--- a/libidemm/src/libide_methods.defs
+++ b/libidemm/src/libide_methods.defs
@@ -5962,9 +5962,9 @@
   )
 )
 
-(define-method spawn_sync
+(define-method spawn
   (of-object "IdeSubprocessLauncher")
-  (c-name "ide_subprocess_launcher_spawn_sync")
+  (c-name "ide_subprocess_launcher_spawn")
   (return-type "GSubprocess*")
   (parameters
     '("GCancellable*" "cancellable")
diff --git a/plugins/autotools/ide-autotools-build-system.c b/plugins/autotools/ide-autotools-build-system.c
index c8f82e5..f354cca 100644
--- a/plugins/autotools/ide-autotools-build-system.c
+++ b/plugins/autotools/ide-autotools-build-system.c
@@ -1001,7 +1001,7 @@ simple_make_command (GFile            *directory,
   if (g_task_return_error_if_cancelled (task))
     return;
 
-  if (NULL == (subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &error)))
+  if (NULL == (subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, &error)))
     {
       g_task_return_error (task, error);
       return;
diff --git a/plugins/autotools/ide-autotools-build-task.c b/plugins/autotools/ide-autotools-build-task.c
index 6bfe51c..7f83d00 100644
--- a/plugins/autotools/ide-autotools-build-task.c
+++ b/plugins/autotools/ide-autotools-build-task.c
@@ -931,7 +931,7 @@ log_and_spawn (IdeAutotoolsBuildTask  *self,
   pair->message = g_string_free (log, FALSE);
   g_timeout_add (0, log_in_main, pair);
 
-  ret = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &local_error);
+  ret = ide_subprocess_launcher_spawn (launcher, cancellable, &local_error);
 
   if (ret == NULL)
     {
@@ -1040,9 +1040,10 @@ step_autogen (GTask                 *task,
     }
 
   ide_subprocess_launcher_set_cwd (launcher, state->project_path);
+
+  apply_environment (self, launcher);
   ide_subprocess_launcher_setenv (launcher, "LANG", "C", TRUE);
   ide_subprocess_launcher_setenv (launcher, "NOCONFIGURE", "1", TRUE);
-  apply_environment (self, launcher);
 
   process = log_and_spawn (self, launcher, cancellable, &error, autogen_sh_path, NULL);
 
@@ -1116,7 +1117,7 @@ step_configure (GTask                 *task,
   ide_build_result_log_stdout (IDE_BUILD_RESULT (self), "%s", config_log);
   ide_subprocess_launcher_push_args (launcher, (const gchar * const *)state->configure_argv);
 
-  if (NULL == (process = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &error)))
+  if (NULL == (process = ide_subprocess_launcher_spawn (launcher, cancellable, &error)))
     {
       g_task_return_error (task, error);
       return FALSE;
@@ -1167,9 +1168,11 @@ step_make_all  (GTask                 *task,
   ide_subprocess_launcher_set_flags (launcher,
                                      (G_SUBPROCESS_FLAGS_STDERR_PIPE |
                                       G_SUBPROCESS_FLAGS_STDOUT_PIPE));
+
   ide_subprocess_launcher_set_cwd (launcher, state->directory_path);
-  ide_subprocess_launcher_setenv (launcher, "LANG", "C", TRUE);
+
   apply_environment (self, launcher);
+  ide_subprocess_launcher_setenv (launcher, "LANG", "C", TRUE);
 
   /*
    * Try to locate GNU make within the runtime.
diff --git a/plugins/autotools/ide-makecache.c b/plugins/autotools/ide-makecache.c
index fd509c7..3473ea2 100644
--- a/plugins/autotools/ide-makecache.c
+++ b/plugins/autotools/ide-makecache.c
@@ -1984,7 +1984,7 @@ ide_makecache_get_build_targets_worker (GTask        *task,
        * Spawn make, waiting for our stdin input which will add our debug
        * printf target.
        */
-      if (NULL == (subprocess = ide_subprocess_launcher_spawn_sync (launcher, NULL, &error)))
+      if (NULL == (subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error)))
         {
           g_task_return_error (task, error);
           IDE_GOTO (failure);
diff --git a/plugins/cargo/cargo_plugin.py b/plugins/cargo/cargo_plugin.py
index 20c064c..b94ce28 100644
--- a/plugins/cargo/cargo_plugin.py
+++ b/plugins/cargo/cargo_plugin.py
@@ -181,7 +181,7 @@ class CargoBuildResult(Ide.BuildResult):
         for arg in args:
             launcher.push_argv(arg)
 
-        subprocess = launcher.spawn_sync()
+        subprocess = launcher.spawn()
 
         self.log_subprocess(subprocess)
 
diff --git a/plugins/flatpak/gbp-flatpak-runtime.c b/plugins/flatpak/gbp-flatpak-runtime.c
index 4213ec5..9597a25 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/plugins/flatpak/gbp-flatpak-runtime.c
@@ -76,7 +76,7 @@ gbp_flatpak_runtime_contains_program_in_path (IdeRuntime   *runtime,
   ide_subprocess_launcher_push_argv (launcher, "which");
   ide_subprocess_launcher_push_argv (launcher, program);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, NULL);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, NULL);
 
   return (subprocess != NULL) && ide_subprocess_wait_check (subprocess, cancellable, NULL);
 }
@@ -141,7 +141,7 @@ gbp_flatpak_runtime_prebuild_worker (GTask        *task,
   ide_subprocess_launcher_push_argv (launcher, self->platform);
   ide_subprocess_launcher_push_argv (launcher, self->branch);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, &error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, &error);
 
   if (subprocess == NULL)
     {
diff --git a/plugins/jhbuild/jhbuild_plugin.py b/plugins/jhbuild/jhbuild_plugin.py
index 53376a9..f5920a1 100644
--- a/plugins/jhbuild/jhbuild_plugin.py
+++ b/plugins/jhbuild/jhbuild_plugin.py
@@ -70,7 +70,7 @@ class JhbuildRuntime(Ide.Runtime):
         prefix = None
         try:
             # FIXME: Async
-            subprocess = launcher.spawn_sync (None)
+            subprocess = launcher.spawn (None)
             success, output, err_output = subprocess.communicate_utf8 (None, None)
             if success:
                 prefix = output.strip()
@@ -88,7 +88,7 @@ class JhbuildRuntime(Ide.Runtime):
         launcher.push_argv(program)
 
         try:
-            subprocess = launcher.spawn_sync (cancellable)
+            subprocess = launcher.spawn (cancellable)
             return subprocess.wait_check (cancellable)
         except GLib.Error:
             return False
diff --git a/plugins/rust-langserv/rust_langserv_plugin.py b/plugins/rust-langserv/rust_langserv_plugin.py
index 5515341..3086d79 100644
--- a/plugins/rust-langserv/rust_langserv_plugin.py
+++ b/plugins/rust-langserv/rust_langserv_plugin.py
@@ -124,7 +124,7 @@ class RustService(Ide.Object, Ide.Service):
         """
         launcher = self._create_launcher()
         launcher.push_args(['rustc', '--print', 'sysroot'])
-        subprocess = launcher.spawn_sync()
+        subprocess = launcher.spawn()
         _, stdout, _ = subprocess.communicate_utf8()
         return stdout.strip()
 
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index eeaf6bf..0521a1c 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -100,7 +100,7 @@ gb_terminal_view_discover_shell (GCancellable  *cancellable,
   ide_subprocess_launcher_set_cwd (launcher, g_get_home_dir ());
   ide_subprocess_launcher_push_args (launcher, (const gchar * const *)argv);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, error);
 
   if (subprocess == NULL)
     return NULL;
@@ -272,7 +272,7 @@ gb_terminal_respawn (GbTerminalView *self,
   ide_subprocess_launcher_setenv (launcher, "INSIDE_GNOME_BUILDER", PACKAGE_VERSION, TRUE);
   ide_subprocess_launcher_setenv (launcher, "SHELL", shell, TRUE);
 
-  subprocess = ide_subprocess_launcher_spawn_sync (launcher, NULL, &error);
+  subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error);
   if (subprocess == NULL)
     IDE_GOTO (failure);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]