diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-12-08 22:53:44 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-12-14 07:38:05 +0100 |
commit | 65c0887bca2909b2046eb5aa4aaace0cc320c3f2 (patch) | |
tree | c4558d703db1521d2999f9421d2ab104555f33ad /solenv | |
parent | 28ff78c950e3480077145f15e7cff36c375a689c (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/createcomponent.xslt | 11 | ||||
-rw-r--r-- | solenv/gbuild/ComponentTarget.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 6 |
3 files changed, 13 insertions, 7 deletions
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 = \ |