summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-04 16:45:43 -0200
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-04 17:02:08 -0200
commit3f5a97e0d62f03fdc1d29cf3873dcb7a536bc5d2 (patch)
treefab01d0a858b75c7cae0863b99f158e93a1be8a9
parentbbd5947f5f2dbdb89955d148543b772cbb34a426 (diff)
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.build14
-rwxr-xr-xsrc/scripts/efl_mono/api_dump.py32
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',
133efl_mono = library('efl_mono', 133efl_mono = library('efl_mono',
134 mono_generator_target + mono_files + [efl_src], 134 mono_generator_target + mono_files + [efl_src],
135 install : true, 135 install : true,
136 install_dir : join_paths(dir_lib, 'efl-mono-'+version_major) 136 install_dir : join_paths(dir_lib, 'efl-mono-'+version_major),
137 cs_args : '-doc:' + join_paths(meson.current_build_dir(), 'libefl_mono.xml')
138)
139
140prog_python = import('python').find_installation('python3')
141
142efl_mono_api = custom_target(
143 'efl_mono_api.txt',
144 input: join_paths(meson.source_root(), 'src', 'scripts', 'efl_mono', 'api_dump.py'),
145 output: 'efl_mono_api.txt',
146 command: [prog_python, '@INPUT@', join_paths(meson.current_build_dir(), 'libefl_mono.xml'), '@OUTPUT@'],
147 depends: [efl_mono],
148 build_by_default : true
137) 149)
138 150
139efl_mono_test_suite_path=join_paths(meson.current_build_dir()) 151efl_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 @@
1#!/usr/bin/env python3
2
3'''Dump names from generated xmldoc.'''
4
5import sys
6import argparse
7import xml.etree.ElementTree as etree
8
9
10def main(argv=None):
11 if argv is None:
12 argv = sys.argv
13
14 parser = argparse.ArgumentParser(description='Dump C# api')
15 parser.add_argument('docfile', metavar='DOCFILE', type=str,
16 nargs=1, help='Input xmldoc file.')
17 parser.add_argument('outfile', metavar='OUTFILE', action='store',
18 default=None, nargs='?', help='Output file')
19
20 args = parser.parse_args()
21
22 tree = etree.parse(args.docfile[0])
23 if args.outfile:
24 outhandle = open(args.outfile, 'w')
25 else:
26 outhandle = sys.stdout
27
28 for member in tree.findall('members/member'):
29 outhandle.write(member.attrib['name'] + '\n')
30
31if __name__ == "__main__":
32 main()