office-gobmx/solenv/bin/optionalimplementations.xslt
Jan-Marek Glogowski 379b685730 Filter optional component implementations by name
Instead of trying to make up BUILD_TYPE items to match complex
build conditions and then patch the component file with it, filter
the component files based on the unique implementation name and
an <optional/> tag. Currently these optional implementations are
grouped in external files with an identifier.
Originally the optional implementations were automatically iden-
tified by adding them to any external file, but this behavior is
too easy to get wrong. Even better: if need arrises, one can now
easily implement a feature to add implementation names directly
using gbuild calls, instead of grouped files.

The basic mechanism is to collect all optional implementations,
remove the needed ones from that list and then filter-out all
implementations not needed (AKA the rest of the list).
It's no problem to have the same optional implementations
selected in multiple files. This is especially used by the
vcl.common component in a later patch.

For gbuild this adds gb_Library_add_componentimpl. The component
parameter for the call is explicitly omitted, so you must call
gb_Library_set_componentfile before selecting any optional
implementations. The strict naming is also enforced by appending
the identifier to the component file name.

This replaces commit 65c0887bca
("Allow for conditional parts of component files").

Change-Id: I0261cadce8bdfebb6b3ec96669ec378a5c1d9699
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126891
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2021-12-21 00:20:07 +01:00

21 lines
800 B
HTML

<?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 "misuses" xsl:message to dump all optional components
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://openoffice.org/2010/uno-components"
xmlns:uc="http://openoffice.org/2010/uno-components">
<xsl:template match="uc:component">
<xsl:for-each select="uc:implementation">
<xsl:if test="uc:optional">
<xsl:message><xsl:value-of select="@name"/></xsl:message>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>