[gnome-builder] vala: add error regex for vala build errors



commit 895726f5cb3cd94477a842efe58d6f5c5219310b
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 1 13:52:46 2017 -0800

    vala: add error regex for vala build errors
    
    This is (what i hope) a someone reasonable regex for matching vala errors
    from the console output.
    
    It does expose another error, though, which is that we only get short names
    from the valac compiler (main.vala, etc), and we are not translating that
    to the proper source directly properly.
    
    That means that when opening the file, we are likely going to get the wrong
    path right now ($builddir/main.vala) instead of ($srcdir/main.vala).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775625

 plugins/vala-pack/Makefile.am                  |    2 +
 plugins/vala-pack/ide-vala-pipeline-addin.vala |   50 ++++++++++++++++++++++++
 plugins/vala-pack/vala-pack-plugin.vala        |    1 +
 3 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/plugins/vala-pack/Makefile.am b/plugins/vala-pack/Makefile.am
index e003738..b7aa46d 100644
--- a/plugins/vala-pack/Makefile.am
+++ b/plugins/vala-pack/Makefile.am
@@ -35,6 +35,7 @@ libvala_pack_plugin_la_VALASOURCES =                                          \
        ide-vala-indenter.vala                                                \
        ide-vala-index.vala                                                   \
        ide-vala-locator.vala                                                 \
+       ide-vala-pipeline-addin.vala                                          \
        ide-vala-preferences-addin.vala                                       \
        ide-vala-source-file.vala                                             \
        ide-vala-symbol-resolver.vala                                         \
@@ -54,6 +55,7 @@ nodist_libvala_pack_plugin_la_SOURCES =                                       \
        ide-vala-indenter.c                                                   \
        ide-vala-index.c                                                      \
        ide-vala-locator.c                                                    \
+       ide-vala-pipeline-addin.c                                             \
        ide-vala-preferences-addin.c                                          \
        ide-vala-source-file.c                                                \
        ide-vala-symbol-resolver.c                                            \
diff --git a/plugins/vala-pack/ide-vala-pipeline-addin.vala b/plugins/vala-pack/ide-vala-pipeline-addin.vala
new file mode 100644
index 0000000..6fdce3a
--- /dev/null
+++ b/plugins/vala-pack/ide-vala-pipeline-addin.vala
@@ -0,0 +1,50 @@
+/* ide-vala-pipeline-addin.vala
+ *
+ * Copyright (C) 2017 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using GLib;
+using Gtk;
+using Ide;
+using Vala;
+
+namespace Ide
+{
+       public class ValaPipelineAddin: GLib.Object, Ide.BuildPipelineAddin
+       {
+               // main.vala:24.30-24.30: error: initializer list used for `Gtk.WindowType', which is neither 
array nor struct
+               const string ERROR_FORMAT_REGEX =
+                       "(?<filename>[a-zA-Z0-9\\-\\.\\/]+.vala):" +
+                       "(?<line>\\d+).(?<column>\\d+)-(?<line2>\\d+).(?<column2>\\d+): " +
+                       "(?<level>[\\w\\s]+): " +
+                       "(?<message>.*)";
+
+               uint error_format = 0;
+
+               public Ide.Context context { owned get; construct; }
+
+               public void load (Ide.BuildPipeline pipeline)
+               {
+                       this.error_format = pipeline.add_error_format (ERROR_FORMAT_REGEX,
+                                                                      GLib.RegexCompileFlags.OPTIMIZE | 
GLib.RegexCompileFlags.CASELESS);
+               }
+
+               public void unload (Ide.BuildPipeline pipeline)
+               {
+                       pipeline.remove_error_format (this.error_format);
+               }
+       }
+}
diff --git a/plugins/vala-pack/vala-pack-plugin.vala b/plugins/vala-pack/vala-pack-plugin.vala
index 59593d1..177744d 100644
--- a/plugins/vala-pack/vala-pack-plugin.vala
+++ b/plugins/vala-pack/vala-pack-plugin.vala
@@ -25,6 +25,7 @@ public void peas_register_types (GLib.TypeModule module)
 {
        Peas.ObjectModule peas = (Peas.ObjectModule)module;
 
+       peas.register_extension_type (typeof (Ide.BuildPipelineAddin), typeof (Ide.ValaPipelineAddin));
        peas.register_extension_type (typeof (Ide.CompletionProvider), typeof (Ide.ValaCompletionProvider));
        peas.register_extension_type (typeof (Ide.DiagnosticProvider), typeof (Ide.ValaDiagnosticProvider));
        peas.register_extension_type (typeof (Ide.Indenter), typeof (Ide.ValaIndenter));


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