From 65c0887bca2909b2046eb5aa4aaace0cc320c3f2 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 8 Dec 2021 22:53:44 +0100 Subject: [PATCH] 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 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 elements in the source component files, which decides whether or not such 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 --- 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(-) delete mode 100644 svx/util/crashreport.component delete mode 100644 sw/util/sw_mm.component 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"> + @@ -35,6 +36,15 @@ + + + + + + + + + @@ -50,6 +60,7 @@ + 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 @@ - - - - - - - - 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"> + + + 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 @@ + + + + + + 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 @@ - - - - - - - - - -