[gnome-builder] foundry: add helper to check for supported languages



commit 41ce53231267296ade1fe3e8939238a5c74f2411
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 2 14:07:53 2021 -0700

    foundry: add helper to check for supported languages
    
    Generally, we want this to be equivalent to meson's "languages" array in
    a project() definition. But some massaging may be necessary over time.

 src/libide/foundry/ide-build-system.c | 24 ++++++++++++++++++++++++
 src/libide/foundry/ide-build-system.h |  5 +++++
 2 files changed, 29 insertions(+)
---
diff --git a/src/libide/foundry/ide-build-system.c b/src/libide/foundry/ide-build-system.c
index 639fdfa75..709703499 100644
--- a/src/libide/foundry/ide-build-system.c
+++ b/src/libide/foundry/ide-build-system.c
@@ -791,3 +791,27 @@ ide_build_system_get_project_version (IdeBuildSystem *self)
 
   return NULL;
 }
+
+/**
+ * ide_build_system_supports_language:
+ * @self: a #IdeBuildSystem
+ * @language: the language identifier
+ *
+ * Returns %TRUE if @self in it's current configuration is known to support @language.
+ *
+ * Returns: %TRUE if @language is supported, otherwise %FALSE.
+ *
+ * Since: 41.0
+ */
+gboolean
+ide_build_system_supports_language (IdeBuildSystem *self,
+                                    const char     *language)
+{
+  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), FALSE);
+  g_return_val_if_fail (language != NULL, FALSE);
+
+  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->supports_language)
+    return IDE_BUILD_SYSTEM_GET_IFACE (self)->supports_language (self, language);
+
+  return FALSE;
+}
diff --git a/src/libide/foundry/ide-build-system.h b/src/libide/foundry/ide-build-system.h
index f8354b2e8..c30275091 100644
--- a/src/libide/foundry/ide-build-system.h
+++ b/src/libide/foundry/ide-build-system.h
@@ -64,6 +64,8 @@ struct _IdeBuildSystemInterface
   gboolean    (*supports_toolchain)                (IdeBuildSystem       *self,
                                                     IdeToolchain         *toolchain);
   gchar      *(*get_project_version)               (IdeBuildSystem       *self);
+  gboolean    (*supports_language)                 (IdeBuildSystem       *self,
+                                                    const char           *language);
 };
 
 IDE_AVAILABLE_IN_3_32
@@ -114,5 +116,8 @@ void             _ide_build_system_set_project_file                (IdeBuildSyst
 IDE_AVAILABLE_IN_3_32
 gboolean         ide_build_system_supports_toolchain               (IdeBuildSystem       *self,
                                                                     IdeToolchain         *toolchain);
+IDE_AVAILABLE_IN_41
+gboolean         ide_build_system_supports_language                (IdeBuildSystem       *self,
+                                                                    const char           *language);
 
 G_END_DECLS


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