diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-02-04 16:45:43 -0200 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-02-04 17:02:08 -0200 |
commit | 3f5a97e0d62f03fdc1d29cf3873dcb7a536bc5d2 (patch) | |
tree | fab01d0a858b75c7cae0863b99f158e93a1be8a9 | |
parent | bbd5947f5f2dbdb89955d148543b772cbb34a426 (diff) | |
download | efl-devs/lauromoura/csharp_api_dump.tar.gz |
efl-mono: Generate API contents file.devs/lauromoura/csharp_api_dump
This commit uses the output of the xmldoc generated by the compiler to
create a list of public members of the api, so we can detect whether the
C# api changed.
-rw-r--r-- | src/bindings/mono/meson.build | 14 | ||||
-rwxr-xr-x | src/scripts/efl_mono/api_dump.py | 32 |
2 files changed, 45 insertions, 1 deletions
diff --git a/src/bindings/mono/meson.build b/src/bindings/mono/meson.build index b9d6879998..286bfc936a 100644 --- a/src/bindings/mono/meson.build +++ b/src/bindings/mono/meson.build @@ -133,7 +133,19 @@ configure_file(input : 'efl_mono.dll.config.in', efl_mono = library('efl_mono', mono_generator_target + mono_files + [efl_src], install : true, - install_dir : join_paths(dir_lib, 'efl-mono-'+version_major) + install_dir : join_paths(dir_lib, 'efl-mono-'+version_major), + cs_args : '-doc:' + join_paths(meson.current_build_dir(), 'libefl_mono.xml') +) + +prog_python = import('python').find_installation('python3') + +efl_mono_api = custom_target( + 'efl_mono_api.txt', + input: join_paths(meson.source_root(), 'src', 'scripts', 'efl_mono', 'api_dump.py'), + output: 'efl_mono_api.txt', + command: [prog_python, '@INPUT@', join_paths(meson.current_build_dir(), 'libefl_mono.xml'), '@OUTPUT@'], + depends: [efl_mono], + build_by_default : true ) efl_mono_test_suite_path=join_paths(meson.current_build_dir()) diff --git a/src/scripts/efl_mono/api_dump.py b/src/scripts/efl_mono/api_dump.py new file mode 100755 index 0000000000..045c19b632 --- /dev/null +++ b/src/scripts/efl_mono/api_dump.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +'''Dump names from generated xmldoc.''' + +import sys +import argparse +import xml.etree.ElementTree as etree + + +def main(argv=None): + if argv is None: + argv = sys.argv + + parser = argparse.ArgumentParser(description='Dump C# api') + parser.add_argument('docfile', metavar='DOCFILE', type=str, + nargs=1, help='Input xmldoc file.') + parser.add_argument('outfile', metavar='OUTFILE', action='store', + default=None, nargs='?', help='Output file') + + args = parser.parse_args() + + tree = etree.parse(args.docfile[0]) + if args.outfile: + outhandle = open(args.outfile, 'w') + else: + outhandle = sys.stdout + + for member in tree.findall('members/member'): + outhandle.write(member.attrib['name'] + '\n') + +if __name__ == "__main__": + main() |