summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
Diffstat (limited to 'solenv')
-rwxr-xr-xsolenv/bin/constructors.py27
-rwxr-xr-xsolenv/bin/native-code.py9
-rw-r--r--solenv/gbuild/ComponentTarget.mk4
-rw-r--r--solenv/gbuild/Library.mk9
-rw-r--r--solenv/gbuild/Rdb.mk3
5 files changed, 52 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.
*
diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk
index 067f24e35ce6..de88ae1f5177 100644
--- a/solenv/gbuild/ComponentTarget.mk
+++ b/solenv/gbuild/ComponentTarget.mk
@@ -17,6 +17,8 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
+gb_ComponentTarget__ALLCOMPONENTS :=
+
gb_ComponentTarget_XSLTCOMMANDFILE := $(SRCDIR)/solenv/bin/createcomponent.xslt
gb_ComponentTarget_get_source = $(SRCDIR)/$(1).component
@@ -58,6 +60,8 @@ $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTSOURCE := $(call gb_Compon
$(call gb_ComponentTarget_get_target,$(1)) : $(call gb_ComponentTarget_get_source,$(patsubst CppunitTest/%,%,$(1)))
+$(if $(filter $(1),$(patsubst CppunitTest/%,%,$(1))),$(eval gb_ComponentTarget__ALLCOMPONENTS += $(1)))
+
endef
# vim: set noet sw=4:
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 9894951d3260..36911dee31a0 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -133,6 +133,8 @@ endef
# But the component target also must be delivered; use the target
# gb_Library_get_exports_target for that purpose, since it is already
# the "final" target of the Library...
+#
+# call gb_Library_set_componentfile,library,componentfile
define gb_Library_set_componentfile
$(call gb_ComponentTarget_ComponentTarget,$(2),\
$(call gb_Library__get_componentprefix,$(gb_Library__get_name)),\
@@ -143,6 +145,13 @@ $(call gb_ComponentTarget_get_target,$(2)) :| \
$(call gb_Library_get_target,$(gb_Library__get_name))
$(call gb_Library_get_clean_target,$(gb_Library__get_name)) : \
$(call gb_ComponentTarget_get_clean_target,$(2))
+
+endef
+
+# call gb_Library_set_componentfiles,library,componentfiles
+define gb_Library_set_componentfiles
+$(foreach comp,$(2),$(call gb_Library_set_componentfile,$(1),$(comp)))
+
endef
gb_Library__get_name = $(if $(filter $(1),$(gb_MERGEDLIBS)),merged,$(1))
diff --git a/solenv/gbuild/Rdb.mk b/solenv/gbuild/Rdb.mk
index ccbb313d9ce8..d59ab043180a 100644
--- a/solenv/gbuild/Rdb.mk
+++ b/solenv/gbuild/Rdb.mk
@@ -7,6 +7,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+gb_Rdb__URECOMPONENTS :=
+
gb_Rdb__get_install_target = $(INSTROOT)/$(LIBO_ETC_FOLDER)/services/$(1).rdb
define gb_Rdb__command
@@ -59,6 +61,7 @@ endef
define gb_Rdb_add_component
$(call gb_Rdb_get_target,$(1)) : $(call gb_ComponentTarget_get_target,$(2))
$(call gb_Rdb_get_target,$(1)) : COMPONENTS += $(2)
+$(if $(filter ure/services,$(1)),$(eval gb_Rdb__URECOMPONENTS += $(2)))
endef