configure.ac          |   25 ++++++++++++++++++++++---
 loleaflet/Makefile.am |    8 +++-----
 2 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 40dffc408c6680d844c9ff6b873946deea7f9168
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Apr 28 17:25:49 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon May 25 20:13:24 2020 +0200

    loleaflet: install node modules in configure phase
    
    It is not necessary to clean these files since
    they do not change frequently
    
    Change-Id: I092013c02effffe6c45bccbf81369e583cffe806
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93111
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/configure.ac b/configure.ac
index 3b2edb7c1..f634ff697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -992,13 +992,31 @@ fi
 
 AC_SUBST(ENABLE_SETCAP)
 
+
+tryLinkFile () {
+    if test ! -r "$1"; then
+        AC_MSG_ERROR(["$1: file not found"])
+    fi
+
+    rm -f $2
+    ln -s "$1" "$2" 2>/dev/null ||
+    ln "$1" "$2" 2>/dev/null ||
+    cp -p "$1" "$2" ||
+    AC_MSG_ERROR(["cannot link or copy $1 to $2"])
+}
+
+if test "$srcdir" != '.'; then
+    mkdir -p loleaflet
+    tryLinkFile $srcdir/loleaflet/package.json loleaflet/package.json
+    tryLinkFile $srcdir/loleaflet/archived-packages loleaflet/archived-packages
+    cp -p $srcdir/loleaflet/npm-shrinkwrap.json loleaflet/npm-shrinkwrap.json
+fi
+
 AC_CONFIG_LINKS([discovery.xml:discovery.xml])
 AC_CONFIG_LINKS([loolkitconfig.xcu:loolkitconfig.xcu])
-AC_CONFIG_LINKS([loleaflet/package.json:loleaflet/package.json])
 AC_CONFIG_LINKS([cypress_test/package.json:cypress_test/package.json])
 AC_CONFIG_LINKS([cypress_test/cypress.json:cypress_test/cypress.json])
 AC_LINK_FILES([cypress_test/plugins], [cypress_test/plugins])
-AC_LINK_FILES([loleaflet/archived-packages], [loleaflet/archived-packages])
 AC_LINK_FILES([cypress_test/eslint_plugin], [cypress_test/eslint_plugin])
 
 APP_BRANDING_DIR=
@@ -1069,7 +1087,6 @@ AC_CONFIG_FILES([Makefile
                  gtk/Makefile
                  test/Makefile
                  loleaflet/Makefile
-                 loleaflet/npm-shrinkwrap.json
                  loolwsd.spec
                  loolwsd.xml
                  debian/loolwsd.postinst])
@@ -1089,6 +1106,8 @@ fi
 
 AC_CONFIG_FILES([test/run_unit.sh],[chmod +x test/run_unit.sh])
 
+AC_CONFIG_COMMANDS_PRE([echo Installing node modules packages... && (cd 
loleaflet && npm install)])
+
 AC_OUTPUT
 
 AC_LANG_POP
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 5d1ddf893..b23ab1a10 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -1,5 +1,6 @@
 MAKEFLAGS = --no-builtin-rules
 CTAGS = ctags
+CONFIG_STATUS_DEPENDENCIES=$(builddir)/node_modules
 
 L10N_PO = $(wildcard $(srcdir)/po/*.po)
 
@@ -320,10 +321,8 @@ LOLEAFLET_PREFIX := $(if $(filter 
true,$(ENABLE_DEBUG)),$(abs_builddir),$(abs_bu
 
 EXTRA_DIST = $(shell find . -type f -not -path './.git/*' | sed 's/.\///')
 
-all-local:
+all-local: build-loleaflet
        $(abs_top_srcdir)/scripts/unocommands.py --check $(abs_top_srcdir)
-       @$(MAKE) node_modules
-       @$(MAKE) build-loleaflet
 
 if !ENABLE_MOBILEAPP
 ADMIN_BUNDLE = $(DIST_FOLDER)/admin-bundle.js
@@ -432,7 +431,7 @@ $(DIST_FOLDER)/loleaflet.html: 
$(srcdir)/html/loleaflet.html.m4 $(LOLEAFLET_HTML
                -DVENDOR="$(VENDOR)" \
                $(srcdir)/html/loleaflet.html.m4 > $@
 
-node_modules: npm-shrinkwrap.json
+node_modules: package.json archived-packages
        @npm install
        @touch node_modules
 
@@ -593,7 +592,6 @@ l10n: pot
 #      done
 
 clean-local:
-       rm -rf node_modules
        @rm -rf $(DIST_FOLDER)
        @rm -rf $(builddir)/build/dist
        @rm -f $(abs_srcdir)/jsconfig.json
diff --git a/loleaflet/npm-shrinkwrap.json.in b/loleaflet/npm-shrinkwrap.json
similarity index 100%
rename from loleaflet/npm-shrinkwrap.json.in
rename to loleaflet/npm-shrinkwrap.json
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to