[gnome-builder] flatpak: use flatpak-builder --run when possible



commit c9b4edc47ac64bf58094609dcaedb62595350e9a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 29 17:35:42 2017 -0600

    flatpak: use flatpak-builder --run when possible
    
    If we are running the app, we should try to rely on flatpak-builder --run
    so that we aren't dealing with the special cases here as new ones crop up.
    
    It appears that --run is available as far back as 0.6, so this should be
    safe to rely on.

 plugins/flatpak/gbp-flatpak-runner.c |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runner.c b/plugins/flatpak/gbp-flatpak-runner.c
index 6476202..5422760 100644
--- a/plugins/flatpak/gbp-flatpak-runner.c
+++ b/plugins/flatpak/gbp-flatpak-runner.c
@@ -25,6 +25,7 @@
 
 #include "gbp-flatpak-runner.h"
 #include "gbp-flatpak-configuration.h"
+#include "gbp-flatpak-util.h"
 
 struct _GbpFlatpakRunner
 {
@@ -47,9 +48,9 @@ gbp_flatpak_runner_fixup_launcher (IdeRunner             *runner,
                                    IdeSubprocessLauncher *launcher)
 {
   GbpFlatpakRunner *self = (GbpFlatpakRunner *)runner;
-  IdeContext *context;
   IdeConfigurationManager *config_manager;
   IdeConfiguration *configuration;
+  IdeContext *context;
   guint i = 0;
 
   g_assert (GBP_IS_FLATPAK_RUNNER (runner));
@@ -59,36 +60,27 @@ gbp_flatpak_runner_fixup_launcher (IdeRunner             *runner,
   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 = gbp_flatpak_configuration_get_finish_args 
(GBP_FLATPAK_CONFIGURATION (configuration));
-
-      for (guint j = 0; finish_args[j]; j++)
-        {
-          const gchar *arg = finish_args[j];
-
-          /* "flatpak build" does not support all build-finish args */
-          if (!g_str_has_prefix (arg, "--require-version") &&
-              !g_str_has_prefix (arg, "--extension") &&
-              !g_str_has_prefix (arg, "--runtime") &&
-              !g_str_has_prefix (arg, "--sdk") &&
-              !g_str_has_prefix (arg, "--command"))
-            ide_subprocess_launcher_insert_argv (launcher, i++, arg);
-        }
+      const gchar *manifest_path = gbp_flatpak_configuration_get_manifest_path (GBP_FLATPAK_CONFIGURATION 
(configuration));
+
+      ide_subprocess_launcher_insert_argv (launcher, i++, "flatpak-builder");
+      ide_subprocess_launcher_insert_argv (launcher, i++, "--run");
+      ide_subprocess_launcher_insert_argv (launcher, i++, "--allow=devel");
+      ide_subprocess_launcher_insert_argv (launcher, i++, self->build_path);
+      ide_subprocess_launcher_insert_argv (launcher, i++, manifest_path);
     }
   else
     {
+      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");
       ide_subprocess_launcher_insert_argv (launcher, i++, "--share=ipc");
       ide_subprocess_launcher_insert_argv (launcher, i++, "--share=network");
       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);
     }
-
-  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]