[gnome-builder] plugins/vala-pack: rename to valac



commit 7d674360877b08e7de74069d4bf1fe36b2820c02
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 11 23:26:17 2022 -0700

    plugins/vala-pack: rename to valac
    
    And drop the indenter, it will have to come from GSV.

 src/plugins/vala-pack/meson.build            |  13 ---
 src/plugins/vala-pack/vala-pack.plugin       |  11 ---
 src/plugins/vala-pack/vala_pack_plugin.py    | 136 ---------------------------
 src/plugins/valac/gbp-valac-pipeline-addin.c |  83 ++++++++++++++++
 src/plugins/valac/gbp-valac-pipeline-addin.h |  31 ++++++
 src/plugins/valac/meson.build                |  16 ++++
 src/plugins/valac/valac-plugin.c             |  37 ++++++++
 src/plugins/valac/valac.gresource.xml        |   6 ++
 src/plugins/valac/valac.plugin               |   9 ++
 9 files changed, 182 insertions(+), 160 deletions(-)
---
diff --git a/src/plugins/valac/gbp-valac-pipeline-addin.c b/src/plugins/valac/gbp-valac-pipeline-addin.c
new file mode 100644
index 000000000..b6b9d1344
--- /dev/null
+++ b/src/plugins/valac/gbp-valac-pipeline-addin.c
@@ -0,0 +1,83 @@
+/* gbp-valac-pipeline-addin.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-valac-pipeline-addin"
+
+#include "config.h"
+
+#include <libide-foundry.h>
+
+#include "gbp-valac-pipeline-addin.h"
+
+struct _GbpValacPipelineAddin
+{
+  IdeObject parent_instance;
+  guint     error_format_id;
+};
+
+static void
+gbp_valac_pipeline_addin_load (IdePipelineAddin *addin,
+                              IdePipeline      *pipeline)
+{
+  GbpValacPipelineAddin *self = (GbpValacPipelineAddin *)addin;
+
+  g_assert (IDE_IS_PIPELINE_ADDIN (self));
+  g_assert (IDE_IS_PIPELINE (pipeline));
+
+  self->error_format_id = ide_pipeline_add_error_format (pipeline,
+                                                         "(?<filename>[a-zA-Z0-9\\-\\.\\/_]+.vala):"
+                                                         
"(?<line>\\d+).(?<column>\\d+)-(?<line2>\\d+).(?<column2>\\d+): "
+                                                         "(?<level>[\\w\\s]+): "
+                                                         "(?<message>.*)",
+                                                         G_REGEX_OPTIMIZE);
+}
+
+static void
+gbp_valac_pipeline_addin_unload (IdePipelineAddin *addin,
+                                IdePipeline      *pipeline)
+{
+  GbpValacPipelineAddin *self = (GbpValacPipelineAddin *)addin;
+
+  g_assert (IDE_IS_PIPELINE_ADDIN (self));
+  g_assert (IDE_IS_PIPELINE (pipeline));
+
+  ide_pipeline_remove_error_format (pipeline, self->error_format_id);
+  self->error_format_id = 0;
+}
+
+static void
+pipeline_addin_iface_init (IdePipelineAddinInterface *iface)
+{
+  iface->load = gbp_valac_pipeline_addin_load;
+  iface->unload = gbp_valac_pipeline_addin_unload;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpValacPipelineAddin, gbp_valac_pipeline_addin, IDE_TYPE_OBJECT,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_PIPELINE_ADDIN, pipeline_addin_iface_init))
+
+static void
+gbp_valac_pipeline_addin_class_init (GbpValacPipelineAddinClass *klass)
+{
+}
+
+static void
+gbp_valac_pipeline_addin_init (GbpValacPipelineAddin *self)
+{
+}
diff --git a/src/plugins/valac/gbp-valac-pipeline-addin.h b/src/plugins/valac/gbp-valac-pipeline-addin.h
new file mode 100644
index 000000000..126f4dcc9
--- /dev/null
+++ b/src/plugins/valac/gbp-valac-pipeline-addin.h
@@ -0,0 +1,31 @@
+/* gbp-valac-pipeline-addin.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libide-core.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_VALAC_PIPELINE_ADDIN (gbp_valac_pipeline_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpValacPipelineAddin, gbp_valac_pipeline_addin, GBP, VALAC_PIPELINE_ADDIN, IdeObject)
+
+G_END_DECLS
diff --git a/src/plugins/valac/meson.build b/src/plugins/valac/meson.build
new file mode 100644
index 000000000..1722f372e
--- /dev/null
+++ b/src/plugins/valac/meson.build
@@ -0,0 +1,16 @@
+if get_option('plugin_valac')
+
+plugins_sources += files([
+  'valac-plugin.c',
+  'gbp-valac-pipeline-addin.c',
+])
+
+plugin_valac_resources = gnome.compile_resources(
+  'valac-resources',
+  'valac.gresource.xml',
+  c_name: 'gbp_valac',
+)
+
+plugins_sources += plugin_valac_resources
+
+endif
diff --git a/src/plugins/valac/valac-plugin.c b/src/plugins/valac/valac-plugin.c
new file mode 100644
index 000000000..a7088387e
--- /dev/null
+++ b/src/plugins/valac/valac-plugin.c
@@ -0,0 +1,37 @@
+/* valac-plugin.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "valac-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-foundry.h>
+
+#include "gbp-valac-pipeline-addin.h"
+
+_IDE_EXTERN void
+_gbp_valac_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_PIPELINE_ADDIN,
+                                              GBP_TYPE_VALAC_PIPELINE_ADDIN);
+}
diff --git a/src/plugins/valac/valac.gresource.xml b/src/plugins/valac/valac.gresource.xml
new file mode 100644
index 000000000..e521b80f4
--- /dev/null
+++ b/src/plugins/valac/valac.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/plugins/valac">
+    <file>valac.plugin</file>
+  </gresource>
+</gresources>
diff --git a/src/plugins/valac/valac.plugin b/src/plugins/valac/valac.plugin
new file mode 100644
index 000000000..36ce6910e
--- /dev/null
+++ b/src/plugins/valac/valac.plugin
@@ -0,0 +1,9 @@
+[Plugin]
+Authors=Christian Hergert <christian hergert me>
+Builtin=true
+Copyright=Copyright © 2015-2022 Christian Hergert
+Description=Extracts build errors from the vala compiler
+Embedded=_gbp_valac_register_types
+Module=valac
+Name=Vala
+X-Category=compilers


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