[gobject-introspection/meson-tests-doctool] meson: port doctool tests



commit d5b7546d2b3072a82ab0005ede2f82e0c3b768b9
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu Jan 3 09:42:28 2019 +0100

    meson: port doctool tests

 giscanner/meson.build     | 12 ++++++++++
 tests/scanner/meson.build | 58 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/meson.build         |  3 +++
 3 files changed, 73 insertions(+)
---
diff --git a/giscanner/meson.build b/giscanner/meson.build
index 4998865a..6ae34067 100644
--- a/giscanner/meson.build
+++ b/giscanner/meson.build
@@ -49,6 +49,18 @@ endforeach
 
 install_subdir('doctemplates', install_dir: giscannerdir)
 
+# XXX: this doesn't track the input, but there is nothing to copy many files
+# in meson.
+doc_templates = custom_target('copy-templates',
+  input : 'doctemplates',
+  output : 'doctemplates',
+  command : [
+    python, '-c',
+      'import sys, shutil;' +
+      'shutil.rmtree(sys.argv[2], ignore_errors=True);' +
+      'shutil.copytree(sys.argv[1], sys.argv[2])',
+    '@INPUT@', '@OUTPUT@'])
+
 flex = find_program('flex', 'win_flex')
 bison = find_program('bison', 'win_bison')
 
diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
index d5415f78..e5e0cc70 100644
--- a/tests/scanner/meson.build
+++ b/tests/scanner/meson.build
@@ -503,6 +503,64 @@ foreach gir : test_girs
   )
 endforeach
 
+if get_option('doctool') and glib_dep.type_name() == 'pkgconfig'
+  foreach language : ['C', 'Python', 'Gjs']
+    regress_docs = custom_target(
+      'generate-docs-' + language,
+      input: regress_gir,
+      depends: [doc_templates],
+      build_by_default: not with_cairo,
+      output: 'Regress-1.0-' + language,
+      command: [
+        python, girdoctool,
+        '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+        '--add-include-path=' + meson.current_build_dir(),
+        '--language', language,
+        '@INPUT@', '-o', '@OUTPUT@'],
+    )
+
+    if with_cairo
+      test(
+        'gi-tester-docs-Regress-1.0-' + language,
+        python,
+        args: [gi_tester, 'Regress-1.0-' + language],
+        depends: [regress_docs],
+        env: [
+          'srcdir=' + meson.current_source_dir(),
+          'builddir=' + meson.current_build_dir(),
+        ],
+      )
+    endif
+  endforeach
+
+  regress_sections = custom_target(
+    'generate-docs-sections',
+    input: regress_gir,
+    depends: [doc_templates],
+    build_by_default: not with_cairo,
+    output: 'Regress-1.0-sections.txt',
+    command: [
+      python, girdoctool,
+      '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+      '--add-include-path=' + meson.current_build_dir(),
+      '--write-sections-file',
+      '@INPUT@', '-o', '@OUTPUT@'],
+  )
+
+  if with_cairo
+    test(
+      'gi-tester-docs-Regress-1.0-sections.txt',
+      python,
+      args: [gi_tester, 'Regress-1.0-sections.txt'],
+      depends: [regress_docs],
+      env: [
+        'srcdir=' + meson.current_source_dir(),
+        'builddir=' + meson.current_build_dir(),
+      ],
+    )
+  endif
+endif
+
 foreach typelib : test_typelibs
   typelib_name = typelib.full_path().split('/')[-1]
   test(
diff --git a/tools/meson.build b/tools/meson.build
index 806441af..6d38361a 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -39,6 +39,9 @@ foreach tool : tools
 endforeach
 
 girscanner = tool_output[0]
+if get_option('doctool')
+  girdoctool = tool_output[-1]
+endif
 
 custom_c_args = cc.get_supported_arguments([
   '-Wno-missing-field-initializers',


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