[gnome-builder] flatpak: pass finish-args to flatpak runner



commit 025df36ee074308757680edb514b5669cd2b76c7
Author: Matthew Leeds <mleeds redhat com>
Date:   Fri Mar 3 19:44:40 2017 -0600

    flatpak: pass finish-args to flatpak runner
    
    The finish-args key in flatpak manifests specifies options such as
    --share=network that control the access applications have to the system
    at runtime. This commit passes those on to the subprocess launcher used
    for flatpak apps.

 plugins/flatpak/gbp-flatpak-runner.c |   35 +++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runner.c b/plugins/flatpak/gbp-flatpak-runner.c
index 0c3748a..2f3d52d 100644
--- a/plugins/flatpak/gbp-flatpak-runner.c
+++ b/plugins/flatpak/gbp-flatpak-runner.c
@@ -24,6 +24,7 @@
 #include <unistd.h>
 
 #include "gbp-flatpak-runner.h"
+#include "gbp-flatpak-configuration.h"
 
 struct _GbpFlatpakRunner
 {
@@ -46,17 +47,37 @@ gbp_flatpak_runner_fixup_launcher (IdeRunner             *runner,
                                    IdeSubprocessLauncher *launcher)
 {
   GbpFlatpakRunner *self = (GbpFlatpakRunner *)runner;
+  IdeContext *context;
+  IdeConfigurationManager *config_manager;
+  IdeConfiguration *configuration;
+  guint i = 0;
 
   g_assert (GBP_IS_FLATPAK_RUNNER (runner));
   g_assert (IDE_IS_SUBPROCESS_LAUNCHER (launcher));
 
-  ide_subprocess_launcher_insert_argv (launcher, 0, "flatpak");
-  ide_subprocess_launcher_insert_argv (launcher, 1, "build");
-  ide_subprocess_launcher_insert_argv (launcher, 2, "--allow=devel");
-  ide_subprocess_launcher_insert_argv (launcher, 3, "--share=ipc");
-  ide_subprocess_launcher_insert_argv (launcher, 4, "--socket=x11");
-  ide_subprocess_launcher_insert_argv (launcher, 5, "--socket=wayland");
-  ide_subprocess_launcher_insert_argv (launcher, 6, self->build_path);
+  context = ide_object_get_context (IDE_OBJECT (self));
+  config_manager = ide_context_get_configuration_manager (context);
+  configuration = ide_configuration_manager_get_current (config_manager);
+
+  ide_subprocess_launcher_insert_argv (launcher, i++, "flatpak");
+  ide_subprocess_launcher_insert_argv (launcher, i++, "build");
+  ide_subprocess_launcher_insert_argv (launcher, i++, "--allow=devel");
+
+  if (GBP_IS_FLATPAK_CONFIGURATION (configuration))
+    {
+      const gchar * const *finish_args = NULL;
+      finish_args = gbp_flatpak_configuration_get_finish_args (GBP_FLATPAK_CONFIGURATION (configuration));
+      for (guint j = 0; finish_args[j]; j++)
+        ide_subprocess_launcher_insert_argv (launcher, i++, finish_args[j]);
+    }
+  else
+    {
+      ide_subprocess_launcher_insert_argv (launcher, i++, "--share=ipc");
+      ide_subprocess_launcher_insert_argv (launcher, i++, "--socket=x11");
+      ide_subprocess_launcher_insert_argv (launcher, i++, "--socket=wayland");
+    }
+
+  ide_subprocess_launcher_insert_argv (launcher, i++, self->build_path);
 }
 
 GbpFlatpakRunner *


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