loleaflet/Makefile.am |   41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 445ca4269a43497c792389a73e703adaf56ab0bf
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue May 26 15:25:28 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Fri May 29 01:26:30 2020 +0200

    loleaflet: makefile: simplify the rules for bundling loleaflet
    
    So it can be flexible to bundle Debug or Release
    and it can be used in other platform (i.e. Android)
    
    Change-Id: Ia98abc0711c98b8f34654956534ce414f34dbdb4
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94891
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 583198820..c91e19cc7 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -325,6 +325,25 @@ INTERMEDIATE_DIR := $(if $(filter 
true,$(ENABLE_DEBUG)),$(abs_builddir),$(abs_bu
 
 EXTRA_DIST = $(shell find . -type f -not -path './.git/*' | sed 's/.\///')
 
+BUNDLE ?= $(if $(filter true,$(ENABLE_DEBUG)),DEBUG,RELEASE)
+
+define bundle_loleaflet
+       $(if $(filter DEBUG,$(1)),\
+               @touch $@,
+               @m4 -PE -DIOSAPP=$(ENABLE_IOSAPP) \
+                       -DGTKAPP=$(ENABLE_GTKAPP) \
+                       -DANDROIDAPP=$(ENABLE_ANDROIDAPP) \
+                       -DMOBILEAPPNAME="$(APP_NAME)" \
+                       -DVERSION=$(LOLEAFLET_VERSION) \
+                       -DCOPYRIGHT=$(srcdir)/src/copyright.js \
+                       -DLOLEAFLET_JS=$(subst $(SPACE),$(COMMA),$(patsubst 
%.js,$(srcdir)/%.js,$(LOLEAFLET_JS))) \
+                       $(srcdir)/loleaflet-src.js.m4 > $@)
+endef
+
+define prereq_loleaflet
+       $(if $(filter DEBUG,$(1)),$(LOLEAFLET_JS_DST),$(LOLEAFLET_JS_SRC))
+endef
+
 all-local: build-loleaflet
        $(abs_top_srcdir)/scripts/unocommands.py --check $(abs_top_srcdir)
 
@@ -363,16 +382,14 @@ $(INTERMEDIATE_DIR)/admin-src.js: $(LOLEAFLET_ADMIN_ALL)
        @$(NODE) node_modules/eslint/bin/eslint.js $(srcdir)/admin/src 
--ignore-path $(srcdir)/.eslintignore --config $(srcdir)/.eslintrc
        @awk 'FNR == 1 {print ""} 1' $(patsubst 
%.js,$(srcdir)/%.js,$(LOLEAFLET_ADMIN_JS)) > $@
 
-
-
-if ENABLE_DEBUG
-$(INTERMEDIATE_DIR)/loleaflet-src.js: $(LOLEAFLET_JS_DST)
+$(INTERMEDIATE_DIR)/loleaflet-src.js: $(call prereq_loleaflet,$(BUNDLE))
        @mkdir -p $(dir $@)
        @echo "Checking for loleaflet JS errors..."
        @$(NODE) node_modules/eslint/bin/eslint.js $(srcdir)/src \
                $(srcdir)/js --ignore-path $(srcdir)/.eslintignore --config 
$(srcdir)/.eslintrc
-       @touch $@
+       $(call bundle_loleaflet($(BUNDLE)))
 
+if ENABLE_DEBUG
 $(DIST_FOLDER)/bundle.css: $(LOLEAFLET_CSS_DST)
        @touch $@
 
@@ -381,20 +398,6 @@ $(DIST_FOLDER)/bundle.js: $(NODE_MODULES_JS_DST) \
        $(LOLEAFLET_LIBS_JS_DST)
        @touch $@
 else
-$(INTERMEDIATE_DIR)/loleaflet-src.js: $(LOLEAFLET_JS_SRC)
-       @mkdir -p $(dir $@)
-       @echo "Checking for loleaflet JS errors..."
-       @$(NODE) node_modules/eslint/bin/eslint.js $(srcdir)/src \
-               $(srcdir)/js --ignore-path $(srcdir)/.eslintignore --config 
$(srcdir)/.eslintrc
-       @m4 -PE -DIOSAPP=$(ENABLE_IOSAPP) \
-               -DGTKAPP=$(ENABLE_GTKAPP) \
-               -DANDROIDAPP=$(ENABLE_ANDROIDAPP) \
-               -DMOBILEAPPNAME="$(APP_NAME)" \
-               -DVERSION=$(LOLEAFLET_VERSION) \
-               -DCOPYRIGHT=$(srcdir)/src/copyright.js \
-               -DLOLEAFLET_JS=$(subst $(SPACE),$(COMMA),$(patsubst 
%.js,$(srcdir)/%.js,$(LOLEAFLET_JS))) \
-               $(srcdir)/loleaflet-src.js.m4 > $@
-
 $(DIST_FOLDER)/bundle.css: $(LOLEAFLET_CSS)
        @echo "Uglify loleaflet css files..."
        @$(NODE) node_modules/uglifycss/uglifycss $(LOLEAFLET_CSS) > $@
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to