Makefile.gbuild                        |    5 +
 basic/Library_sb.mk                    |    4 
 config_host.mk.in                      |    1 
 configure.ac                           |   20 +++-
 i18npool/Library_i18npool.mk           |    4 
 i18npool/util/i18npool.en.component    |  162 +++++++++++++++++++++++++++++++++
 postprocess/CustomTarget_components.mk |   49 +++++++++
 postprocess/Module_postprocess.mk      |    1 
 postprocess/Rdb_services.mk            |    7 +
 solenv/bin/constructors.py             |   27 +++++
 solenv/bin/native-code.py              |    9 +
 solenv/gbuild/ComponentTarget.mk       |    4 
 solenv/gbuild/Library.mk               |    9 +
 solenv/gbuild/Rdb.mk                   |    3 
 svx/Library_svx.mk                     |    5 -
 svx/util/crashreport.component         |   26 +++++
 svx/util/svx.component                 |    4 
 sw/Library_sw.mk                       |    5 -
 sw/util/sw.component                   |    8 -
 sw/util/sw_mm.component                |   29 +++++
 20 files changed, 364 insertions(+), 18 deletions(-)

New commits:
commit 1c9a40299d328c78c035ca63ccdf22c5c669a03b
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Wed May 19 07:55:40 2021 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Mon Dec 6 19:38:29 2021 +0100

    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 <glo...@fbihome.de>

diff --git a/Makefile.gbuild b/Makefile.gbuild
index 9e7f205e22d4..db049264f65d 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -24,6 +24,11 @@ ifneq (,$(DISABLE_DYNLOADING))
 $(if $(gb_LinkTarget__Lock),$(shell rm -f $(gb_LinkTarget__Lock)))
 endif
 
+ifeq ($(ENABLE_SERVICES_RDB_FROM_BUILD),TRUE)
+$(foreach comp,$(filter-out 
$(gb_Rdb__URECOMPONENTS),$(gb_ComponentTarget__ALLCOMPONENTS)), \
+    $(eval $(call gb_Rdb_add_components,services,$(comp))))
+endif
+
 upload-symbols:
        bin/upload_symbols.py $(WORKDIR)/symbols.zip $(BREAKPAD_SYMBOL_CONFIG) 
"$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)"
 
diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk
index 6a27b15ed54d..6bee8df435cb 100644
--- a/basic/Library_sb.mk
+++ b/basic/Library_sb.mk
@@ -19,8 +19,6 @@
 
 $(eval $(call gb_Library_Library,sb))
 
