[geocode-glib/bilelmoussaoui/gi-docgen: 1/8] docs: initial port to gi-docgen




commit 0781d25e56c598eb6e8031b2aae04a338de63563
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Jan 14 12:00:26 2022 +0100

    docs: initial port to gi-docgen

 docs/GeocodeGlib.toml.in | 45 +++++++++++++++++++++++++++++++++++
 docs/meson.build         | 62 ++++++++++++++++++++++++++++++++----------------
 docs/urlmap.js           |  6 +++++
 geocode-glib/meson.build |  2 +-
 4 files changed, 94 insertions(+), 21 deletions(-)
---
diff --git a/docs/GeocodeGlib.toml.in b/docs/GeocodeGlib.toml.in
new file mode 100644
index 0000000..071ba8f
--- /dev/null
+++ b/docs/GeocodeGlib.toml.in
@@ -0,0 +1,45 @@
+[library]
+version = "@version@"
+browse_url = "https://gitlab.gnome.org/GNOME/geocode-glib";
+repository_url = "https://gitlab.gnome.org/GNOME/geocode-glib.git";
+website_url = "https://gitlab.gnome.org/GNOME/geocode-glib";
+docs_url = "https://gnome.pages.gitlab.gnome.org/geocode-glib/";
+authors = "Bastien Nocera"
+license = "GPL-2.0-or-later"
+description = "A convenience library for the geocoding and reverse geocoding"
+dependencies = [ "GObject-2.0", "GLib-1.0", "Gio-2.0" ]
+devhelp = true
+search_index = true
+
+  [dependencies."GObject-2.0"]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/gobject/";
+
+  [dependencies."GLib-2.0"]
+  name = "GLib"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/glib/";
+
+  [dependencies."Gio-2.0"]
+  name = "GIO"
+  description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
+  docs_url = "https://docs.gtk.org/gio/";
+
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/geocode-glib/-/blob/master/";
+
+[extra]
+# The same order will be used when generating the index
+content_files = [
+]
+
+content_images = [
+]
+urlmap_file = "urlmap.js"
diff --git a/docs/meson.build b/docs/meson.build
index 8a03a32..18f62b7 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -1,3 +1,7 @@
+if get_option('enable-gtk-doc') and not enable_gir
+  error('API reference requires introspection.')
+endif
+
 ent_conf = configuration_data()
 ent_conf.set('PACKAGE', 'Geocode-Glib')
 ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=geocode-glib')
@@ -27,24 +31,42 @@ glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
 glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
 docpath = join_paths(datadir, 'gtk-doc', 'html')
 
-gnome.gtkdoc('geocode-glib',
-             main_xml: 'geocode-glib-docs.xml',
-             src_dir: [
-               join_paths(meson.source_root(), 'geocode-glib'),
-               join_paths(meson.build_root(), 'geocode-glib'),
-             ],
-             dependencies: geocode_glib_dep,
-             gobject_typesfile: 'geocode-glib.types',
-             scan_args: [
-               '--rebuild-types',
-               '--ignore-decorators=GEOCODE_EXTERN',
-               '--ignore-headers=' + ' '.join(private_headers),
-             ],
-             fixxref_args: [
-               '--html-dir=@0@'.format(docpath),
-               '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
-               '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
-               '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
-             ],
-             install: true)
+toml_conf = configuration_data()
+toml_conf.set('version', meson.project_version())
+
+gidocgen = find_program('gi-docgen', required: get_option('enable-gtk-doc'))
+
+gidocgen_common_args = [
+  '--quiet',
+  '--no-namespace-dir',
+]
+
+if get_option('werror')
+  gidocgen_common_args += ['--fatal-warnings']
+endif
+
+docs_dir = datadir / 'doc'
+source_toml = configure_file(
+  input: 'GeocodeGlib.toml.in',
+  output: 'GeocodeGlib.toml',
+  configuration: toml_conf,
+  install: true,
+  install_dir: docs_dir / 'geocode-glib-1',
+)
 
+custom_target('geocodeglib-doc',
+  input: [ source_toml, geocode_gir[0] ],
+  output: 'geocode-glib-1',
+  command: [
+    gidocgen,
+    'generate',
+    gidocgen_common_args,
+    '--config=@INPUT0@',
+    '--output-dir=@OUTPUT@',
+    '--content-dir=@0@'.format(meson.current_source_dir()),
+    '@INPUT1@',
+  ],
+  build_by_default: true,
+  install: true,
+  install_dir: docs_dir,
+)
diff --git a/docs/urlmap.js b/docs/urlmap.js
new file mode 100644
index 0000000..67e8a25
--- /dev/null
+++ b/docs/urlmap.js
@@ -0,0 +1,6 @@
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+    [ 'GLib', 'https://docs.gtk.org/glib/' ],
+    [ 'GObject', 'https://docs.gtk.org/gobject/' ],
+    [ 'Gio', 'https://docs.gtk.org/gio/' ],
+]
diff --git a/geocode-glib/meson.build b/geocode-glib/meson.build
index 970860f..3b3786b 100644
--- a/geocode-glib/meson.build
+++ b/geocode-glib/meson.build
@@ -107,7 +107,7 @@ if gir.found() and enable_gir
        '--c-include=geocode-glib/geocode-glib.h'
   ]
 
-  gnome.generate_gir(libgcglib,
+  geocode_gir = gnome.generate_gir(libgcglib,
                      sources: public_sources + headers,
                      namespace: 'GeocodeGlib',
                      nsversion: gclib_api_version,


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