Merge pull request #3539 from mesonbuild/nirbheek/fix-gtkdoc-content-files-File

gnome: some gtk-doc and gdbus-codegen issues
pull/3460/head
Jussi Pakkanen 7 years ago committed by GitHub
commit 05e4298dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      mesonbuild/mintro.py
  2. 14
      mesonbuild/modules/gnome.py
  3. 9
      mesonbuild/scripts/gtkdochelper.py
  4. 18
      run_unittests.py
  5. 4
      test cases/frameworks/10 gtk-doc/doc/meson.build

@ -21,6 +21,7 @@ project files and don't need this info."""
import json import json
from . import build, mtest, coredata as cdata from . import build, mtest, coredata as cdata
from . import mesonlib
from .backend import ninjabackend from .backend import ninjabackend
import argparse import argparse
import sys, os import sys, os
@ -118,8 +119,12 @@ def list_target_files(target_name, coredata, builddata):
except KeyError: except KeyError:
print("Unknown target %s." % target_name) print("Unknown target %s." % target_name)
sys.exit(1) sys.exit(1)
sources = [os.path.join(i.subdir, i.fname) for i in sources] out = []
print(json.dumps(sources)) 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): def list_buildoptions(coredata, builddata):
optlist = [] optlist = []

@ -793,11 +793,13 @@ This will become a hard error in the future.''')
s = s.held_object s = s.held_object
if isinstance(s, (build.CustomTarget, build.CustomTargetIndex)): if isinstance(s, (build.CustomTarget, build.CustomTargetIndex)):
depends.append(s) depends.append(s)
for o in s.get_outputs():
content_files.append(os.path.join(state.environment.get_build_dir(), content_files.append(os.path.join(state.environment.get_build_dir(),
state.backend.get_target_dir(s), state.backend.get_target_dir(s),
s.get_outputs()[0])) o))
elif isinstance(s, mesonlib.File): elif isinstance(s, mesonlib.File):
content_files.append(os.path.join(state.environment.get_build_dir(), s.subdir, s.fname)) content_files.append(s.absolute_path(state.environment.get_source_dir(),
state.environment.get_build_dir()))
elif isinstance(s, build.GeneratedList): elif isinstance(s, build.GeneratedList):
depends.append(s) depends.append(s)
for gen_src in s.get_outputs(): for gen_src in s.get_outputs():
@ -879,7 +881,7 @@ This will become a hard error in the future.''')
if len(args) not in (1, 2): if len(args) not in (1, 2):
raise MesonException('Gdbus_codegen takes at most two arguments, name and xml file.') raise MesonException('Gdbus_codegen takes at most two arguments, name and xml file.')
namebase = args[0] namebase = args[0]
xml_files = [args[1:]] xml_files = args[1:]
target_name = namebase + '-gdbus' target_name = namebase + '-gdbus'
cmd = [self.interpreter.find_program_impl('gdbus-codegen')] cmd = [self.interpreter.find_program_impl('gdbus-codegen')]
if 'interface_prefix' in kwargs: if 'interface_prefix' in kwargs:
@ -936,9 +938,13 @@ This will become a hard error in the future.''')
docbook_cmd = cmd + ['--output-directory', '@OUTDIR@', '--generate-docbook', docbook, '@INPUT@'] docbook_cmd = cmd + ['--output-directory', '@OUTDIR@', '--generate-docbook', docbook, '@INPUT@']
# The docbook output is always ${docbook}-${name_of_xml_file}
output = namebase + '-docbook' output = namebase + '-docbook'
outputs = []
for f in xml_files:
outputs.append('{}-{}'.format(docbook, f))
custom_kwargs = {'input': xml_files, custom_kwargs = {'input': xml_files,
'output': output, 'output': outputs,
'command': docbook_cmd, 'command': docbook_cmd,
'build_by_default': build_by_default 'build_by_default': build_by_default
} }

@ -93,9 +93,12 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
# Copy files to build directory # Copy files to build directory
for f in content_files: for f in content_files:
f_abs = os.path.join(doc_src, f) # FIXME: Use mesonlib.File objects so we don't need to do this
shutil.copyfile(f_abs, os.path.join( if not os.path.isabs(f):
abs_out, os.path.basename(f_abs))) f = os.path.join(doc_src, f)
elif os.path.commonpath([f, build_root]) == build_root:
continue
shutil.copyfile(f, os.path.join(abs_out, os.path.basename(f)))
shutil.rmtree(htmldir, ignore_errors=True) shutil.rmtree(htmldir, ignore_errors=True)
try: try:

@ -688,8 +688,10 @@ class BasePlatformTests(unittest.TestCase):
cmds = [l[len(prefix):].split() for l in log if l.startswith(prefix)] cmds = [l[len(prefix):].split() for l in log if l.startswith(prefix)]
return cmds return cmds
def introspect(self, arg): def introspect(self, args):
out = subprocess.check_output(self.mintro_command + [arg, self.builddir], if isinstance(args, str):
args = [args]
out = subprocess.check_output(self.mintro_command + args + [self.builddir],
universal_newlines=True) universal_newlines=True)
return json.loads(out) return json.loads(out)
@ -2938,6 +2940,18 @@ class LinuxlikeTests(BasePlatformTests):
gobject_found = True gobject_found = True
self.assertTrue(glib_found) self.assertTrue(glib_found)
self.assertTrue(gobject_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): def test_build_rpath(self):
if is_cygwin(): if is_cygwin():

@ -1,11 +1,11 @@
cdata = configuration_data() cdata = configuration_data()
cdata.set('VERSION', '1.0') cdata.set('VERSION', '1.0')
configure_file(input : 'version.xml.in', version_xml = configure_file(input : 'version.xml.in',
output : 'version.xml', output : 'version.xml',
configuration : cdata) configuration : cdata)
gnome.gtkdoc('foobar', gnome.gtkdoc('foobar',
src_dir : inc, src_dir : inc,
main_sgml : 'foobar-docs.sgml', main_sgml : 'foobar-docs.sgml',
content_files : docbook, content_files : [docbook, version_xml],
install : true) install : true)

Loading…
Cancel
Save