summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-05-06 20:12:17 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-05-06 20:25:16 +0530
commit26aeef7bf5243b9003648b272b956ff760f21f35 (patch)
treedc88cc8506a669ee7efdacf15bd18507348c49f2
parentc1f275bfa644beafab9f8572351d4b64d61c148b (diff)
downloadmeson-nirbheek/fix-gtkdoc-content-files-File.tar.gz
gnome.gdbus_codegen: Fix output file list for docbook custom targetsnirbheek/fix-gtkdoc-content-files-File
We were setting it to a totally wrong name, while the output of gtkdoc is very predictable. Also add a test for it, and fix a bug in meson introspect found while adding the test. The test will only work with glib 2.56.2, so it will be skipped on the CI. I ran it manually to verify that it works.
-rw-r--r--mesonbuild/mintro.py9
-rw-r--r--mesonbuild/modules/gnome.py8
-rwxr-xr-xrun_unittests.py18
3 files changed, 29 insertions, 6 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 5a9d4cfa9..81c70ed07 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -21,6 +21,7 @@ project files and don't need this info."""
import json
from . import build, mtest, coredata as cdata
+from . import mesonlib
from .backend import ninjabackend
import argparse
import sys, os
@@ -118,8 +119,12 @@ def list_target_files(target_name, coredata, builddata):
except KeyError:
print("Unknown target %s." % target_name)
sys.exit(1)
- sources = [os.path.join(i.subdir, i.fname) for i in sources]
- print(json.dumps(sources))
+ out = []
+ for i in sources:
+ if isinstance(i, mesonlib.File):
+ i = os.path.join(i.subdir, i.fname)
+ out.append(i)
+ print(json.dumps(out))
def list_buildoptions(coredata, builddata):
optlist = []
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index e553b4afa..da72a1fff 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -881,7 +881,7 @@ This will become a hard error in the future.''')
if len(args) not in (1, 2):
raise MesonException('Gdbus_codegen takes at most two arguments, name and xml file.')
namebase = args[0]
- xml_files = [args[1:]]
+ xml_files = args[1:]
target_name = namebase + '-gdbus'
cmd = [self.interpreter.find_program_impl('gdbus-codegen')]
if 'interface_prefix' in kwargs:
@@ -938,9 +938,13 @@ This will become a hard error in the future.''')
docbook_cmd = cmd + ['--output-directory', '@OUTDIR@', '--generate-docbook', docbook, '@INPUT@']
+ # The docbook output is always ${docbook}-${name_of_xml_file}
output = namebase + '-docbook'
+ outputs = []
+ for f in xml_files:
+ outputs.append('{}-{}'.format(docbook, f))
custom_kwargs = {'input': xml_files,
- 'output': output,
+ 'output': outputs,
'command': docbook_cmd,
'build_by_default': build_by_default
}
diff --git a/run_unittests.py b/run_unittests.py
index 78bb9b7b6..94c14dabc 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -688,8 +688,10 @@ class BasePlatformTests(unittest.TestCase):
cmds = [l[len(prefix):].split() for l in log if l.startswith(prefix)]
return cmds
- def introspect(self, arg):
- out = subprocess.check_output(self.mintro_command + [arg, self.builddir],
+ def introspect(self, args):
+ if isinstance(args, str):
+ args = [args]
+ out = subprocess.check_output(self.mintro_command + args + [self.builddir],
universal_newlines=True)
return json.loads(out)
@@ -2938,6 +2940,18 @@ class LinuxlikeTests(BasePlatformTests):
gobject_found = True
self.assertTrue(glib_found)
self.assertTrue(gobject_found)
+ if subprocess.call(['pkg-config', '--exists', 'glib-2.0 >= 2.56.2']) != 0:
+ raise unittest.SkipTest('glib >= 2.56.2 needed for the rest')
+ targets = self.introspect('--targets')
+ docbook_target = None
+ for t in targets:
+ if t['name'] == 'generated-gdbus-docbook':
+ docbook_target = t
+ break
+ self.assertIsInstance(docbook_target, dict)
+ ifile = self.introspect(['--target-files', 'generated-gdbus-docbook@cus'])[0]
+ self.assertEqual(t['filename'], 'gdbus/generated-gdbus-doc-' + ifile)
+
def test_build_rpath(self):
if is_cygwin():