[gnome-builder/wip/gtk4-port] plugins/meson: stub out run command provider



commit 60548756c32191e5bbf5086a30ebb0aac59a455b
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 23 15:15:11 2022 -0700

    plugins/meson: stub out run command provider

 src/plugins/meson/gbp-meson-run-command-provider.c | 92 ++++++++++++++++++++++
 src/plugins/meson/gbp-meson-run-command-provider.h | 31 ++++++++
 src/plugins/meson/gbp-meson-run-command.c          | 56 +++++++++++++
 src/plugins/meson/gbp-meson-run-command.h          | 31 ++++++++
 src/plugins/meson/meson-plugin.c                   |  4 +
 src/plugins/meson/meson.build                      |  2 +
 6 files changed, 216 insertions(+)
---
diff --git a/src/plugins/meson/gbp-meson-run-command-provider.c 
b/src/plugins/meson/gbp-meson-run-command-provider.c
new file mode 100644
index 000000000..921a32cb4
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-run-command-provider.c
@@ -0,0 +1,92 @@
+/* gbp-meson-run-command-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-meson-run-command-provider"
+
+#include <libide-threading.h>
+
+#include "gbp-meson-run-command-provider.h"
+
+struct _GbpMesonRunCommandProvider
+{
+  IdeObject parent_instance;
+};
+
+static void
+gbp_meson_run_command_provider_list_commands_async (IdeRunCommandProvider *provider,
+                                                    GCancellable          *cancellable,
+                                                    GAsyncReadyCallback    callback,
+                                                    gpointer               user_data)
+{
+  GbpMesonRunCommandProvider *self = (GbpMesonRunCommandProvider *)provider;
+  g_autoptr(IdeTask) task = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_RUN_COMMAND_PROVIDER (self));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  task = ide_task_new (self, cancellable, callback, user_data);
+  ide_task_set_source_tag (task, gbp_meson_run_command_provider_list_commands_async);
+
+  ide_task_return_new_error (task,
+                             G_IO_ERROR,
+                             G_IO_ERROR_NOT_SUPPORTED,
+                             "Not yet supported");
+
+  IDE_EXIT;
+}
+
+static GListModel *
+gbp_meson_run_command_provider_list_commands_finish (IdeRunCommandProvider  *provider,
+                                                     GAsyncResult           *result,
+                                                     GError                **error)
+{
+  GListModel *ret;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_RUN_COMMAND_PROVIDER (provider));
+  g_assert (IDE_IS_TASK (result));
+
+  ret = ide_task_propagate_pointer (IDE_TASK (result), error);
+
+  IDE_RETURN (ret);
+}
+
+static void
+run_command_provider_iface (IdeRunCommandProviderInterface *iface)
+{
+  iface->list_commands_async = gbp_meson_run_command_provider_list_commands_async;
+  iface->list_commands_finish = gbp_meson_run_command_provider_list_commands_finish;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpMesonRunCommandProvider, gbp_meson_run_command_provider, IDE_TYPE_OBJECT,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_RUN_COMMAND_PROVIDER, 
run_command_provider_iface))
+
+static void
+gbp_meson_run_command_provider_class_init (GbpMesonRunCommandProviderClass *klass)
+{
+}
+
+static void
+gbp_meson_run_command_provider_init (GbpMesonRunCommandProvider *self)
+{
+}
diff --git a/src/plugins/meson/gbp-meson-run-command-provider.h 
b/src/plugins/meson/gbp-meson-run-command-provider.h
new file mode 100644
index 000000000..2b2bff778
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-run-command-provider.h
@@ -0,0 +1,31 @@
+/* gbp-meson-run-command-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-foundry.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_MESON_RUN_COMMAND_PROVIDER (gbp_meson_run_command_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpMesonRunCommandProvider, gbp_meson_run_command_provider, GBP, 
MESON_RUN_COMMAND_PROVIDER, IdeObject)
+
+G_END_DECLS
diff --git a/src/plugins/meson/gbp-meson-run-command.c b/src/plugins/meson/gbp-meson-run-command.c
new file mode 100644
index 000000000..59b2723e2
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-run-command.c
@@ -0,0 +1,56 @@
+/* gbp-meson-run-command.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-meson-run-command"
+
+#include "config.h"
+
+#include "gbp-meson-run-command.h"
+
+struct _GbpMesonRunCommand
+{
+  IdeRunCommand parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpMesonRunCommand, gbp_meson_run_command, IDE_TYPE_RUN_COMMAND)
+
+static char **
+gbp_meson_run_command_get_arguments (IdeRunCommand      *run_command,
+                                     const char * const *wrapper)
+{
+  g_assert (GBP_IS_MESON_RUN_COMMAND (run_command));
+
+  /* TODO: use --wrapper when 'meson test' */
+
+  return IDE_RUN_COMMAND_CLASS (gbp_meson_run_command_parent_class)->get_arguments (run_command, wrapper);
+}
+
+static void
+gbp_meson_run_command_class_init (GbpMesonRunCommandClass *klass)
+{
+  IdeRunCommandClass *run_command_class = IDE_RUN_COMMAND_CLASS (klass);
+
+  run_command_class->get_arguments = gbp_meson_run_command_get_arguments;
+}
+
+static void
+gbp_meson_run_command_init (GbpMesonRunCommand *self)
+{
+}
diff --git a/src/plugins/meson/gbp-meson-run-command.h b/src/plugins/meson/gbp-meson-run-command.h
new file mode 100644
index 000000000..55bb05111
--- /dev/null
+++ b/src/plugins/meson/gbp-meson-run-command.h
@@ -0,0 +1,31 @@
+/* gbp-meson-run-command.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_MESON_RUN_COMMAND (gbp_meson_run_command_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpMesonRunCommand, gbp_meson_run_command, GBP, MESON_RUN_COMMAND, IdeRunCommand)
+
+G_END_DECLS
diff --git a/src/plugins/meson/meson-plugin.c b/src/plugins/meson/meson-plugin.c
index 5504d70f3..c678ea6c1 100644
--- a/src/plugins/meson/meson-plugin.c
+++ b/src/plugins/meson/meson-plugin.c
@@ -33,6 +33,7 @@
 #include "gbp-meson-config-view-addin.h"
 #include "gbp-meson-pipeline-addin.h"
 #include "gbp-meson-test-provider.h"
+#include "gbp-meson-run-command-provider.h"
 #include "gbp-meson-toolchain-provider.h"
 
 #if 0
@@ -57,6 +58,9 @@ _gbp_meson_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_BUILD_TARGET_PROVIDER,
                                               GBP_TYPE_MESON_BUILD_TARGET_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RUN_COMMAND_PROVIDER,
+                                              GBP_TYPE_MESON_RUN_COMMAND_PROVIDER);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_TEST_PROVIDER,
                                               GBP_TYPE_MESON_TEST_PROVIDER);
diff --git a/src/plugins/meson/meson.build b/src/plugins/meson/meson.build
index d98d15a69..4283bfbc8 100644
--- a/src/plugins/meson/meson.build
+++ b/src/plugins/meson/meson.build
@@ -7,6 +7,8 @@ plugins_sources += files([
   'gbp-meson-build-target-provider.c',
   'gbp-meson-build-target.c',
   'gbp-meson-pipeline-addin.c',
+  'gbp-meson-run-command.c',
+  'gbp-meson-run-command-provider.c',
   'gbp-meson-test-provider.c',
   'gbp-meson-test.c',
   'gbp-meson-toolchain-provider.c',


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