[gnome-builder] cargo: always register error format for rustc



commit 2ce915f5f01b3a499f1b062ae257d99c02236941
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 7 14:22:27 2018 -0700

    cargo: always register error format for rustc

 src/plugins/cargo/cargo_plugin.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/cargo/cargo_plugin.py b/src/plugins/cargo/cargo_plugin.py
index 12dec3a45..67a3400b5 100644
--- a/src/plugins/cargo/cargo_plugin.py
+++ b/src/plugins/cargo/cargo_plugin.py
@@ -102,14 +102,16 @@ class CargoPipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
         context = self.get_context()
         build_system = context.get_build_system()
 
-        # Ignore pipeline unless this is a cargo project
-        if type(build_system) != CargoBuildSystem:
-            return
-
+        # Always register the error regex
         self.error_format_id = pipeline.add_error_format(_ERROR_FORMAT_REGEX,
                                                          GLib.RegexCompileFlags.OPTIMIZE |
                                                          GLib.RegexCompileFlags.CASELESS);
 
+
+        # Ignore pipeline unless this is a cargo project
+        if type(build_system) != CargoBuildSystem:
+            return
+
         cargo_toml = build_system.props.project_file.get_path()
         config = pipeline.get_configuration()
         builddir = pipeline.get_builddir()
@@ -166,6 +168,10 @@ class CargoPipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
         build_stage.connect('query', self._query)
         self.track(pipeline.connect(Ide.BuildPhase.BUILD, 0, build_stage))
 
+    def do_unload(self, pipeline):
+        if self.error_format_id:
+            pipeline.remove_error_format(self.error_format_id)
+
     def _query(self, stage, pipeline, cancellable):
         # Always defer to cargo to check if build is needed
         stage.set_completed(False)


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