libvirt/docs/html/meson.build
Peter Krempa 91d890bdce docs/html: Properly generate ACL permissions into API reference
The 'newapi.xsl' stylesheet was referencing non-existing paths to the
XML files holding ACL permission flags for individual APIs. Additionally
the 'document()' XSL function doesn't even allow concatenation of the
path as it was done via '{$builddir}/src..', but requires either direct
argument or use of the 'concat()' function.

This meant that the 'acls' variable was always empty and thus none of
our API documentation was actually generated with the 'acl' section.

Fix it by passing the path to the XML via an argument to the stylesheet
as the files differ based on which document is being generated.

Since the 'admin' API does not have ACL we need to handle it separately
now in the build system.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-02-20 18:26:53 +01:00

118 lines
2.9 KiB
Meson

docs_html_gen = []
docs_html_dep = []
index_api_gen = custom_target(
'index-api',
input: [
newapi_xsl,
docs_api_xml,
],
output: [
'index.html',
'libvirt-libvirt-common.html',
'libvirt-libvirt-domain.html',
'libvirt-libvirt-domain-checkpoint.html',
'libvirt-libvirt-domain-snapshot.html',
'libvirt-libvirt-event.html',
'libvirt-libvirt-host.html',
'libvirt-libvirt-interface.html',
'libvirt-libvirt-network.html',
'libvirt-libvirt-nodedev.html',
'libvirt-libvirt-nwfilter.html',
'libvirt-libvirt-secret.html',
'libvirt-libvirt-storage.html',
'libvirt-libvirt-stream.html',
'libvirt-virterror.html',
],
command: [
xsltproc_prog, '--nonet', '-o', docs_builddir,
'--stringparam', 'builddir', meson.project_build_root(),
'--stringparam', 'aclxmlpath', docs_acl_xml.full_path(),
'--stringparam', 'timestamp', docs_timestamp,
'--stringparam', 'indexfile', 'index.html',
'@INPUT@',
],
install: true,
install_dir: docs_html_dir / 'html',
depends: docs_acl_xml,
depend_files: [
page_xsl,
],
)
docs_html_gen += index_api_gen.to_list()
docs_html_dep += index_api_gen
foreach name : [ 'lxc', 'qemu' ]
index_api_gen = custom_target(
'index-@0@-api'.format(name),
input: [
newapi_xsl,
get_variable('docs_@0@_api_xml'.format(name)),
],
output: [
'libvirt-libvirt-@0@.html'.format(name),
],
command: [
xsltproc_prog, '--nonet', '-o', docs_builddir,
'--stringparam', 'builddir', meson.project_build_root(),
'--stringparam', 'aclxmlpath', get_variable('docs_acl_@0@_xml'.format(name)).full_path(),
'--stringparam', 'timestamp', docs_timestamp,
'@INPUT@',
],
install: true,
install_dir: docs_html_dir / 'html',
depends: get_variable('docs_acl_@0@_xml'.format(name)),
depend_files: [
page_xsl,
],
)
docs_html_gen += index_api_gen.to_list()
docs_html_dep += index_api_gen
endforeach
index_api_gen = custom_target(
'index-admin-api'.format(name),
input: [
newapi_xsl,
docs_admin_api_xml,
],
output: [
'libvirt-libvirt-admin.html'
],
command: [
xsltproc_prog, '--nonet', '-o', docs_builddir,
'--stringparam', 'builddir', meson.project_build_root(),
'--stringparam', 'aclxmlpath', '',
'--stringparam', 'timestamp', docs_timestamp,
'@INPUT@',
],
install: true,
install_dir: docs_html_dir / 'html',
depend_files: [
page_xsl,
],
)
docs_html_gen += index_api_gen.to_list()
docs_html_dep += index_api_gen
docs_html_paths = []
install_web_deps += docs_html_dep
foreach file : docs_html_gen
docs_html_paths += file.full_path()
install_web_files += '@0@:@1@'.format(file.full_path(), docs_html_dir / 'html')
endforeach
test(
'check-html',
xmllint_prog,
args: [
'--nonet', '--noout', docs_html_paths,
],
depends: docs_html_dep,
)