loleaflet/Makefile.am | 10 ++++++---- loleaflet/bundle.js.m4 | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-)
New commits: commit 175cbdb3f436981acac46bb6748545890712cb44 Author: Henry Castro <[email protected]> AuthorDate: Fri Feb 21 15:59:23 2020 -0400 Commit: Henry Castro <[email protected]> CommitDate: Tue Mar 3 18:21:10 2020 +0100 loleaflet: makefile: use m4 to bundle all js files It is a flexible bundling of all javascript libraries and each platform (ANDROID, IOS, Desktop) can remove or add from node_modules or imported according to its requirements. Maybe in a near future some external libraries could be loaded on demand or lazy loading that are not necessary when the page is loading. Change-Id: Ief5d4973ab29a4fb3c4848c3e1653a24fff0da69 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89860 Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Henry Castro <[email protected]> Reviewed-by: Henry Castro <[email protected]> diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am index 2710f180e..968cfabbc 100644 --- a/loleaflet/Makefile.am +++ b/loleaflet/Makefile.am @@ -378,11 +378,13 @@ $(builddir)/dist/bundle.js: $(NODE_MODULES_JS_SRC) \ $(LOLEAFLET_PREFIX)/dist/loleaflet-src.js \ $(LOLEAFLET_LIBS_JS_SRC) @echo "Uglify loleaflet js files..." + @m4 -PE -DL10N_IOS_ALL_JS=$(L10N_IOS_ALL_JS) \ + -DNODE_MODULES_JS=$(subst $(SPACE),$(COMMA),$(NODE_MODULES_JS)) \ + -DLOLEAFLET_LIBS_JS=$(subst $(SPACE),$(COMMA),$(LOLEAFLET_LIBS_JS_SRC)) \ + -DLOLEAFLET_JS=$(builddir)/build/dist/loleaflet-src.js \ + $(srcdir)/bundle.js.m4 > $(LOLEAFLET_PREFIX)/dist/bundle.js NODE_PATH=$(abs_builddir)/node_modules $(NODE) node_modules/uglify-js/bin/uglifyjs \ - $(L10N_IOS_ALL_JS) \ - $(NODE_MODULES_JS) \ - $(LOLEAFLET_LIBS_JS_SRC) \ - $(builddir)/build/dist/loleaflet-src.js \ + $(LOLEAFLET_PREFIX)/dist/bundle.js \ --output $@ endif diff --git a/loleaflet/bundle.js.m4 b/loleaflet/bundle.js.m4 new file mode 100644 index 000000000..b43b74589 --- /dev/null +++ b/loleaflet/bundle.js.m4 @@ -0,0 +1,22 @@ +m4_changequote([,])m4_dnl +m4_dnl# foreachq(x, `item_1, item_2, ..., item_n', stmt) +m4_dnl# quoted list, alternate improved version +m4_define([m4_foreachq],[m4_ifelse([$2],[],[],[m4_pushdef([$1])_$0([$1],[$3],[],$2)m4_popdef([$1])])])m4_dnl +m4_define([_m4_foreachq],[m4_ifelse([$#],[3],[],[m4_define([$1],[$4])$2[]$0([$1],[$2],m4_shift(m4_shift(m4_shift($@))))])])m4_dnl +m4_define([m4_trim],[m4_patsubst([$1],[^. ?\(.*\) .$])])m4_dnl +m4_dnl +m4_dnl files for IOS +m4_ifelse(m4_trim(L10N_IOS_ALL_JS),[],[],[m4_syscmd([cat ]L10N_IOS_ALL_JS)]) + +m4_dnl node_modules +m4_foreachq([fileNode],[NODE_MODULES_JS],[ +m4_syscmd([cat ]fileNode) +]) + +m4_dnl imported libraries +m4_foreachq([fileLib],[LOLEAFLET_LIBS_JS],[ +m4_syscmd([cat ]fileLib) +]) + +m4_dnl bundled loleaflet +m4_syscmd([cat ]LOLEAFLET_JS) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
