solenv/bin/createcomponent.xslt | 11 +++++++++++ solenv/gbuild/ComponentTarget.mk | 3 ++- solenv/gbuild/Library.mk | 6 ------ svx/Library_svx.mk | 5 +---- svx/util/crashreport.component | 26 -------------------------- svx/util/svx.component | 5 +++++ sw/Library_sw.mk | 5 +---- sw/util/sw.component | 10 ++++++++++ sw/util/sw_mm.component | 29 ----------------------------- 9 files changed, 30 insertions(+), 70 deletions(-)
New commits: commit 65c0887bca2909b2046eb5aa4aaace0cc320c3f2 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Dec 8 22:53:44 2021 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Dec 14 07:38:05 2021 +0100 Allow for conditional parts of component files 1c9a40299d328c78c035ca63ccdf22c5c669a03b "gbuild: create services.rdb from built components" had moved parts of svx/util/svx.component and sw/util/sw.component into additional, conditionally included component files (and which this commit moves back into the original component files). But that lead to multiple <component> elements for a single library in service rdb files, which was unfortunate for several reasons: For one, while the code in cppuhelper/source/servicemanager.cxx happened to support that, it was not guaranteed to support it, so this relied on an implementation detail of that code. And for another, for that to work, all the component files for a library had to provide identical environment, loader, and prefix (if any) attributes, but which was not verified and thus was brittle. Instead, introduce a CONDITION attribute for the <implementation> elements in the source component files, which decides whether or not such <implementation> elements are passed through (after dropping the CONDITION attribute) into the processed component files (in workdir/ComponentTarget/). (The attribute is spelled all-uppercase to make it more obvious that it is special syntax that is not simply passed through to the output component file.) For now, such a CONDITION attribute must have a value that matches BUILD_TYPE:x for some feature x in $(BUILD_TYPE), but the syntax can be extended if the need arises. (gb_Library_set_componentfiles is thus no longer needed and has been removed again.) Change-Id: I360cf4cc0f3a2a738113d430891500715a8fe3a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126560 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/solenv/bin/createcomponent.xslt b/solenv/bin/createcomponent.xslt index 4e20a2db1901..d33641cc62fa 100644 --- a/solenv/bin/createcomponent.xslt +++ b/solenv/bin/createcomponent.xslt @@ -23,6 +23,7 @@ xmlns:uc="http://openoffice.org/2010/uno-components"> <xsl:param name="uri"/> <xsl:param name="cppu_env"/> + <xsl:param name="features"/> <xsl:strip-space elements="*"/> <xsl:template match="uc:component"> <components> @@ -35,6 +36,15 @@ </xsl:copy> </components> </xsl:template> + <xsl:template match="uc:implementation[@CONDITION]"> + <xsl:variable name="feature" select="concat('(',@CONDITION,')')"/> + <xsl:if test="contains($features,$feature)"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:apply-templates/> + </xsl:copy> + </xsl:if> + </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="@*"/> @@ -50,6 +60,7 @@ </xsl:call-template> </xsl:attribute> </xsl:template> + <xsl:template match="@CONDITION"/> <xsl:template match="@*"> <xsl:copy/> </xsl:template> diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk index 8aef599dc59a..8c4ef55bbad1 100644 --- a/solenv/gbuild/ComponentTarget.mk +++ b/solenv/gbuild/ComponentTarget.mk @@ -32,7 +32,8 @@ $(if $(LIBFILENAME),,$(call gb_Output_error,No LIBFILENAME set at component targ mkdir -p $(dir $(1)) && \ $(call gb_ExternalExecutable_get_command,xsltproc) --nonet \ --stringparam uri '$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(subst \d,$$,$(COMPONENTPREFIX)))$(LIBFILENAME)' \ - --stringparam cppu_env $(CPPU_ENV) -o $(1) \ + --stringparam cppu_env $(CPPU_ENV) \ + --stringparam features '$(patsubst %,(BUILD_TYPE:%),$(BUILD_TYPE))' -o $(1) \ $(gb_ComponentTarget_XSLTCOMMANDFILE) $(COMPONENTSOURCE) endef diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index df42c047f846..19d77bcd29ff 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -148,12 +148,6 @@ $(call gb_Library_get_clean_target,$(gb_Library__get_name)) : \ endef -# call gb_Library_set_componentfiles,library,componentfiles,rdb -define gb_Library_set_componentfiles -$(foreach comp,$(2),$(call gb_Library_set_componentfile,$(1),$(comp),$(3))) - -endef - gb_Library__get_name = $(if $(filter $(1),$(gb_MERGEDLIBS)),merged,$(1)) gb_Library__get_componentprefix = \ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index c11aac85071c..efb5a6e1b031 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -19,10 +19,7 @@ $(eval $(call gb_Library_Library,svx)) -$(eval $(call gb_Library_set_componentfiles,svx, \ - $(call gb_Helper_optional,BREAKPAD,svx/util/crashreport) \ - svx/util/svx \ -,services)) +$(eval $(call gb_Library_set_componentfile,svx,svx/util/svx,services)) $(eval $(call gb_Library_set_include,svx,\ -I$(SRCDIR)/svx/inc \ diff --git a/svx/util/crashreport.component b/svx/util/crashreport.component deleted file mode 100644 index 7d3dddf366aa..000000000000 --- a/svx/util/crashreport.component +++ /dev/null @@ -1,26 +0,0 @@ -<?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 97f68c4734c8..9fffed787719 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -32,6 +32,11 @@ 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" + CONDITION="BUILD_TYPE:BREAKPAD"> + <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 7ff8190b8858..6989bce49cea 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -21,10 +21,7 @@ $(eval $(call gb_Library_Library,sw)) $(eval $(call gb_Library_add_sdi_headers,sw,sw/sdi/swslots)) -$(eval $(call gb_Library_set_componentfiles,sw, \ - $(call gb_Helper_optional,DBCONNECTIVITY,sw/util/sw_mm) \ - sw/util/sw \ -,services)) +$(eval $(call gb_Library_set_componentfile,sw,sw/util/sw,services)) $(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 594c43cc68b1..a36eaee795a8 100644 --- a/sw/util/sw.component +++ b/sw/util/sw.component @@ -39,6 +39,16 @@ <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" + CONDITION="BUILD_TYPE:DBCONNECTIVITY"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> + <implementation name="lo.writer.MMExcludeEntryController" + constructor="lo_writer_MMExcludeEntryController_get_implementation" + CONDITION="BUILD_TYPE:DBCONNECTIVITY"> + <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 deleted file mode 100644 index 701064e97c78..000000000000 --- a/sw/util/sw_mm.component +++ /dev/null @@ -1,29 +0,0 @@ -<?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>