-$(eval $(call gb_Library_set_componentfile,sb,basic/util/sb))
-
 $(eval $(call gb_Library_set_include,sb,\
        $$(INCLUDE) \
        -I$(SRCDIR)/basic/inc \
@@ -60,6 +58,8 @@ $(eval $(call gb_Library_use_libraries,sb,\
 
 ifneq ($(filter SCRIPTING,$(BUILD_TYPE)),)
 
+$(eval $(call gb_Library_set_componentfile,sb,basic/util/sb))
+
 $(eval $(call gb_Library_add_exception_objects,sb,\
        basic/source/basmgr/basicmanagerrepository \
        basic/source/basmgr/basmgr \
diff --git a/config_host.mk.in b/config_host.mk.in
index b8778cf7e509..59546a8f02e0 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -201,6 +201,7 @@ export 
ENABLE_SCRIPTING_BEANSHELL=@ENABLE_SCRIPTING_BEANSHELL@
 export ENABLE_SCRIPTING_JAVASCRIPT=@ENABLE_SCRIPTING_JAVASCRIPT@
 export ENABLE_SDREMOTE=@ENABLE_SDREMOTE@
 export ENABLE_SDREMOTE_BLUETOOTH=@ENABLE_SDREMOTE_BLUETOOTH@
+export ENABLE_SERVICES_RDB_FROM_BUILD=@ENABLE_SERVICES_RDB_FROM_BUILD@
 export ENABLE_SILENT_MSI=@ENABLE_SILENT_MSI@
 export ENABLE_SKIA=@ENABLE_SKIA@
 export ENABLE_SKIA_DEBUG=@ENABLE_SKIA_DEBUG@
diff --git a/configure.ac b/configure.ac
index b236727456f5..bb51b6f76d16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1967,6 +1967,12 @@ AC_ARG_ENABLE(xmlhelp,
         [Disable XML help support]),
 ,enable_xmlhelp=yes)
 
+AC_ARG_ENABLE(services-rdb-from-build,
+    AS_HELP_STRING([--enable-services-rdb-from-build],
+        [Automatically creates the services.rdb from all built components.
+         Splitting the component files and adapting the Library_*.mk files
+         is WIP and probably just works together with --enable-wasm-strip.]))
+
 
 dnl ===================================================================
 dnl Optional Packages (--with/without-)
@@ -2564,6 +2570,7 @@ AC_ARG_WITH(locales,
          Very experimental and might well break stuff.
          Just a desperate measure to shrink code and data size.
          By default all the locales available is included.
+         Just works with --disable-dynloading. Defaults to "ALL".
          This option is completely unrelated to --with-lang.])
     [
                           Affects also our character encoding conversion
@@ -2825,7 +2832,6 @@ AC_ARG_WITH(system-icu-for-build,
     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
         [Use icu already on system for build tools (cross-compilation only).]))
 
-
 dnl ===================================================================
 dnl Check for incompatible options set by fuzzing, and reset those
 dnl automatically to working combinations
@@ -2944,6 +2950,15 @@ if test $_os != iOS -a $_os != Android -a $_os != 
Emscripten -a "$enable_fuzzers
     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
 fi
 
+ENABLE_SERVICES_RDB_FROM_BUILD=
+if test "$enable_services_rdb_from_build" = yes; then
+    ENABLE_SERVICES_RDB_FROM_BUILD=TRUE
+    if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != 
ALL; then
+        AC_MSG_ERROR([Currently just --with-locales=all or en is supported 
with --enable-services-rdb-from-build])
+    fi
+fi
+AC_SUBST(ENABLE_SERVICES_RDB_FROM_BUILD)
+
 # Whether to build "avmedia" functionality or not.
 
 if test "$enable_avmedia" = yes; then
@@ -5516,6 +5531,7 @@ if test "$cross_compiling" = "yes"; then
         --disable-opencl \
         --disable-pdfimport \
         --disable-postgresql-sdbc \
+        --disable-services-rdb-from-build \
         --disable-skia \
         --enable-icecream="$enable_icecream" \
         --without-doxygen \
@@ -13883,7 +13899,7 @@ if test -d "$SRC_ROOT/translations/source"; then
 fi
 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
 
-if test -n "$with_locales"; then
+if test -n "$with_locales" -a "$with_locales" != ALL; then
     WITH_LOCALES="$with_locales"
 
     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk
index 854b920bd9a4..09293b0856f0 100644
--- a/i18npool/Library_i18npool.mk
+++ b/i18npool/Library_i18npool.mk
@@ -9,7 +9,11 @@
 
 $(eval $(call gb_Library_Library,i18npool))
 
+ifeq ($(WITH_LOCALES),en)
+$(eval $(call gb_Library_set_componentfile,i18npool,i18npool/util/i18npool.en))
+else
 $(eval $(call gb_Library_set_componentfile,i18npool,i18npool/util/i18npool))
+endif
 
 $(eval $(call gb_Library_set_include,i18npool,\
        $$(INCLUDE) \
diff --git a/i18npool/util/i18npool.en.component 
b/i18npool/util/i18npool.en.component
new file mode 100644
index 000000000000..edf2d0a63727
--- /dev/null
+++ b/i18npool/util/i18npool.en.component
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ -->
+
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+    prefix="i18npool" xmlns="http://openoffice.org/2010/uno-components";>
+  <implementation name="com.sun.star.i18n.BreakIterator"
+      constructor="com_sun_star_i18n_BreakIterator_get_implementation">
+    <service name="com.sun.star.i18n.BreakIterator"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.BreakIterator_Unicode"
+      constructor="com_sun_star_i18n_BreakIterator_Unicode_get_implementation">
+    <service name="com.sun.star.i18n.BreakIterator_Unicode"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.CalendarImpl"
+    constructor="i18npool_CalendarImpl_get_implementation">
+    <service name="com.sun.star.i18n.LocaleCalendar"/>
+    <service name="com.sun.star.i18n.LocaleCalendar2"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_ROC"
+    constructor="i18npool_Calendar_ROC_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_ROC"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_dangi"
+    constructor="i18npool_Calendar_dangi_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_dangi"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_buddhist"
+    constructor="i18npool_Calendar_buddhist_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_buddhist"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_gengou"
+    constructor="i18npool_Calendar_gengou_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_gengou"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_gregorian"
+    constructor="i18npool_Calendar_gregorian_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_gregorian"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_hanja"
+    constructor="i18npool_Calendar_hanja_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_hanja"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_hanja_yoil"
+    constructor="i18npool_Calendar_hanja_yoil_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_hanja_yoil"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_hijri"
+    constructor="i18npool_Calendar_hijri_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_hijri"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Calendar_jewish"
+    constructor="i18npool_Calendar_jewish_get_implementation">
+    <service name="com.sun.star.i18n.Calendar_jewish"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.ChapterCollator"
+    constructor="i18npool_ChapterCollator_get_implementation">
+    <service name="com.sun.star.i18n.ChapterCollator"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.CharacterClassification"
+      
constructor="com_sun_star_i18n_CharacterClassification_get_implementation">
+    <service name="com.sun.star.i18n.CharacterClassification"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.CharacterClassification_Unicode"
+      
constructor="com_sun_star_i18n_CharacterClassification_Unicode_get_implementation">
+    <service name="com.sun.star.i18n.CharacterClassification_Unicode"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Collator"
+      constructor="com_sun_star_i18n_Collator_get_implementation">
+    <service name="com.sun.star.i18n.Collator"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Collator_Unicode"
+    constructor="i18npool_Collator_Unicode_get_implementation">
+    <service name="com.sun.star.i18n.Collator_Unicode"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.IndexEntrySupplier"
+    constructor="i18npool_IndexEntrySupplier_get_implementation">
+    <service name="com.sun.star.i18n.IndexEntrySupplier"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.IndexEntrySupplier_Unicode"
+    constructor="i18npool_IndexEntrySupplier_Unicode_get_implementation">
+    <service name="com.sun.star.i18n.IndexEntrySupplier_Unicode"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.IndexEntrySupplier_asian"
+    constructor="i18npool_IndexEntrySupplier_asian_get_implementation">
+    <service name="com.sun.star.i18n.IndexEntrySupplier_asian"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.InputSequenceChecker"
+      constructor="com_sun_star_i18n_InputSequenceChecker_get_implementation">
+    <service name="com.sun.star.i18n.InputSequenceChecker"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.LocaleDataImpl"
+      constructor="com_sun_star_i18n_LocaleDataImpl_get_implementation">
+    <service name="com.sun.star.i18n.LocaleData"/>
+    <service name="com.sun.star.i18n.LocaleData2"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.NativeNumberSupplier"
+      constructor="com_sun_star_i18n_NativeNumberSupplier_get_implementation">
+    <service name="com.sun.star.i18n.NativeNumberSupplier"/>
+    <service name="com.sun.star.i18n.NativeNumberSupplier2"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.NumberFormatCodeMapper"
+      
constructor="com_sun_star_i18n_NumberFormatCodeMapper_get_implementation">
+    <service name="com.sun.star.i18n.NumberFormatMapper"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.OrdinalSuffix"
+      constructor="com_sun_star_i18n_OrdinalSuffix_get_implementation">
+    <service name="com.sun.star.i18n.OrdinalSuffix"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.ScriptTypeDetector"
+      constructor="com_sun_star_i18n_ScriptTypeDetector_get_implementation">
+    <service name="com.sun.star.i18n.ScriptTypeDetector"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.TextConversion"
+      constructor="com_sun_star_i18n_TextConversion_get_implementation">
+    <service name="com.sun.star.i18n.TextConversion"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration"
+      constructor="com_sun_star_i18n_Transliteration_get_implementation">
+    <service name="com.sun.star.i18n.Transliteration"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.NumToCharFullwidth">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.NumToCharHalfwidth">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation 
name="com.sun.star.i18n.Transliteration.NumToTextCircledNumber">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.SENTENCE_CASE">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.TITLE_CASE">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.TOGGLE_CASE">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.i18n.Transliteration.UPPERCASE_LOWERCASE">
+    <service name="com.sun.star.i18n.Transliteration.l10n"/>
+  </implementation>
+  <implementation name="com.sun.star.text.DefaultNumberingProvider"
+      
constructor="com_sun_star_text_DefaultNumberingProvider_get_implementation">
+    <service name="com.sun.star.text.DefaultNumberingProvider"/>
+  </implementation>
+</component>
diff --git a/postprocess/CustomTarget_components.mk 
b/postprocess/CustomTarget_components.mk
new file mode 100644
index 000000000000..3c202ed9988d
--- /dev/null
+++ b/postprocess/CustomTarget_components.mk
@@ -0,0 +1,49 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,postprocess/components))
+
+ifeq (,$(gb_PARTIAL_BUILD))
+
+postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
+
+$(call gb_CustomTarget_get_target,postprocess/components): \
+    $(postprocess_WORKDIR)/services_constructors.list \
+
+gb_EMPTY :=
+define gb_NEWLINE
+
+$(gb_EMPTY)
+endef
+
+$(postprocess_WORKDIR)/services_componentfiles.list: \
+    $(call gb_Rdb_get_target,services) \
+    $(call gb_Rdb_get_target,ure/services) \
+    $(foreach comp,$(gb_ComponentTarget__ALLCOMPONENTS),$(call 
gb_ComponentTarget_get_source,$(comp))) \
+    | $(postprocess_WORKDIR)/.dir
+       $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
+       TEMPFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),1, \
+            $(foreach comp,$(sort $(gb_ComponentTarget__ALLCOMPONENTS)),$(call 
gb_ComponentTarget_get_source,$(comp))$(gb_NEWLINE))) && \
+            mv $$TEMPFILE $@
+
+$(postprocess_WORKDIR)/services_constructors.list: \
+    $(SRCDIR)/solenv/bin/constructors.py \
+    $(postprocess_WORKDIR)/services_componentfiles.list \
+    | $(postprocess_WORKDIR)/.dir
+       $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
+       TEMPFILE=$(shell $(gb_MKTEMP)) && \
+           $(call gb_Helper_abbreviate_dirs,$(call 
gb_ExternalExecutable_get_command,python) $^) > $$TEMPFILE && \
+           $(call gb_Helper_replace_if_different_and_touch,$${TEMPFILE},$@)
+
+.PHONY: $(postprocess_WORKDIR)/services_componentfiles.list
+
+endif # gb_PARTIAL_BUILD
+
+# vim: set noet sw=4:
diff --git a/postprocess/Module_postprocess.mk 
b/postprocess/Module_postprocess.mk
index c1aa1dbc7e87..369feff99367 100644
--- a/postprocess/Module_postprocess.mk
+++ b/postprocess/Module_postprocess.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_Module_Module,postprocess))
 # is reused in Package_registry!
 
 $(eval $(call gb_Module_add_targets,postprocess,\
+    $(if $(ENABLE_SERVICES_RDB_FROM_BUILD),CustomTarget_components) \
        CustomTarget_registry \
        Rdb_services \
 ))
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index ed325128467a..8508341ee474 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -9,6 +9,9 @@
 
 $(eval $(call gb_Rdb_Rdb_install,services))
 
