CustomTarget_html.mk |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit f048f02f505704a76c4f01b4ff3f369e8ed928b5
Author:     Christian Lohmaier <[email protected]>
AuthorDate: Tue Dec 13 14:35:15 2022 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Tue Dec 13 15:12:01 2022 +0000

    hid2file.js generation: process in batch, not each file one-by-one
    
    xsltproc can happily process many files at once, no need to process them
    individually and also no need to surround them with the rm, touch, rm
    triplet each time to catch a possible error.
    When letting xargs actually run the command, then xargs will report
    error if any invocation failed. It will not stop execution commands for
    remaining input unless the command exists with status 255 explicitly,
    but this doesn't matter, processing the whole batch regardless is still
    much faster than processing each file separately.
    To maximize the number of files that can be processed in a single
    command, don't prefix each file with $(SRCDIR)/, but instead cd to
    $(SRCRDIR) before running the command.
    
    Change-Id: I532a54f7298d7011900af5e618d75b37649b0477
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/144050
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/CustomTarget_html.mk b/CustomTarget_html.mk
index 7c6ed744da..46068e82b0 100644
--- a/CustomTarget_html.mk
+++ b/CustomTarget_html.mk
@@ -38,9 +38,6 @@ $(eval $(call 
gb_CustomTarget_register_targets,helpcontent2/help3xsl,\
        ) \
 ))
 
-# In the below recipe, the file [email protected] is used to communicate failure of 
xsltproc in the pipeline
-# (similar to Bash's `set -o pipefail`; the final `rm [email protected]` will fail, and 
fail the whole
-# command, if the xsltproc invocation failed):
 $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \
                $(SRCDIR)/helpcontent2/help3xsl/generate_hid2file.xsl \
                $(call gb_ExternalExecutable_get_dependencies,xsltproc) \
@@ -49,15 +46,9 @@ $(call 
gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1)
        $(call gb_Helper_abbreviate_dirs,\
                ( \
+                       RESPONSEFILE=$(call gb_var2file,$(shell 
$(gb_MKTEMP)),$(foreach 
module,$(html_TEXT_MODULES),$(gb_AllLangHelp_$(module)_HELPFILES)))  && \
                        echo 'var hid2fileMap = {' \
-                       && RESPONSEFILE=$(call gb_var2file,$(shell 
$(gb_MKTEMP)),$(foreach module,$(html_TEXT_MODULES),$(addprefix 
$(SRCDIR)/,$(gb_AllLangHelp_$(module)_HELPFILES)))) \
-                       && <"$$RESPONSEFILE" $(if $(filter WNT,$(OS)),tr -d 
'\r' | env -i PATH="$$PATH") xargs -n 1 printf '%s\n' \
-                       | while read xhp; do \
-                               rm -f [email protected] && \
-                               { $(call 
gb_ExternalExecutable_get_command,xsltproc) $< $$xhp && touch [email protected]; } \
-                               | $(gb_AWK) 'NF' \
-                               && rm [email protected] || exit \
-                       ; done \
+                       && cd $(SRCDIR) && xargs $(call 
gb_ExternalExecutable_get_command,xsltproc) $< <$$RESPONSEFILE || { rm 
$$RESPONSEFILE; exit 1 ; } \
                        && rm "$$RESPONSEFILE" \
                        && echo '};' \
                ) > $@ \

Reply via email to