diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
commit | 056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch) | |
tree | 4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/plugins/ssqls.py | |
parent | 269126dcced1cc8b53eb4398b4a33e5142f10290 (diff) | |
download | ydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz |
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/plugins/ssqls.py')
-rw-r--r-- | build/plugins/ssqls.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/build/plugins/ssqls.py b/build/plugins/ssqls.py new file mode 100644 index 0000000000..8c3ea86829 --- /dev/null +++ b/build/plugins/ssqls.py @@ -0,0 +1,40 @@ +from os.path import splitext + +import ymake +from _common import resolve_includes + + +class SSQLSParser(object): + def __init__(self, path, unit): + s = unit.resolve_arc_path(path) + assert s.startswith('$S/') and s.endswith('.ssqls'), s + h = '$B/' + s[3:-6] + '.h' + + import xml.etree.cElementTree as ET + try: + doc = ET.parse(path) + except ET.ParseError as e: + unit.message(['error', 'malformed XML {}: {}'.format(path, e)]) + doc = ET.Element('DbObject') + xmls, headers = self.parse_doc(doc) + self._includes = resolve_includes(unit, s, xmls) + self._induced = {'cpp': [h], 'h': resolve_includes(unit, h, headers)} + + @staticmethod + def parse_doc(doc): + paths = lambda nodes: filter(None, (e.get('path') for e in nodes)) + includes = doc.findall('include') + ancestors = paths(doc.findall('ancestors/ancestor')) + headers = [e.text.strip('<>""') for e in includes] + headers += [splitext(s)[0] + '.h' for s in ancestors] + return paths(includes) + ancestors, headers + + def includes(self): + return self._includes + + def induced_deps(self): + return self._induced + + +def init(): + ymake.addparser('ssqls', SSQLSParser) |