summaryrefslogtreecommitdiff
path: root/solenv/bin
diff options
context:
space:
mode:
Diffstat (limited to 'solenv/bin')
-rwxr-xr-xsolenv/bin/constructors.py27
-rwxr-xr-xsolenv/bin/native-code.py9
2 files changed, 36 insertions, 0 deletions
diff --git a/solenv/bin/constructors.py b/solenv/bin/constructors.py
new file mode 100755
index 000000000000..1237da17142d
--- /dev/null
+++ b/solenv/bin/constructors.py
@@ -0,0 +1,27 @@
+#!/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))
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index d1d36140f0ab..7abb6c97ac4d 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -817,6 +817,7 @@ opts.add_option("-j", "--java-guard", action="store_true", help="include externa
opts.add_option("-g", "--group", action="append", help="group of implementations to make available in application", dest="groups")
opts.add_option("-r", "--limit-rdb", action="append", help="instead of outputting native-code.cxx, limit the services.rdb only to the services defined by the groups", dest="services")
opts.add_option("-C", "--pure-c", action="store_true", help="do not print extern \"C\"", dest="pure_c", default=False)
+opts.add_option("-c", "--constructors", help="file with the list of constructors", dest="constructors_file")
(options, args) = opts.parse_args()
@@ -830,6 +831,9 @@ if options.groups:
else:
full_constructor_map[constructor] = True
+if not options.groups and options.constructors_file:
+ options.groups = factory_map.keys()
+
# dict of all the factories that we need according to -g's
full_factory_map = {}
if options.groups:
@@ -846,6 +850,11 @@ if options.services:
limit_rdb(options.services, full_factory_map, full_constructor_map)
exit(0)
+if options.constructors_file:
+ with open(options.constructors_file, "r") as constructors:
+ for line in constructors:
+ full_constructor_map[line.strip()] = True
+
print ("""/*
* This is a generated file. Do not edit.
*