office-gobmx/solenv/bin/constructors.py
Jan-Marek Glogowski 1c9a40299d gbuild: create services.rdb from built components
... and introduce the --enable-services-rdb-from-build option.

Currently the build handles global build options redundant
in a few places:

* in Repository*mk + modules - the "real" build dependencies
* the full services.rdb generation
* the static UNO constructor map generation

Also the component files don't reflect the really built components
and so the RDB services generation must handle the whole options
to select the correct components.

So this optionally replaces the latter two by generating the list
of components and it's constructors from the build itself. As a
consequence, component files must now be split, so they reflect
the real components in the libraries, otherwise the static
constructor list will have missing symbols. IMHO this is more
natural, as it happens in the same place already handling these
build options for the sourcecode.

This also adds a convenience helper to add multiple component
files: gb_Library_set_componentfiles

This is WIP and currently just works for the stripped WASM build,
which introduces many more split component files in later patches.

It also explicitly filters the gb_Rdb__URECOMPONENTS and the
CppunitTest related components from the services.rdb. Maybe there
is a good way to do this properly.

Change-Id: I1b38a6f2c1e5221f18d7e5e756c30263b555d962
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126185
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-06 19:38:29 +01:00

27 lines
900 B
Python
Executable file

#!/usr/bin/env python3
# Call $0 <file with a list of component file paths>
# Dumps all the implementing constructors to stdout
import xml.sax
import os.path
import sys
constructors = list()
class ComponentHandler(xml.sax.ContentHandler):
def startElement(self, tag, attributes):
if tag == "implementation" and "constructor" in attributes:
constructors.append(attributes["constructor"])
if __name__ == "__main__":
parser = xml.sax.make_parser()
parser.setFeature(xml.sax.handler.feature_namespaces, 0)
parser.setContentHandler(ComponentHandler())
for filename in sys.argv[1:]:
with open(filename, "r") as components_listfile:
for line in components_listfile:
for component_filename in line.strip().split():
parser.parse(component_filename)
constructors.sort()
print("\n".join(constructors))