[gnome-builder] autotools: stub build target provider
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] autotools: stub build target provider
- Date: Mon, 20 Nov 2017 06:28:38 +0000 (UTC)
commit 1f578a3a849fdea5b1cc51014a077b1daaf90253
Author: Christian Hergert <chergert redhat com>
Date: Sun Nov 19 21:09:52 2017 -0800
autotools: stub build target provider
.../ide-autotools-build-target-provider.c | 96 ++++++++++++++++++++
.../ide-autotools-build-target-provider.h | 29 ++++++
.../meson/gbp-meson-build-target-provider.c | 13 +++
3 files changed, 138 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/autotools/ide-autotools-build-target-provider.c
b/src/plugins/autotools/ide-autotools-build-target-provider.c
new file mode 100644
index 0000000..599739e
--- /dev/null
+++ b/src/plugins/autotools/ide-autotools-build-target-provider.c
@@ -0,0 +1,96 @@
+/* ide-autotools-build-target-provider.c
+ *
+ * Copyright (C) 2017 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/>.
+ */
+
+#define G_LOG_DOMAIN "ide-autotools-build-target-provider"
+
+#include "ide-autotools-build-target-provider.h"
+
+struct _IdeAutotoolsBuildTargetProvider
+{
+ IdeObject parent_instance;
+};
+
+static void
+ide_autotools_build_target_provider_get_targets_async (IdeBuildTargetProvider *provider,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ IdeAutotoolsBuildTargetProvider *self = (IdeAutotoolsBuildTargetProvider *)provider;
+ g_autoptr(GTask) task = NULL;
+ IdeBuildSystem *build_system;
+ IdeContext *context;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_AUTOTOOLS_BUILD_TARGET_PROVIDER (self));
+ g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, ide_autotools_build_target_provider_get_targets_async);
+ g_task_set_priority (task, G_PRIORITY_LOW);
+
+ context = ide_object_get_context (IDE_OBJECT (self));
+ build_system = ide_context_get_build_system (context);
+
+ if (!IDE_IS_AUTOTOOLS_BUILD_SYSTEM (build_system))
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "Not a meson build system, ignoring");
+ IDE_EXIT;
+ }
+
+ IDE_EXIT;
+}
+
+static GPtrArray *
+ide_autotools_build_target_provider_get_targets_finish (IdeBuildTargetProvider *provider,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_assert (IDE_IS_AUTOTOOLS_BUILD_TARGET_PROVIDER (provider));
+ g_assert (G_IS_TASK (result));
+ g_assert (g_task_is_valid (G_TASK (result), provider));
+
+ return g_task_propagate_pointer (G_TASK (provider), error);
+}
+
+static void
+build_target_provider_iface_init (IdeBuildTargetProviderInterface *iface)
+{
+ iface->get_targets_async = ide_autotools_build_target_provider_get_targets_async;
+ iface->get_targets_finish = ide_autotools_build_target_provider_get_targets_finish;
+}
+
+G_DEFINE_TYPE_WITH_CODE (IdeAutotoolsBuildTargetProvider,
+ ide_autotools_build_target_provider,
+ IDE_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_BUILD_TARGET_PROVIDER,
+ build_target_provider_iface_init))
+
+static void
+ide_autotools_build_target_provider_class_init (IdeAutotoolsBuildTargetProviderClass *klass)
+{
+}
+
+static void
+ide_autotools_build_target_provider_init (IdeAutotoolsBuildTargetProvider *self)
+{
+}
diff --git a/src/plugins/autotools/ide-autotools-build-target-provider.h
b/src/plugins/autotools/ide-autotools-build-target-provider.h
new file mode 100644
index 0000000..c6aca29
--- /dev/null
+++ b/src/plugins/autotools/ide-autotools-build-target-provider.h
@@ -0,0 +1,29 @@
+/* ide-autotools-build-target-provider.h
+ *
+ * Copyright (C) 2017 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/>.
+ */
+
+#pragma once
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_AUTOTOOLS_BUILD_TARGET_PROVIDER (ide_autotools_build_target_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeAutotoolsBuildTargetProvider, ide_autotools_build_target_provider, IDE,
AUTOTOOLS_BUILD_TARGET_PROVIDER, IdeObject)
+
+G_END_DECLS
diff --git a/src/plugins/meson/gbp-meson-build-target-provider.c
b/src/plugins/meson/gbp-meson-build-target-provider.c
index be7dc2b..8c81659 100644
--- a/src/plugins/meson/gbp-meson-build-target-provider.c
+++ b/src/plugins/meson/gbp-meson-build-target-provider.c
@@ -20,6 +20,7 @@
#include <json-glib/json-glib.h>
+#include "gbp-meson-build-system.h"
#include "gbp-meson-build-target.h"
#include "gbp-meson-build-target-provider.h"
@@ -314,6 +315,7 @@ gbp_meson_build_target_provider_get_targets_async (IdeBuildTargetProvider *provi
g_autoptr(GTask) task = NULL;
IdeBuildPipeline *pipeline;
IdeBuildManager *build_manager;
+ IdeBuildSystem *build_system;
IdeContext *context;
IDE_ENTRY;
@@ -326,6 +328,17 @@ gbp_meson_build_target_provider_get_targets_async (IdeBuildTargetProvider *provi
g_task_set_priority (task, G_PRIORITY_LOW);
context = ide_object_get_context (IDE_OBJECT (self));
+ build_system = ide_context_get_build_system (context);
+
+ if (!GBP_IS_MESON_BUILD_SYSTEM (build_system))
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "Not a meson build system, ignoring");
+ IDE_EXIT;
+ }
+
build_manager = ide_context_get_build_manager (context);
pipeline = ide_build_manager_get_pipeline (build_manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]