From 6797471b7340886c060693e36d5723ac5f23a8aa Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 11 Jul 2022 11:41:59 +0100 Subject: [PATCH 1/2] build: Add a -Dgtk_doc=true option for enabling/disabling documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows gtk-doc to be dropped as a dependency if people don’t want docs. Signed-off-by: Philip Withnall Fixes: #6 --- libgsystemservice/meson.build | 4 +++- meson_options.txt | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libgsystemservice/meson.build b/libgsystemservice/meson.build index 6a8d2a5..d5c3211 100644 --- a/libgsystemservice/meson.build +++ b/libgsystemservice/meson.build @@ -66,5 +66,7 @@ if not meson.is_subproject() ) endif -subdir('docs') +if get_option('gtk_doc') + subdir('docs') +endif subdir('tests') \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt index c01db72..b2493ec 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,13 @@ # Copyright © 2018 Endless Mobile, Inc. # SPDX-License-Identifier: LGPL-2.1-or-later +option( + 'gtk_doc', + type: 'boolean', + value: true, + description: 'Whether to render the reference documentation (requires gtk-doc)', +) + option( 'installed_tests', type: 'boolean', -- GitLab From 700bf00f4223dd0f81a91bdd4dbbce653e1e50c5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 11 Jul 2022 11:42:44 +0100 Subject: [PATCH 2/2] build: Run gtkdoc-check as part of the tests This checks the documentation is complete. Signed-off-by: Philip Withnall --- .gitlab-ci.yml | 1 + libgsystemservice/docs/meson.build | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 040d7c2..72a4509 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,7 @@ test: stage: test script: - meson _build . -Db_coverage=true + - ninja -C _build libgsystemservice-doc - ninja -C _build test - ninja -C _build coverage coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/' diff --git a/libgsystemservice/docs/meson.build b/libgsystemservice/docs/meson.build index d456268..bde3b6e 100644 --- a/libgsystemservice/docs/meson.build +++ b/libgsystemservice/docs/meson.build @@ -24,4 +24,14 @@ gnome.gtkdoc('libgsystemservice', '--ignore-headers=' + ' '.join(['tests']), ], install: not meson.is_subproject(), -) \ No newline at end of file +) + +test('gtkdoc-check', + find_program('gtkdoc-check'), + suite: ['docs'], + env: [ + 'BUILDDIR=' + meson.current_build_dir(), + 'DOC_MODULE=libgsystemservice', + 'DOC_MAIN_SGML_FILE=docs.xml', + ], +) -- GitLab