[gnome-builder] plugins/jhbuild: port to C



commit 4092b81ac89ef9339bc0c480b3ba5f423d947a42
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 11 22:56:49 2022 -0700

    plugins/jhbuild: port to C
    
     - Track changes to runtime providers
     - Port to C

 src/plugins/jhbuild/gbp-jhbuild-runtime-provider.c | 196 ++++++++++++++++
 src/plugins/jhbuild/gbp-jhbuild-runtime-provider.h |  31 +++
 src/plugins/jhbuild/gbp-jhbuild-runtime.c          | 253 +++++++++++++++++++++
 src/plugins/jhbuild/gbp-jhbuild-runtime.h          |  31 +++
 src/plugins/jhbuild/jhbuild-plugin.c               |  37 +++
 src/plugins/jhbuild/jhbuild.gresource.xml          |   6 +
 src/plugins/jhbuild/jhbuild.plugin                 |  12 +-
 src/plugins/jhbuild/jhbuild_plugin.py              | 134 -----------
 src/plugins/jhbuild/meson.build                    |  20 +-
 9 files changed, 572 insertions(+), 148 deletions(-)
---
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.c 
b/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.c
new file mode 100644
index 000000000..40e208110
--- /dev/null
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.c
@@ -0,0 +1,196 @@
+/* gbp-jhbuild-runtime-provider.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-jhbuild-runtime-provider"
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include <libide-foundry.h>
+#include <libide-threading.h>
+
+#include "gbp-jhbuild-runtime.h"
+#include "gbp-jhbuild-runtime-provider.h"
+
+struct _GbpJhbuildRuntimeProvider
+{
+  IdeObject          parent_instance;
+  GbpJhbuildRuntime *runtime;
+};
+
+static char *
+get_jhbuild_path (void)
+{
+  g_autofree char *local_path = g_build_filename (g_get_home_dir (), ".local", "bin", "jhbuild", NULL);
+  const char *maybe_path[] = { local_path, "jhbuild" };
+
+  for (guint i = 0; i < G_N_ELEMENTS (maybe_path); i++)
+    {
+      g_autoptr(IdeSubprocessLauncher) launcher = NULL;
+      g_autoptr(IdeSubprocess) subprocess = NULL;
+      const char *path = maybe_path[i];
+
+      launcher = ide_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_SILENCE | 
G_SUBPROCESS_FLAGS_STDERR_SILENCE);
+      ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+      ide_subprocess_launcher_set_clear_env (launcher, FALSE);
+      ide_subprocess_launcher_push_argv (launcher, "which");
+      ide_subprocess_launcher_push_argv (launcher, path);
+
+      if (!(subprocess = ide_subprocess_launcher_spawn (launcher, NULL, NULL)))
+        continue;
+
+      if (ide_subprocess_wait_check (subprocess, NULL, NULL))
+        return g_strdup (path);
+    }
+
+  return NULL;
+}
+
+static char *
+get_jhbuild_prefix (const char *jhbuild_bin)
+{
+  g_autoptr(IdeSubprocessLauncher) launcher = NULL;
+  g_autoptr(IdeSubprocess) subprocess = NULL;
+  g_autofree char *stdout_buf = NULL;
+
+  g_assert (jhbuild_bin != NULL);
+
+  launcher = ide_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE | 
G_SUBPROCESS_FLAGS_STDERR_SILENCE);
+  ide_subprocess_launcher_push_args (launcher, IDE_STRV_INIT (jhbuild_bin, "run", "sh", "-c", "echo 
$JHBUILD_PREFIX"));
+  ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+  ide_subprocess_launcher_set_clear_env (launcher, FALSE);
+
+  if (!(subprocess = ide_subprocess_launcher_spawn (launcher, NULL, NULL)))
+    return NULL;
+
+  if (!ide_subprocess_communicate_utf8 (subprocess, NULL, NULL, &stdout_buf, NULL, NULL))
+    return NULL;
+
+  if (stdout_buf != NULL)
+    g_strstrip (stdout_buf);
+
+  return g_steal_pointer (&stdout_buf);
+}
+
+static void
+gbp_jhbuild_runtime_provider_load (IdeRuntimeProvider *provider,
+                                   IdeRuntimeManager  *manager)
+{
+  GbpJhbuildRuntimeProvider *self = (GbpJhbuildRuntimeProvider *)provider;
+  g_autofree char *jhbuild_bin = NULL;
+  g_autofree char *jhbuild_prefix = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_JHBUILD_RUNTIME_PROVIDER (self));
+  g_assert (IDE_IS_RUNTIME_MANAGER (manager));
+
+  if (!(jhbuild_bin = get_jhbuild_path ()))
+    {
+      g_debug ("jhbuild not found within path, ignoring");
+      IDE_EXIT;
+    }
+
+  if (!(jhbuild_prefix = get_jhbuild_prefix (jhbuild_bin)))
+    {
+      g_debug ("jhbuild installation not complete, ignoring");
+      IDE_EXIT;
+    }
+
+  self->runtime = g_object_new (GBP_TYPE_JHBUILD_RUNTIME,
+                                "parent", IDE_OBJECT (self),
+                                "id", "jhbuild",
+                                "category", _("Host System"),
+                                "display-name", "JHBuild",
+                                "executable-path", jhbuild_bin,
+                                "install-prefix", jhbuild_prefix,
+                                NULL);
+  ide_runtime_manager_add (manager, IDE_RUNTIME (self->runtime));
+
+  IDE_EXIT;
+}
+
+static void
+gbp_jhbuild_runtime_provider_unload (IdeRuntimeProvider *provider,
+                                     IdeRuntimeManager  *manager)
+{
+  GbpJhbuildRuntimeProvider *self = (GbpJhbuildRuntimeProvider *)provider;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_JHBUILD_RUNTIME_PROVIDER (self));
+  g_assert (IDE_IS_RUNTIME_MANAGER (manager));
+
+  if (self->runtime != NULL)
+    {
+      ide_runtime_manager_remove (manager, IDE_RUNTIME (self->runtime));
+      ide_clear_and_destroy_object (&self->runtime);
+    }
+
+  IDE_EXIT;
+}
+
+static gboolean
+gbp_jhbuild_runtime_provider_provides (IdeRuntimeProvider *provider,
+                                       const char         *runtime_id)
+{
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_JHBUILD_RUNTIME_PROVIDER (provider));
+  g_assert (runtime_id != NULL);
+
+  return ide_str_equal0 (runtime_id, "jhbuild") == 0;
+}
+
+static void
+runtime_provider_iface_init (IdeRuntimeProviderInterface *iface)
+{
+  iface->load = gbp_jhbuild_runtime_provider_load;
+  iface->unload = gbp_jhbuild_runtime_provider_unload;
+  iface->provides = gbp_jhbuild_runtime_provider_provides;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJhbuildRuntimeProvider, gbp_jhbuild_runtime_provider, IDE_TYPE_OBJECT,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_RUNTIME_PROVIDER, 
runtime_provider_iface_init))
+
+static void
+gbp_jhbuild_runtime_provider_dispose (GObject *object)
+{
+  GbpJhbuildRuntimeProvider *self = (GbpJhbuildRuntimeProvider *)object;
+
+  ide_clear_and_destroy_object (&self->runtime);
+
+  G_OBJECT_CLASS (gbp_jhbuild_runtime_provider_parent_class)->dispose (object);
+}
+
+static void
+gbp_jhbuild_runtime_provider_class_init (GbpJhbuildRuntimeProviderClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = gbp_jhbuild_runtime_provider_dispose;
+}
+
+static void
+gbp_jhbuild_runtime_provider_init (GbpJhbuildRuntimeProvider *self)
+{
+}
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.h 
b/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.h
new file mode 100644
index 000000000..1dc8226b0
--- /dev/null
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jhbuild-runtime-provider.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_JHBUILD_RUNTIME_PROVIDER (gbp_jhbuild_runtime_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJhbuildRuntimeProvider, gbp_jhbuild_runtime_provider, GBP, 
JHBUILD_RUNTIME_PROVIDER, IdeObject)
+
+G_END_DECLS
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime.c b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
new file mode 100644
index 000000000..cc36c1e2f
--- /dev/null
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
@@ -0,0 +1,253 @@
+/* gbp-jhbuild-runtime.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-jhbuild-runtime"
+
+#include "config.h"
+
+#include "gbp-jhbuild-runtime.h"
+
+struct _GbpJhbuildRuntime
+{
+  IdeRuntime runtime;
+  char *executable_path;
+  char *install_prefix;
+};
+
+enum {
+  PROP_0,
+  PROP_EXECUTABLE_PATH,
+  PROP_INSTALL_PREFIX,
+  N_PROPS
+};
+
+G_DEFINE_FINAL_TYPE (GbpJhbuildRuntime, gbp_jhbuild_runtime, IDE_TYPE_RUNTIME)
+
+static GParamSpec *properties [N_PROPS];
+
+static gboolean
+gbp_jhbuild_runtime_run_handler (IdeRunContext       *run_context,
+                                 const char * const  *argv,
+                                 const char * const  *env,
+                                 const char          *cwd,
+                                 IdeUnixFDMap        *unix_fd_map,
+                                 gpointer             user_data,
+                                 GError             **error)
+{
+  GbpJhbuildRuntime *self = user_data;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_JHBUILD_RUNTIME (self));
+  g_assert (IDE_IS_RUN_CONTEXT (run_context));
+  g_assert (IDE_IS_UNIX_FD_MAP (unix_fd_map));
+
+  /* First merge our FDs so we can be sure there are no collisions (there
+   * shouldn't be because we didn't set anything here).
+   */
+  if (!ide_run_context_merge_unix_fd_map (run_context, unix_fd_map, error))
+    return FALSE;
+
+  /* We always take the CWD of the upper layer */
+  ide_run_context_set_cwd (run_context, cwd);
+
+  /* We rewrite the argv to be "jhbuild run ..." */
+  ide_run_context_set_argv (run_context, IDE_STRV_INIT (self->executable_path, "run"));
+
+  /* If there is an environment to deliver, then we want that passed to the
+   * subprocess but not to affect the parent process (jhbuild). So it will now
+   * look something like "jhbuild run env FOO=BAR ..."
+   */
+  if (env != NULL && env[0] != NULL)
+    {
+      ide_run_context_append_argv (run_context, "env");
+      ide_run_context_append_args (run_context, env);
+    }
+
+  /* And now we can add the argv of the upper layers so it might look something
+   * like "jhbuild run env FOO=BAR valgrind env BAR=BAZ my-program"
+   */
+  ide_run_context_append_args (run_context, argv);
+
+  IDE_RETURN (TRUE);
+}
+
+static void
+gbp_jhbuild_runtime_prepare_run_context (IdeRuntime    *runtime,
+                                         IdePipeline   *pipeline,
+                                         IdeRunContext *run_context)
+{
+  GbpJhbuildRuntime *self = (GbpJhbuildRuntime *)runtime;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JHBUILD_RUNTIME (self));
+  g_assert (IDE_IS_PIPELINE (pipeline));
+  g_assert (IDE_IS_RUN_CONTEXT (run_context));
+
+  ide_run_context_push_host (run_context);
+  ide_run_context_push (run_context,
+                        gbp_jhbuild_runtime_run_handler,
+                        g_object_ref (self),
+                        g_object_unref);
+
+  IDE_EXIT;
+}
+
+static gboolean
+gbp_jhbuild_runtime_contains_program_in_path (IdeRuntime   *runtime,
+                                              const char   *program,
+                                              GCancellable *cancellable)
+{
+  GbpJhbuildRuntime *self = (GbpJhbuildRuntime *)runtime;
+  g_autoptr(IdeRunContext) run_context = NULL;
+  g_autoptr(IdeSubprocess) subprocess = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_assert (GBP_IS_JHBUILD_RUNTIME (self));
+  g_assert (program != NULL);
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  run_context = ide_run_context_new ();
+  ide_run_context_push_host (run_context);
+  ide_run_context_push (run_context,
+                        gbp_jhbuild_runtime_run_handler,
+                        g_object_ref (self),
+                        g_object_unref);
+
+  /* Will use /bin/sh --login -c 'which program' */
+  ide_run_context_push_shell (run_context, TRUE);
+  ide_run_context_append_argv (run_context, "which");
+  ide_run_context_append_argv (run_context, program);
+
+  if (!(subprocess = ide_run_context_spawn (run_context, &error)))
+    {
+      g_warning ("Failed to spawn subprocess: %s", error->message);
+      return FALSE;
+    }
+
+  return ide_subprocess_wait_check (subprocess, cancellable, NULL);
+}
+
+static void
+gbp_jhbuild_runtime_prepare_configuration (IdeRuntime *runtime,
+                                           IdeConfig  *config)
+{
+  GbpJhbuildRuntime *self = (GbpJhbuildRuntime *)runtime;
+
+  g_assert (GBP_IS_JHBUILD_RUNTIME (self));
+  g_assert (IDE_IS_CONFIG (config));
+
+  g_object_set (config,
+                "prefix", self->install_prefix,
+                "prefix-set", FALSE,
+                NULL);
+}
+
+static void
+gbp_jhbuild_runtime_finalize (GObject *object)
+{
+  GbpJhbuildRuntime *self = (GbpJhbuildRuntime *)object;
+
+  g_clear_pointer (&self->executable_path, g_free);
+  g_clear_pointer (&self->install_prefix, g_free);
+
+  G_OBJECT_CLASS (gbp_jhbuild_runtime_parent_class)->finalize (object);
+}
+
+static void
+gbp_jhbuild_runtime_get_property (GObject    *object,
+                                  guint       prop_id,
+                                  GValue     *value,
+                                  GParamSpec *pspec)
+{
+  GbpJhbuildRuntime *self = GBP_JHBUILD_RUNTIME (object);
+
+  switch (prop_id)
+    {
+    case PROP_EXECUTABLE_PATH:
+      g_value_set_string (value, self->executable_path);
+      break;
+
+    case PROP_INSTALL_PREFIX:
+      g_value_set_string (value, self->install_prefix);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_jhbuild_runtime_set_property (GObject      *object,
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
+{
+  GbpJhbuildRuntime *self = GBP_JHBUILD_RUNTIME (object);
+
+  switch (prop_id)
+    {
+    case PROP_EXECUTABLE_PATH:
+      self->executable_path = g_value_dup_string (value);
+      break;
+
+    case PROP_INSTALL_PREFIX:
+      self->install_prefix = g_value_dup_string (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_jhbuild_runtime_class_init (GbpJhbuildRuntimeClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeRuntimeClass *runtime_class = IDE_RUNTIME_CLASS (klass);
+
+  object_class->finalize = gbp_jhbuild_runtime_finalize;
+  object_class->get_property = gbp_jhbuild_runtime_get_property;
+  object_class->set_property = gbp_jhbuild_runtime_set_property;
+
+  runtime_class->contains_program_in_path = gbp_jhbuild_runtime_contains_program_in_path;
+  runtime_class->prepare_configuration = gbp_jhbuild_runtime_prepare_configuration;
+  runtime_class->prepare_to_build = gbp_jhbuild_runtime_prepare_run_context;
+  runtime_class->prepare_to_run = gbp_jhbuild_runtime_prepare_run_context;
+
+  properties [PROP_EXECUTABLE_PATH] =
+    g_param_spec_string ("executable-path", NULL, NULL,
+                         NULL,
+                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+  properties [PROP_INSTALL_PREFIX] =
+    g_param_spec_string ("install-prefix", NULL, NULL,
+                         NULL,
+                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
+}
+
+static void
+gbp_jhbuild_runtime_init (GbpJhbuildRuntime *self)
+{
+}
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime.h b/src/plugins/jhbuild/gbp-jhbuild-runtime.h
new file mode 100644
index 000000000..f9413e8d4
--- /dev/null
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime.h
@@ -0,0 +1,31 @@
+/* gbp-jhbuild-runtime.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-foundry.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_JHBUILD_RUNTIME (gbp_jhbuild_runtime_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJhbuildRuntime, gbp_jhbuild_runtime, GBP, JHBUILD_RUNTIME, IdeRuntime)
+
+G_END_DECLS
diff --git a/src/plugins/jhbuild/jhbuild-plugin.c b/src/plugins/jhbuild/jhbuild-plugin.c
new file mode 100644
index 000000000..85152df2b
--- /dev/null
+++ b/src/plugins/jhbuild/jhbuild-plugin.c
@@ -0,0 +1,37 @@
+/* jhbuild-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 "jhbuild-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-foundry.h>
+
+#include "gbp-jhbuild-runtime-provider.h"
+
+_IDE_EXTERN void
+_gbp_jhbuild_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RUNTIME_PROVIDER,
+                                              GBP_TYPE_JHBUILD_RUNTIME_PROVIDER);
+}
diff --git a/src/plugins/jhbuild/jhbuild.gresource.xml b/src/plugins/jhbuild/jhbuild.gresource.xml
new file mode 100644
index 000000000..b5bbba492
--- /dev/null
+++ b/src/plugins/jhbuild/jhbuild.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/plugins/jhbuild">
+    <file>jhbuild.plugin</file>
+  </gresource>
+</gresources>
diff --git a/src/plugins/jhbuild/jhbuild.plugin b/src/plugins/jhbuild/jhbuild.plugin
index 5388e6002..503bf6774 100644
--- a/src/plugins/jhbuild/jhbuild.plugin
+++ b/src/plugins/jhbuild/jhbuild.plugin
@@ -1,9 +1,9 @@
 [Plugin]
-Authors=Patrick Griffis <tingping tingping se>
+Authors=Patrick Griffis <tingping tingping se>, Christian Hergert <chergert redhat com>
 Builtin=true
-Copyright=Copyright © 2016 Patrick Griffis
-Description=Provides support for building with JHBuild
-Loader=python3
-Module=jhbuild_plugin
+Copyright=Copyright © 2016 Patrick Griffis, Copyright © 2022 Christian Hergert
+Description=Provides integration with JHBuild to build various GNOME projects
+Embedded=_gbp_jhbuild_register_types
+Module=jhbuild
 Name=JHBuild
-X-Builder-ABI=@PACKAGE_ABI@
+X-Category=sdks
diff --git a/src/plugins/jhbuild/meson.build b/src/plugins/jhbuild/meson.build
index 35e3f9d8c..f75f812c4 100644
--- a/src/plugins/jhbuild/meson.build
+++ b/src/plugins/jhbuild/meson.build
@@ -1,13 +1,17 @@
 if get_option('plugin_jhbuild')
 
-install_data('jhbuild_plugin.py', install_dir: plugindir)
-
-configure_file(
-          input: 'jhbuild.plugin',
-         output: 'jhbuild.plugin',
-  configuration: config_h,
-        install: true,
-    install_dir: plugindir,
+plugins_sources += files([
+  'jhbuild-plugin.c',
+  'gbp-jhbuild-runtime.c',
+  'gbp-jhbuild-runtime-provider.c',
+])
+
+plugin_jhbuild_resources = gnome.compile_resources(
+  'jhbuild-resources',
+  'jhbuild.gresource.xml',
+  c_name: 'gbp_jhbuild',
 )
 
+plugins_sources += plugin_jhbuild_resources
+
 endif


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