[gnome-builder] cargo: pass config-opts to `cargo rustc`



commit 57083a47ff7ea4915ec8cc7b953dd329d6bdda31
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 24 11:08:44 2019 -0700

    cargo: pass config-opts to `cargo rustc`
    
    There is no configure stage for cargo, so this re-uses those configure
    options for running the cargo rustc (compile) stage.

 src/plugins/cargo/cargo_plugin.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/plugins/cargo/cargo_plugin.py b/src/plugins/cargo/cargo_plugin.py
index 342d43a04..d0c029373 100644
--- a/src/plugins/cargo/cargo_plugin.py
+++ b/src/plugins/cargo/cargo_plugin.py
@@ -108,6 +108,7 @@ class CargoPipelineAddin(Ide.Object, Ide.PipelineAddin):
         config = pipeline.get_config()
         builddir = pipeline.get_builddir()
         runtime = config.get_runtime()
+        config_opts = config.get_config_opts()
 
         # We might need to use cargo from ~/.cargo/bin
         cargo = locate_cargo_from_config(config)
@@ -141,6 +142,15 @@ class CargoPipelineAddin(Ide.Object, Ide.PipelineAddin):
         if not config.props.debug:
             build_launcher.push_argv('--release')
 
+        # Configure Options get passed to "cargo rustc" because where is no
+        # equivalent "configure stage" for cargo.
+        if config_opts:
+            try:
+                ret, argv = GLib.shell_parse_argv(config_opts)
+                build_launcher.push_args(argv)
+            except Exception as ex:
+                print(repr(ex))
+
         clean_launcher = pipeline.create_launcher()
         clean_launcher.setenv('CARGO_TARGET_DIR', builddir, True)
         clean_launcher.push_argv(cargo)


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