[gnome-builder] terminal: add $BUILDDIR and $SRCDIR environment variables



commit 676d894fca728caebc95e9a722c209ded47d15f5
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jul 22 01:12:31 2017 -0700

    terminal: add $BUILDDIR and $SRCDIR environment variables
    
    These can be useful to jump around or figure out where the build
    is occuring. It is tied to the value when the shell is launched,
    but I think that is mostly okay. We can just inform users in
    documentation that it is based on the pipeline at launch.

 plugins/terminal/gb-terminal-view.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index 4edbcd1..9c213eb 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -197,6 +197,8 @@ gb_terminal_respawn (GbTerminalView *self,
   g_autofree gchar *shell = NULL;
   GtkWidget *toplevel;
   GError *error = NULL;
+  IdeBuildManager *build_manager;
+  IdeBuildPipeline *pipeline;
   IdeContext *context;
   IdeVcs *vcs;
   VtePty *pty = NULL;
@@ -227,6 +229,9 @@ gb_terminal_respawn (GbTerminalView *self,
   workdir = ide_vcs_get_working_directory (vcs);
   workpath = g_file_get_path (workdir);
 
+  build_manager = ide_context_get_build_manager (context);
+  pipeline = ide_build_manager_get_pipeline (build_manager);
+
   shell = gb_terminal_view_discover_shell (self, NULL, &error);
 
   if (shell == NULL)
@@ -284,6 +289,12 @@ gb_terminal_respawn (GbTerminalView *self,
   ide_subprocess_launcher_setenv (launcher, "INSIDE_GNOME_BUILDER", PACKAGE_VERSION, TRUE);
   ide_subprocess_launcher_setenv (launcher, "SHELL", shell, TRUE);
 
+  if (pipeline != NULL)
+    {
+      ide_subprocess_launcher_setenv (launcher, "BUILDDIR", ide_build_pipeline_get_builddir (pipeline), 
TRUE);
+      ide_subprocess_launcher_setenv (launcher, "SRCDIR", ide_build_pipeline_get_srcdir (pipeline), TRUE);
+    }
+
   tty_fd = -1;
   stdout_fd = -1;
   stderr_fd = -1;


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