+# see Makefile.gbuild for the gb_Rdb_add_components,services calls
+ifeq (,$(ENABLE_SERVICES_RDB_FROM_BUILD))
+
 #
 # "minimal" list of services for cross-compiling build tools
 #
@@ -115,6 +118,7 @@ $(eval $(call gb_Rdb_add_components,services,\
        slideshow/util/slideshow \
        starmath/util/sm \
        starmath/util/smd \
+    $(call gb_Helper_optional,BREAKPAD,svx/util/crashreport) \
        svx/util/svx \
        svx/util/textconversiondlgs \
        sw/util/msword \
@@ -271,6 +275,7 @@ $(eval $(call gb_Rdb_add_components,services,\
        reportdesign/util/rptui \
        reportdesign/util/rptxml \
        shell/source/backends/localebe/localebe1 \
+    sw/util/sw_mm \
        $(if $(filter-out ANDROID iOS,$(OS)),\
                connectivity/source/drivers/odbc/odbc \
        ) \
@@ -338,4 +343,6 @@ endif
 
 endif # $(gb_Side),host
 
+endif # !ENABLE_SERVICES_RDB_FROM_BUILD
+
 # vim: set noet sw=4 ts=4:
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
 
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 2a9d9d097127..206b3c39b738 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -19,7 +19,10 @@
 
 $(eval $(call gb_Library_Library,svx))
 
-$(eval $(call gb_Library_set_componentfile,svx,svx/util/svx))
+$(eval $(call gb_Library_set_componentfiles,svx, \
+    $(call gb_Helper_optional,BREAKPAD,svx/util/crashreport) \
+    svx/util/svx \
+))
 
 $(eval $(call gb_Library_set_include,svx,\
     -I$(SRCDIR)/svx/inc \
diff --git a/svx/util/crashreport.component b/svx/util/crashreport.component
new file mode 100644
index 000000000000..7d3dddf366aa
--- /dev/null
+++ b/svx/util/crashreport.component
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ -->
+
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+    xmlns="http://openoffice.org/2010/uno-components";>
+  <implementation name="com.sun.star.comp.svx.CrashReportUI"
+      constructor="com_sun_star_comp_svx_CrashReportUI_get_implementation">
+    <service name="com.sun.star.dialog.CrashReportUI"/>
+  </implementation>
+</component>
diff --git a/svx/util/svx.component b/svx/util/svx.component
index ff8d802394ac..97f68c4734c8 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -32,10 +32,6 @@
       constructor="com_sun_star_comp_svx_RecoveryUI_get_implementation">
     <service name="com.sun.star.dialog.RecoveryUI"/>
   </implementation>
-  <implementation name="com.sun.star.comp.svx.CrashReportUI"
-      constructor="com_sun_star_comp_svx_CrashReportUI_get_implementation">
-    <service name="com.sun.star.dialog.CrashReportUI"/>
-  </implementation>
   <implementation name="com.sun.star.comp.svx.SafeModeUI"
       constructor="com_sun_star_comp_svx_SafeModeUI_get_implementation">
     <service name="com.sun.star.dialog.SafeModeUI"/>
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 6c93c0c0f639..582a41ae99e2 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -21,7 +21,10 @@ $(eval $(call gb_Library_Library,sw))
 
 $(eval $(call gb_Library_add_sdi_headers,sw,sw/sdi/swslots))
 
-$(eval $(call gb_Library_set_componentfile,sw,sw/util/sw))
+$(eval $(call gb_Library_set_componentfiles,sw, \
+    $(call gb_Helper_optional,DBCONNECTIVITY,sw/util/sw_mm) \
+    sw/util/sw \
+))
 
 $(eval $(call gb_Library_set_precompiled_header,sw,sw/inc/pch/precompiled_sw))
 
diff --git a/sw/util/sw.component b/sw/util/sw.component
index e05a865a6471..594c43cc68b1 100644
--- a/sw/util/sw.component
+++ b/sw/util/sw.component
@@ -39,14 +39,6 @@
     <service name="com.sun.star.sdb.DataAccessDescriptor"/>
     <service name="com.sun.star.text.MailMerge"/>
   </implementation>
-  <implementation name="lo.writer.MMCurrentEntryController"
-      constructor="lo_writer_MMCurrentEntryController_get_implementation">
-    <service name="com.sun.star.frame.ToolbarController"/>
-  </implementation>
-  <implementation name="lo.writer.MMExcludeEntryController"
-      constructor="lo_writer_MMExcludeEntryController_get_implementation">
-    <service name="com.sun.star.frame.ToolbarController"/>
-  </implementation>
   <implementation name="lo.writer.PageSizeToolBoxControl"
     constructor="lo_writer_PageSizeToolBoxControl_get_implementation">
     <service name="com.sun.star.frame.ToolbarController"/>
diff --git a/sw/util/sw_mm.component b/sw/util/sw_mm.component
new file mode 100644
index 000000000000..701064e97c78
--- /dev/null
+++ b/sw/util/sw_mm.component
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ -->
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+    xmlns="http://openoffice.org/2010/uno-components";>
+  <implementation name="lo.writer.MMCurrentEntryController"
+      constructor="lo_writer_MMCurrentEntryController_get_implementation">
+    <service name="com.sun.star.frame.ToolbarController"/>
+  </implementation>
+  <implementation name="lo.writer.MMExcludeEntryController"
+      constructor="lo_writer_MMExcludeEntryController_get_implementation">
+    <service name="com.sun.star.frame.ToolbarController"/>
+  </implementation>
+</component>

Reply via email to